ASoC: msm: Add mixer controls for module enabling

Mixer controls are added to enable or disable
ADSP modules.

Change-Id: Ia2471c3fc25429001ccf19d6b30d34d6e2cf9d27
Signed-off-by: Rahul Sharma <rahsha@codeaurora.org>
This commit is contained in:
Rahul Sharma 2018-05-17 16:58:47 +05:30
parent 845a8313ad
commit e01d6aedaa
2 changed files with 60 additions and 0 deletions

View file

@ -11587,4 +11587,9 @@ struct admx_sec_primary_mic_ch {
uint16_t reserved1;
} __packed;
/*
* ID of the DTMF Detection module.
*/
#define AUDPROC_MODULE_ID_DTMF_DETECTION 0x00010940
#endif /*_APR_AUDIO_V2_H_ */

View file

@ -172,6 +172,45 @@ static int msm_qti_pp_put_eq_band_count_audio_mixer(
return 0;
}
static int msm_qti_pp_put_dtmf_module_enable
(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
u16 fe_id = 0;
struct msm_pcm_routing_fdai_data fe_dai;
struct audio_client *ac = NULL;
struct param_hdr_v3 param_hdr;
int ret = 0;
u32 flag = ucontrol->value.integer.value[0];
fe_id = ((struct soc_multi_mixer_control *)
kcontrol->private_value)->shift;
if (fe_id >= MSM_FRONTEND_DAI_MM_SIZE) {
pr_err("%s: invalid FE %d\n", __func__, fe_id);
return -EINVAL;
}
msm_pcm_routing_get_fedai_info(fe_id, SESSION_TYPE_RX, &fe_dai);
ac = q6asm_get_audio_client(fe_dai.strm_id);
if (ac == NULL) {
pr_err("%s ac is null.\n", __func__);
ret = -EINVAL;
goto done;
}
param_hdr.module_id = AUDPROC_MODULE_ID_DTMF_DETECTION;
param_hdr.instance_id = INSTANCE_ID_0;
param_hdr.param_id = AUDPROC_PARAM_ID_ENABLE;
param_hdr.param_size = 4;
ret = q6asm_pack_and_set_pp_param_in_band(ac,
param_hdr, (u8 *)&flag);
done:
return ret;
}
static int msm_qti_pp_get_eq_band_audio_mixer(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@ -1363,6 +1402,18 @@ static const struct snd_kcontrol_new asphere_mixer_controls[] = {
0xFFFFFFFF, 0, 2, msm_qti_pp_asphere_get, msm_qti_pp_asphere_set),
};
static const struct snd_kcontrol_new dtmf_detect_enable_mixer_controls[] = {
SOC_SINGLE_EXT("MultiMedia1 DTMF Detect Enable", SND_SOC_NOPM,
MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, NULL,
msm_qti_pp_put_dtmf_module_enable),
SOC_SINGLE_EXT("MultiMedia6 DTMF Detect Enable", SND_SOC_NOPM,
MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, NULL,
msm_qti_pp_put_dtmf_module_enable),
SOC_SINGLE_EXT("MultiMedia21 DTMF Detect Enable", SND_SOC_NOPM,
MSM_FRONTEND_DAI_MULTIMEDIA21, 1, 0, NULL,
msm_qti_pp_put_dtmf_module_enable),
};
#ifdef CONFIG_QTI_PP
void msm_qti_pp_add_controls(struct snd_soc_platform *platform)
{
@ -1419,5 +1470,9 @@ void msm_qti_pp_add_controls(struct snd_soc_platform *platform)
snd_soc_add_platform_controls(platform, msm_multichannel_ec_controls,
ARRAY_SIZE(msm_multichannel_ec_controls));
snd_soc_add_platform_controls(platform,
dtmf_detect_enable_mixer_controls,
ARRAY_SIZE(dtmf_detect_enable_mixer_controls));
}
#endif /* CONFIG_QTI_PP */