summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@nxp.com>2018-09-28 08:56:54 +0300
committerLaurentiu Palcu <laurentiu.palcu@nxp.com>2018-10-09 15:26:46 +0300
commita809d62f2060cf2e907257806bebf688ffc8c924 (patch)
tree1bbcf116284717d5e02921381ca839aaf2255993 /drivers
parent49f36f64066b6cd9ac23d08b2b7af63b5ed9717d (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/imx/hdp/API_General.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/video/imx/hdp/API_General.c b/drivers/video/imx/hdp/API_General.c
index f52e994b24..4f08c2be74 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_get_debug_reg_val(uint16_t *val)
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)