aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamprasad Katkam <katkam@codeaurora.org>2018-07-02 14:54:42 +0530
committerShirle Yuen <shirleyshukyee@google.com>2018-08-05 16:34:32 -0700
commit9083f9f7c2bb394c5cbdd5d056e1fc2bee688d6b (patch)
treec6ab099b69d0e266cdcaf906a3f452fc148d0685
parent0f5a1fb2980af0eb9a11b57cccfd5fd3a86f1d66 (diff)
downloadqcom-msm8x09-v3.10-9083f9f7c2bb394c5cbdd5d056e1fc2bee688d6b.tar.gz
ASoC: msm: qdsp6v2: Add mutex protection for rtac cal apis
Add mutex lock protection to synchronize rtac calibration set and get api calls. Bug: 111289931 Change-Id: Ieb2d01642ecefff6405bb59554157c304b4b651d Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org> (cherry picked from commit 658fc7e2e00802bc17e29e242b527f054605ca70)
-rw-r--r--sound/soc/msm/qdsp6v2/rtac.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sound/soc/msm/qdsp6v2/rtac.c b/sound/soc/msm/qdsp6v2/rtac.c
index 11edd2a6caf..f908879ab81 100644
--- a/sound/soc/msm/qdsp6v2/rtac.c
+++ b/sound/soc/msm/qdsp6v2/rtac.c
@@ -144,6 +144,11 @@ struct mutex rtac_voice_mutex;
struct mutex rtac_voice_apr_mutex;
struct mutex rtac_afe_apr_mutex;
+static struct mutex rtac_asm_cal_mutex;
+static struct mutex rtac_adm_cal_mutex;
+static struct mutex rtac_afe_cal_mutex;
+static struct mutex rtac_voice_cal_mutex;
+
int rtac_clear_mapping(uint32_t cal_type)
{
int result = 0;
@@ -1590,42 +1595,62 @@ static long rtac_ioctl_shared(struct file *f,
}
case AUDIO_GET_RTAC_ADM_CAL:
+ mutex_lock(&rtac_adm_cal_mutex);
result = send_adm_apr((void *)arg, ADM_CMD_GET_PP_PARAMS_V5);
+ mutex_unlock(&rtac_adm_cal_mutex);
break;
case AUDIO_SET_RTAC_ADM_CAL:
+ mutex_lock(&rtac_adm_cal_mutex);
result = send_adm_apr((void *)arg, ADM_CMD_SET_PP_PARAMS_V5);
+ mutex_unlock(&rtac_adm_cal_mutex);
break;
case AUDIO_GET_RTAC_ASM_CAL:
+ mutex_lock(&rtac_asm_cal_mutex);
result = send_rtac_asm_apr((void *)arg,
ASM_STREAM_CMD_GET_PP_PARAMS_V2);
+ mutex_unlock(&rtac_asm_cal_mutex);
break;
case AUDIO_SET_RTAC_ASM_CAL:
+ mutex_lock(&rtac_asm_cal_mutex);
result = send_rtac_asm_apr((void *)arg,
ASM_STREAM_CMD_SET_PP_PARAMS_V2);
+ mutex_unlock(&rtac_asm_cal_mutex);
break;
case AUDIO_GET_RTAC_CVS_CAL:
+ mutex_lock(&rtac_voice_cal_mutex);
result = send_voice_apr(RTAC_CVS, (void *)arg,
VOICE_CMD_GET_PARAM);
+ mutex_unlock(&rtac_voice_cal_mutex);
break;
case AUDIO_SET_RTAC_CVS_CAL:
+ mutex_lock(&rtac_voice_cal_mutex);
result = send_voice_apr(RTAC_CVS, (void *)arg,
VOICE_CMD_SET_PARAM);
+ mutex_unlock(&rtac_voice_cal_mutex);
break;
case AUDIO_GET_RTAC_CVP_CAL:
+ mutex_lock(&rtac_voice_cal_mutex);
result = send_voice_apr(RTAC_CVP, (void *)arg,
VOICE_CMD_GET_PARAM);
+ mutex_unlock(&rtac_voice_cal_mutex);
break;
case AUDIO_SET_RTAC_CVP_CAL:
+ mutex_lock(&rtac_voice_cal_mutex);
result = send_voice_apr(RTAC_CVP, (void *)arg,
VOICE_CMD_SET_PARAM);
+ mutex_unlock(&rtac_voice_cal_mutex);
break;
case AUDIO_GET_RTAC_AFE_CAL:
+ mutex_lock(&rtac_afe_cal_mutex);
result = send_rtac_afe_apr((void *)arg,
AFE_PORT_CMD_GET_PARAM_V2);
+ mutex_unlock(&rtac_afe_cal_mutex);
break;
case AUDIO_SET_RTAC_AFE_CAL:
+ mutex_lock(&rtac_afe_cal_mutex);
result = send_rtac_afe_apr((void *)arg,
AFE_PORT_CMD_SET_PARAM_V2);
+ mutex_unlock(&rtac_afe_cal_mutex);
break;
default:
pr_err("%s: Invalid IOCTL, command = %d!\n",
@@ -1757,6 +1782,7 @@ static int __init rtac_init(void)
init_waitqueue_head(&rtac_adm_apr_data.cmd_wait);
mutex_init(&rtac_adm_mutex);
mutex_init(&rtac_adm_apr_mutex);
+ mutex_init(&rtac_adm_cal_mutex);
rtac_adm_buffer = kzalloc(
rtac_cal[ADM_RTAC_CAL].map_data.map_size, GFP_KERNEL);
@@ -1773,6 +1799,7 @@ static int __init rtac_init(void)
init_waitqueue_head(&rtac_asm_apr_data[i].cmd_wait);
}
mutex_init(&rtac_asm_apr_mutex);
+ mutex_init(&rtac_asm_cal_mutex);
rtac_asm_buffer = kzalloc(
rtac_cal[ASM_RTAC_CAL].map_data.map_size, GFP_KERNEL);
@@ -1788,6 +1815,7 @@ static int __init rtac_init(void)
atomic_set(&rtac_afe_apr_data.cmd_state, 0);
init_waitqueue_head(&rtac_afe_apr_data.cmd_wait);
mutex_init(&rtac_afe_apr_mutex);
+ mutex_init(&rtac_afe_cal_mutex);
rtac_afe_buffer = kzalloc(
rtac_cal[AFE_RTAC_CAL].map_data.map_size, GFP_KERNEL);
@@ -1808,6 +1836,7 @@ static int __init rtac_init(void)
}
mutex_init(&rtac_voice_mutex);
mutex_init(&rtac_voice_apr_mutex);
+ mutex_init(&rtac_voice_cal_mutex);
rtac_voice_buffer = kzalloc(
rtac_cal[VOICE_RTAC_CAL].map_data.map_size, GFP_KERNEL);