summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahul Sharma <rahsha@codeaurora.org>2018-05-17 16:58:47 +0530
committerRahul Sharma <rahsha@codeaurora.org>2018-05-27 16:24:45 +0530
commite01d6aedaad0c4b56846a8712b31e52610a4000b (patch)
tree5fe5dec1e7ce92b842c11aab6435722da0aadcbf
parent845a8313ad9f99527da5401e522f266285e6c6a4 (diff)
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>
-rw-r--r--include/sound/apr_audio-v2.h5
-rw-r--r--sound/soc/msm/qdsp6v2/msm-qti-pp-config.c55
2 files changed, 60 insertions, 0 deletions
diff --git a/include/sound/apr_audio-v2.h b/include/sound/apr_audio-v2.h
index ee65bdae9971..48fe32252e8d 100644
--- a/include/sound/apr_audio-v2.h
+++ b/include/sound/apr_audio-v2.h
@@ -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_ */
diff --git a/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c b/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c
index 1ddb3845cd40..47d8f4c75e6b 100644
--- a/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c
+++ b/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c
@@ -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 */