Merge b00a887cc029b88f54f70ff20d29a58e952c3ea1 on remote branch
Change-Id: Ia0d50da05457cf4d97515cbcebde69ebf3a2f8ae
diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c
index a33f028..5fcde20 100644
--- a/asoc/msm-pcm-routing-v2.c
+++ b/asoc/msm-pcm-routing-v2.c
@@ -14393,15 +14393,18 @@
struct snd_ctl_elem_value *ucontrol)
{
int i = 0, j;
- int num_app_types = ucontrol->value.integer.value[i++];
+ int num_app_types;
- memset(lsm_app_type_cfg, 0, MAX_APP_TYPES*
- sizeof(struct msm_pcm_routing_app_type_data));
- if (num_app_types > MAX_APP_TYPES) {
+ if (ucontrol->value.integer.value[0] > MAX_APP_TYPES) {
pr_err("%s: number of app types exceed the max supported\n",
__func__);
return -EINVAL;
}
+
+ num_app_types = ucontrol->value.integer.value[i++];
+ memset(lsm_app_type_cfg, 0, MAX_APP_TYPES*
+ sizeof(struct msm_pcm_routing_app_type_data));
+
for (j = 0; j < num_app_types; j++) {
lsm_app_type_cfg[j].app_type =
ucontrol->value.integer.value[i++];
diff --git a/dsp/rtac.c b/dsp/rtac.c
index a4dec9a..47f205d 100644
--- a/dsp/rtac.c
+++ b/dsp/rtac.c
@@ -126,6 +126,10 @@
struct mutex rtac_voice_mutex;
struct mutex rtac_voice_apr_mutex;
struct mutex rtac_afe_apr_mutex;
+struct mutex rtac_asm_cal_mutex;
+struct mutex rtac_adm_cal_mutex;
+struct mutex rtac_afe_cal_mutex;
+struct mutex rtac_voice_cal_mutex;
int rtac_clear_mapping(uint32_t cal_type)
{
@@ -1730,42 +1734,62 @@
}
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,
VSS_ICOMMON_CMD_GET_PARAM_V2);
+ 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,
VSS_ICOMMON_CMD_SET_PARAM_V2);
+ 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,
VSS_ICOMMON_CMD_GET_PARAM_V2);
+ 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,
VSS_ICOMMON_CMD_SET_PARAM_V2);
+ 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",
@@ -1902,6 +1926,7 @@
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);
@@ -1915,6 +1940,7 @@
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);
@@ -1928,6 +1954,7 @@
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);
@@ -1946,6 +1973,7 @@
}
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);