From 48cf12d6e4f2df884ec32692e0bc918f6520b025 Mon Sep 17 00:00:00 2001 From: Rohit Kumar Date: Mon, 28 Nov 2016 12:23:18 +0530 Subject: [PATCH] ASoC: msm: qdsp6v2: Add mutex in afe_map_cal_data Add mutex_lock in afe_map_cal_data around afe_cmd_memory_map to avoid update of this_afe.status by afe_set_lpass_clk_cfg afe callback. This fixes the failure of afe_cmd_memory_map waitqueue to enter into sleep when wait_event_timeout is called as this_afe.status is already zero leading to invalid map_handle. CRs-Fixed: 1094151 Change-Id: I4833253803c162c98578ba7ce599ea1edafc1724 Signed-off-by: Rohit Kumar --- sound/soc/msm/qdsp6v2/q6afe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/msm/qdsp6v2/q6afe.c b/sound/soc/msm/qdsp6v2/q6afe.c index 75dc7cf059e3..6fdf1b9dc2b6 100644 --- a/sound/soc/msm/qdsp6v2/q6afe.c +++ b/sound/soc/msm/qdsp6v2/q6afe.c @@ -6360,6 +6360,7 @@ static int afe_map_cal_data(int32_t cal_type, } + mutex_lock(&this_afe.afe_cmd_lock); atomic_set(&this_afe.mem_map_cal_index, cal_index); ret = afe_cmd_memory_map(cal_block->cal_data.paddr, cal_block->map_data.map_size); @@ -6372,10 +6373,12 @@ static int afe_map_cal_data(int32_t cal_type, __func__, &cal_block->cal_data.paddr, cal_block->map_data.map_size); + mutex_unlock(&this_afe.afe_cmd_lock); goto done; } cal_block->map_data.q6map_handle = atomic_read(&this_afe. mem_map_cal_handles[cal_index]); + mutex_unlock(&this_afe.afe_cmd_lock); done: return ret; }