diff options
author | Ramprasad Katkam <katkam@codeaurora.org> | 2018-06-19 17:07:57 +0530 |
---|---|---|
committer | Prashanth Swaminathan <prashanthsw@google.com> | 2018-09-04 12:52:37 -0700 |
commit | 30d5a2aad7579642152e26db90f5f148571e817f (patch) | |
tree | e687a6a9d75504dda01fa13fd90286f1a44794b2 | |
parent | 5e7079df23cdf4e4368b9bff3a8e2b1a815f803e (diff) | |
download | qcom-msm-v4.9-30d5a2aad7579642152e26db90f5f148571e817f.tar.gz |
rtac: Add mutex protection for rtac cal apis.
Add mutex lock protection to synchronize rtac
calibration set and get api calls
Bug: 111906763
Change-Id: Ieb2d01642ecefff6405bb59554157c304b4b651d
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
-rw-r--r-- | techpack/audio/dsp/rtac.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/techpack/audio/dsp/rtac.c b/techpack/audio/dsp/rtac.c index 765be049bec8..83c015d0c782 100644 --- a/techpack/audio/dsp/rtac.c +++ b/techpack/audio/dsp/rtac.c @@ -125,6 +125,10 @@ struct mutex rtac_asm_apr_mutex; 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) { @@ -1723,42 +1727,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, 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", @@ -1890,6 +1914,7 @@ 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); @@ -1903,6 +1928,7 @@ 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); @@ -1916,6 +1942,7 @@ 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); @@ -1934,6 +1961,7 @@ 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); |