diff options
author | Sandor Yu <Sandor.yu@nxp.com> | 2018-11-28 15:06:17 +0800 |
---|---|---|
committer | Bryan O'Donoghue <bryan.odonoghue@linaro.org> | 2019-05-01 17:43:27 +0100 |
commit | 6c1c1ca5fd3f8ef2cecbcbc4923be5c7d96b5211 (patch) | |
tree | df254b18b5d181649d672412af44d58146aac5c7 | |
parent | 5ff6dc91d84b263c113d502f010a74168bcc878a (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>
(cherry picked from commit 4ad828b95e78a652f509110688a6f907fc286ea9)
-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)); |