diff options
author | Laurentiu Palcu <laurentiu.palcu@nxp.com> | 2018-09-28 08:56:54 +0300 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-10-10 02:00:32 -0700 |
commit | a176f9de5446787a9c4fd85bbef73db88ec9075b (patch) | |
tree | 56d9a74d0b10bbedafe779c87b4c45f51203338c | |
parent | 4ecce8da15117d46339c68ee72dd658fa03a071d (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>
(cherry picked from commit a809d62f2060cf2e907257806bebf688ffc8c924)
-rw-r--r-- | drivers/video/imx/hdp/API_General.c | 27 |
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) |