From 1120a5768f3877c44debe41e0015d653ff56eddf Mon Sep 17 00:00:00 2001 From: Jonathan Hunter Date: Thu, 8 Nov 2018 09:32:47 +0000 Subject: [PATCH] ASoC: tegra-alt: Reading Mixer RX Gain always returns 0 Reading the mixer RX Gain always returns 0 and this is because the function to return the gain setting has not been implemented completely. Fix this by returning the programmed gain value in the function tegra210_mixer_get_format(). Bug 2438553 Change-Id: I4e6e5a6fe3373982cbb063ce3276428e0a1a2c1a Signed-off-by: Jonathan Hunter Reviewed-on: https://git-master.nvidia.com/r/1945622 GVS: Gerrit_Virtual_Submit Reviewed-by: Sameer Pujar Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- sound/soc/tegra-alt/tegra210_mixer_alt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/tegra-alt/tegra210_mixer_alt.c b/sound/soc/tegra-alt/tegra210_mixer_alt.c index be9069a5..7541a8bb 100644 --- a/sound/soc/tegra-alt/tegra210_mixer_alt.c +++ b/sound/soc/tegra-alt/tegra210_mixer_alt.c @@ -181,6 +181,17 @@ static int tegra210_mixer_get_format(struct snd_kcontrol *kcontrol, static int tegra210_mixer_get_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; + struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); + struct tegra210_mixer *mixer = snd_soc_codec_get_drvdata(codec); + unsigned int reg = mc->reg; + unsigned int i; + + i = (reg - TEGRA210_MIXER_AHUBRAMCTL_GAIN_CONFIG_RAM_ADDR_0) / + TEGRA210_MIXER_AHUBRAMCTL_GAIN_CONFIG_RAM_ADDR_STRIDE; + ucontrol->value.integer.value[0] = mixer->gain_value[i]; + return 0; }