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

Commit 935421af authored by Banajit Goswami's avatar Banajit Goswami Committed by Jeevan Shriram
Browse files

ASoC: msm: qdsp6v2: add loopback volume control for SLIMBUS_8_TX



Add a new mixer control for volume control for SLIMBUS_8_TX AFE port
loopback.

Change-Id: Ifbf1778255edbe4901bd0860216ba1dd5a786047
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
parent f000cc25
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -395,6 +395,7 @@ static int msm_afe_lb_vol_ctrl;
static int msm_afe_sec_mi2s_lb_vol_ctrl;
static int msm_afe_tert_mi2s_lb_vol_ctrl;
static int msm_afe_quat_mi2s_lb_vol_ctrl;
static int msm_afe_slimbus_8_lb_vol_ctrl;
static const DECLARE_TLV_DB_LINEAR(fm_rx_vol_gain, 0, INT_RX_VOL_MAX_STEPS);
static const DECLARE_TLV_DB_LINEAR(afe_lb_vol_gain, 0, INT_RX_VOL_MAX_STEPS);

@@ -466,6 +467,30 @@ static int msm_qti_pp_set_tert_mi2s_lb_vol_mixer(struct snd_kcontrol *kcontrol,
	return 0;
}

static int msm_qti_pp_get_slimbus_8_lb_vol_mixer(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_value *ucontrol)
{
	ucontrol->value.integer.value[0] = msm_afe_slimbus_8_lb_vol_ctrl;
	return 0;
}

static int msm_qti_pp_set_slimbus_8_lb_vol_mixer(struct snd_kcontrol *kcontrol,
			    struct snd_ctl_elem_value *ucontrol)
{
	int ret = 0;

	ret = afe_loopback_gain(SLIMBUS_8_TX,
				ucontrol->value.integer.value[0]);

	if (ret)
		pr_err("%s: failed to set LB vol for SLIMBUS_8_TX", __func__);
	else
		msm_afe_slimbus_8_lb_vol_ctrl =
				ucontrol->value.integer.value[0];

	return ret;
}

static int msm_qti_pp_get_quat_mi2s_fm_vol_mixer(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_value *ucontrol)
{
@@ -768,6 +793,12 @@ static const struct snd_kcontrol_new tert_mi2s_lb_vol_mixer_controls[] = {
	msm_qti_pp_set_tert_mi2s_lb_vol_mixer, afe_lb_vol_gain),
};

static const struct snd_kcontrol_new slimbus_8_lb_vol_mixer_controls[] = {
	SOC_SINGLE_EXT_TLV("SLIMBUS_8 LOOPBACK Volume", SND_SOC_NOPM, 0,
	INT_RX_VOL_GAIN, 0, msm_qti_pp_get_slimbus_8_lb_vol_mixer,
	msm_qti_pp_set_slimbus_8_lb_vol_mixer, afe_lb_vol_gain),
};

static const struct snd_kcontrol_new int_hfp_vol_mixer_controls[] = {
	SOC_SINGLE_EXT_TLV("Internal HFP RX Volume", SND_SOC_NOPM, 0,
	INT_RX_VOL_GAIN, 0, msm_qti_pp_get_hfp_vol_mixer,
@@ -959,6 +990,9 @@ void msm_qti_pp_add_controls(struct snd_soc_platform *platform)
	snd_soc_add_platform_controls(platform, tert_mi2s_lb_vol_mixer_controls,
			ARRAY_SIZE(tert_mi2s_lb_vol_mixer_controls));

	snd_soc_add_platform_controls(platform, slimbus_8_lb_vol_mixer_controls,
			ARRAY_SIZE(slimbus_8_lb_vol_mixer_controls));

	snd_soc_add_platform_controls(platform, int_hfp_vol_mixer_controls,
			ARRAY_SIZE(int_hfp_vol_mixer_controls));