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

Commit a3ea494c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: Add support for HFP on MSM8996"

parents c0a21ff3 3cbcfbae
Loading
Loading
Loading
Loading
+44 −4
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ static struct mutex routing_lock;
static struct cal_type_data *cal_data;

static int fm_switch_enable;
static int hfp_switch_enable;
static int fm_pcmrx_switch_enable;
static int lsm_mux_slim_port;
static int slim0_rx_aanc_fb_port;
@@ -1291,6 +1292,35 @@ static int msm_routing_put_switch_mixer(struct snd_kcontrol *kcontrol,
	return 1;
}

static int msm_routing_get_hfp_switch_mixer(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	ucontrol->value.integer.value[0] = hfp_switch_enable;
	pr_debug("%s: HFP Switch enable %ld\n", __func__,
		ucontrol->value.integer.value[0]);
	return 0;
}

static int msm_routing_put_hfp_switch_mixer(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_dapm_widget_list *wlist =
					dapm_kcontrol_get_wlist(kcontrol);
	struct snd_soc_dapm_widget *widget = wlist->widgets[0];
	struct snd_soc_dapm_update *update = NULL;

	pr_debug("%s: HFP Switch enable %ld\n", __func__,
			ucontrol->value.integer.value[0]);
	if (ucontrol->value.integer.value[0])
		snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol,
						1, update);
	else
		snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol,
						0, update);
	hfp_switch_enable = ucontrol->value.integer.value[0];
	return 1;
}

static int msm_routing_get_fm_pcmrx_switch_mixer(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
@@ -3888,15 +3918,20 @@ static const struct snd_kcontrol_new quat_mi2s_rx_switch_mixer_controls =
	0, 1, 0, msm_routing_get_switch_mixer,
	msm_routing_put_switch_mixer);

static const struct snd_kcontrol_new hfp_pri_aux_switch_mixer_controls =
	SOC_SINGLE_EXT("Switch", SND_SOC_NOPM,
	0, 1, 0, msm_routing_get_hfp_switch_mixer,
	msm_routing_put_hfp_switch_mixer);

static const struct snd_kcontrol_new hfp_aux_switch_mixer_controls =
	SOC_SINGLE_EXT("Switch", SND_SOC_NOPM,
	0, 1, 0, msm_routing_get_switch_mixer,
	msm_routing_put_switch_mixer);
	0, 1, 0, msm_routing_get_hfp_switch_mixer,
	msm_routing_put_hfp_switch_mixer);

static const struct snd_kcontrol_new hfp_int_switch_mixer_controls =
	SOC_SINGLE_EXT("Switch", SND_SOC_NOPM,
	0, 1, 0, msm_routing_get_switch_mixer,
	msm_routing_put_switch_mixer);
	0, 1, 0, msm_routing_get_hfp_switch_mixer,
	msm_routing_put_hfp_switch_mixer);

static const struct soc_enum lsm_mux_enum =
	SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(mad_audio_mux_text), mad_audio_mux_text);
