diff options
author | Sandor Yu <Sandor.yu@nxp.com> | 2018-11-28 15:06:17 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:35:31 +0800 |
commit | 7b04e2d9288f87ac650e62ba995329798168078e (patch) | |
tree | 7179f66fc2848b6172086cfcb5deb89a2a897914 /drivers/mxc/hdp | |
parent | 9252c34799df9172850d7e842c83a9b524853b7e (diff) |
MLK-20481: hdp: 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>
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Diffstat (limited to 'drivers/mxc/hdp')
-rw-r--r-- | drivers/mxc/hdp/API_General.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/mxc/hdp/API_General.c b/drivers/mxc/hdp/API_General.c index 85c0b61963f2..6c2c5fe0b754 100644 --- a/drivers/mxc/hdp/API_General.c +++ b/drivers/mxc/hdp/API_General.c @@ -51,8 +51,6 @@ #include "general_handler.h" #include "util.h" -static u32 alive; - CDN_API_STATUS CDN_API_LoadFirmware(state_struct *state, u8 *iMem, int imemSize, u8 *dMem, int dmemSize) { @@ -243,15 +241,25 @@ CDN_API_STATUS CDN_API_Get_Debug_Reg_Val(state_struct *state, u16 *val) CDN_API_STATUS CDN_API_CheckAlive(state_struct *state) { - u32 newalive; - if (cdn_apb_read(state, KEEP_ALIVE << 2, &newalive)) + u32 alive, newalive; + u8 retries_left = 10; + + if (cdn_apb_read(state, 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(state, KEEP_ALIVE << 2, &newalive)) + return CDN_ERR; + if (alive == newalive) + continue; + return CDN_OK; + } + return CDN_BSY; } + CDN_API_STATUS CDN_API_CheckAlive_blocking(state_struct *state) { internal_block_function(&state->mutex, CDN_API_CheckAlive(state)); |