msm: adsp: qdsp5: Allow MOD_READY event in ENABLING state
JPEGTASK is receiving MOD_READY event after it is disabled
which is not expected. When JPEGTASK enable fails with
ETIMEDOUT error, this module is disabled immediately.
But MOD_READY event for this module is sent by RPC to
Apps ADSP Driver even after it is disabled. Ignore this
event incase module state is not in ENABLING state.
CRs-Fixed: 395420
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
(cherry picked from commit d8aa19223074d2470a9f4b12a472ea74a82138c0)
Change-Id: I58cc97fc5ed6896c15de2c8880a726e375010c65
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdsp5/adsp.c b/arch/arm/mach-msm/qdsp5/adsp.c
index 11f6b28..6189da8 100644
--- a/arch/arm/mach-msm/qdsp5/adsp.c
+++ b/arch/arm/mach-msm/qdsp5/adsp.c
@@ -720,11 +720,22 @@
mutex_lock(&module->lock);
switch (event) {
case RPC_ADSP_RTOS_MOD_READY:
- MM_INFO("module %s: READY\n", module->name);
- module->state = ADSP_STATE_ENABLED;
- wake_up(&module->state_wait);
- adsp_set_image(module->info, image);
- break;
+ if (module->state == ADSP_STATE_ENABLING) {
+ MM_INFO("module %s: READY\n", module->name);
+ module->state = ADSP_STATE_ENABLED;
+ wake_up(&module->state_wait);
+ adsp_set_image(module->info, image);
+ break;
+ } else {
+ MM_ERR("module %s got READY event in state[%d]\n",
+ module->name,
+ module->state);
+ rpc_send_accepted_void_reply(rpc_cb_server_client,
+ req->xid,
+ RPC_ACCEPTSTAT_GARBAGE_ARGS);
+ mutex_unlock(&module->lock);
+ return;
+ }
case RPC_ADSP_RTOS_MOD_DISABLE:
MM_INFO("module %s: DISABLED\n", module->name);
module->state = ADSP_STATE_DISABLED;