@@ -4937,6 +4972,8 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
				&pri_mi2s_rx_switch_mixer_controls),
	SND_SOC_DAPM_SWITCH("QUAT_MI2S_RX_DL_HL", SND_SOC_NOPM, 0, 0,
				&quat_mi2s_rx_switch_mixer_controls),
	SND_SOC_DAPM_SWITCH("HFP_PRI_AUX_UL_HL", SND_SOC_NOPM, 0, 0,
				&hfp_pri_aux_switch_mixer_controls),
	SND_SOC_DAPM_SWITCH("HFP_AUX_UL_HL", SND_SOC_NOPM, 0, 0,
				&hfp_aux_switch_mixer_controls),
	SND_SOC_DAPM_SWITCH("HFP_INT_UL_HL", SND_SOC_NOPM, 0, 0,
@@ -5547,6 +5584,7 @@ static const struct snd_soc_dapm_route intercon[] = {
	{"AUX_PCM_RX Audio Mixer", "MultiMedia14", "MM_DL14"},
	{"AUX_PCM_RX Audio Mixer", "MultiMedia15", "MM_DL15"},
	{"AUX_PCM_RX Audio Mixer", "MultiMedia16", "MM_DL16"},
	{"AUX_PCM_RX Audio Mixer", "MultiMedia6", "MM_UL6"},
	{"AUX_PCM_RX", NULL, "AUX_PCM_RX Audio Mixer"},

	{"SEC_AUX_PCM_RX Audio Mixer", "MultiMedia1", "MM_DL1"},
@@ -5958,6 +5996,8 @@ static const struct snd_soc_dapm_route intercon[] = {

	{"INT_FM_RX", NULL, "INTFM_DL_HL"},
	{"INTFM_UL_HL", NULL, "INT_FM_TX"},
	{"INTHFP_UL_HL", "NULL", "HFP_PRI_AUX_UL_HL"},
	{"HFP_PRI_AUX_UL_HL", "Switch", "AUX_PCM_TX"},
	{"INTHFP_UL_HL", "NULL", "HFP_AUX_UL_HL"},
	{"HFP_AUX_UL_HL", "Switch", "SEC_AUX_PCM_TX"},
	{"INTHFP_UL_HL", "NULL", "HFP_INT_UL_HL"},
+53 −8
Original line number Diff line number Diff line
@@ -81,8 +81,12 @@ static int msm_route_hfp_vol_control;
static const DECLARE_TLV_DB_LINEAR(hfp_rx_vol_gain, 0,
				INT_RX_VOL_MAX_STEPS);

static int msm_route_auxpcm_lb_vol_ctrl;
static const DECLARE_TLV_DB_LINEAR(auxpcm_lb_vol_gain, 0,
static int msm_route_pri_auxpcm_lb_vol_ctrl;
static const DECLARE_TLV_DB_LINEAR(pri_auxpcm_lb_vol_gain, 0,
				INT_RX_VOL_MAX_STEPS);

static int msm_route_sec_auxpcm_lb_vol_ctrl;
static const DECLARE_TLV_DB_LINEAR(sec_auxpcm_lb_vol_gain, 0,
				INT_RX_VOL_MAX_STEPS);

static void msm_qti_pp_send_eq_values_(int eq_idx)
@@ -477,14 +481,42 @@ static int msm_qti_pp_set_hfp_vol_mixer(struct snd_kcontrol *kcontrol,
	return 0;
}

static int msm_qti_pp_get_auxpcm_lb_vol_mixer(struct snd_kcontrol *kcontrol,
static int msm_qti_pp_get_pri_auxpcm_lb_vol_mixer(
					struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	ucontrol->value.integer.value[0] = msm_route_pri_auxpcm_lb_vol_ctrl;
	pr_debug("%s: Volume = %ld\n", __func__,
		ucontrol->value.integer.value[0]);
	return 0;
}

static int msm_qti_pp_set_pri_auxpcm_lb_vol_mixer(
					struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct soc_mixer_control *mc =
	(struct soc_mixer_control *)kcontrol->private_value;

	afe_loopback_gain(mc->reg, ucontrol->value.integer.value[0]);

	msm_route_pri_auxpcm_lb_vol_ctrl = ucontrol->value.integer.value[0];

	return 0;
}

static int msm_qti_pp_get_sec_auxpcm_lb_vol_mixer(
					struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	ucontrol->value.integer.value[0] = msm_route_auxpcm_lb_vol_ctrl;
	ucontrol->value.integer.value[0] = msm_route_sec_auxpcm_lb_vol_ctrl;
	pr_debug("%s: Volume = %ld\n", __func__,
		ucontrol->value.integer.value[0]);
	return 0;
}

static int msm_qti_pp_set_auxpcm_lb_vol_mixer(struct snd_kcontrol *kcontrol,
static int msm_qti_pp_set_sec_auxpcm_lb_vol_mixer(
					struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct soc_mixer_control *mc =
@@ -492,7 +524,7 @@ static int msm_qti_pp_set_auxpcm_lb_vol_mixer(struct snd_kcontrol *kcontrol,

	afe_loopback_gain(mc->reg, ucontrol->value.integer.value[0]);

	msm_route_auxpcm_lb_vol_ctrl = ucontrol->value.integer.value[0];
	msm_route_sec_auxpcm_lb_vol_ctrl = ucontrol->value.integer.value[0];

	return 0;
}
@@ -716,11 +748,20 @@ static const struct snd_kcontrol_new int_hfp_vol_mixer_controls[] = {
	msm_qti_pp_set_hfp_vol_mixer, hfp_rx_vol_gain),
};

static const struct snd_kcontrol_new pri_auxpcm_lb_vol_mixer_controls[] = {
	SOC_SINGLE_EXT_TLV("PRI AUXPCM LOOPBACK Volume",
	AFE_PORT_ID_PRIMARY_PCM_TX, 0, INT_RX_VOL_GAIN, 0,
	msm_qti_pp_get_pri_auxpcm_lb_vol_mixer,
	msm_qti_pp_set_pri_auxpcm_lb_vol_mixer,
	pri_auxpcm_lb_vol_gain),
};

static const struct snd_kcontrol_new sec_auxpcm_lb_vol_mixer_controls[] = {
	SOC_SINGLE_EXT_TLV("SEC AUXPCM LOOPBACK Volume",
	AFE_PORT_ID_SECONDARY_PCM_TX, 0, INT_RX_VOL_GAIN, 0,
	msm_qti_pp_get_auxpcm_lb_vol_mixer, msm_qti_pp_set_auxpcm_lb_vol_mixer,
	auxpcm_lb_vol_gain),
	msm_qti_pp_get_sec_auxpcm_lb_vol_mixer,
	msm_qti_pp_set_sec_auxpcm_lb_vol_mixer,
	sec_auxpcm_lb_vol_gain),
};

static const struct snd_kcontrol_new multi_ch_channel_map_mixer_controls[] = {
@@ -892,6 +933,10 @@ void msm_qti_pp_add_controls(struct snd_soc_platform *platform)
	snd_soc_add_platform_controls(platform, int_hfp_vol_mixer_controls,
			ARRAY_SIZE(int_hfp_vol_mixer_controls));

	snd_soc_add_platform_controls(platform,
			pri_auxpcm_lb_vol_mixer_controls,
			ARRAY_SIZE(pri_auxpcm_lb_vol_mixer_controls));

	snd_soc_add_platform_controls(platform,
				sec_auxpcm_lb_vol_mixer_controls,
			ARRAY_SIZE(sec_auxpcm_lb_vol_mixer_controls));