Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0f16ac9 authored by Derek Chen's avatar Derek Chen Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: Add mixer control for DTMF module enabling



Mixer controls are added to enable and disable
DTMF ADSP modules.

Change-Id: Ic04c4696b31f77488cb2047829b823255872f7ac
Signed-off-by: default avatarDerek Chen <chenche@codeaurora.org>
parent 5a85f242
Loading
Loading
Loading
Loading
+56 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/err.h>
@@ -166,6 +166,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)
{
@@ -1646,6 +1685,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_component *component)
{
@@ -1718,5 +1769,9 @@ void msm_qti_pp_add_controls(struct snd_soc_component *component)

	snd_soc_add_component_controls(component, ec_ffecns_controls,
			ARRAY_SIZE(ec_ffecns_controls));

	snd_soc_add_component_controls(component,
				dtmf_detect_enable_mixer_controls,
			ARRAY_SIZE(dtmf_detect_enable_mixer_controls));
}
#endif /* CONFIG_QTI_PP */
+6 −0
Original line number Diff line number Diff line
@@ -12682,6 +12682,12 @@ struct afe_doa_tracking_mon_get_param_resp {
#define AUDPROC_MODULE_ID_FFECNS 0x00010952
#define AUDPROC_MODULE_ID_FFNS 0x00010962
#define AUDPROC_PARAM_ID_FFV_DOA_TRACKING_PARAM 0x0001097C

/*
* ID of the DTMF Detection Module.
*/
#define AUDPROC_MODULE_ID_DTMF_DETECTION        0x00010940

#define AUDPROC_PARAM_ID_FFV_DOA_TRACKING_MONITOR 0x0001097D

struct admx_sec_primary_mic_ch {