MLK-19623: change hdmi keep-alive check mechanism

The current keep-alive check mechanism uses a static variable that is
initialized to 0. When the function is first called, it may happen to
catch the 8-bit keep-alive counter right when it overflows, hence
returning BUSY.

This patch will keep checking the counter for 10us, every 1us, but it
will immediately return if the keep-alive counter changed.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
(cherry picked from commit a809d62f2060cf2e907257806bebf688ffc8c924)
diff --git a/drivers/video/imx/hdp/API_General.c b/drivers/video/imx/hdp/API_General.c
index f52e994..4f08c2b 100644
--- a/drivers/video/imx/hdp/API_General.c
+++ b/drivers/video/imx/hdp/API_General.c
@@ -264,14 +264,27 @@
 
 CDN_API_STATUS cdn_api_checkalive(void)
 {
-	static unsigned int alive;
-	unsigned int newalive;
-	if (cdn_apb_read(KEEP_ALIVE << 2, &newalive))
+	unsigned int alive, newalive;
+	uint8_t retries_left = 10;
+
+	if (cdn_apb_read(KEEP_ALIVE << 2, &alive))
 		return CDN_ERR;
-	if (alive == newalive)
-		return CDN_BSY;
-	alive = newalive;
-	return CDN_OK;
+
+	while (retries_left--) {
+		udelay(1);
+
+		if (cdn_apb_read(KEEP_ALIVE << 2, &newalive))
+			return CDN_ERR;
+
+		if (alive == newalive)
+			continue;
+
+		return CDN_OK;
+	}
+
+	printf("%s: keep-alive counter did not increment for 10us...\n", __func__);
+
+	return CDN_BSY;
 }
 
 CDN_API_STATUS cdn_api_checkalive_blocking(void)