jin.lu
1
I set the volume to some number as below, but always get 0 when reading back. Any idea?
root@nvidia:~# amixer sset “RX1 Gain” 1000
Simple mixer control ‘RX1 Gain’,0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 131072
Mono: 1000 [1%]
root@nvidia:~# amixer sget “RX1 Gain”
Simple mixer control ‘RX1 Gain’,0
Capabilities: volume volume-joined
Playback channels: Mono
Capture channels: Mono
Limits: 0 - 131072
Mono: 0 [0%]
Hello!
Reading the gain setting does not appear to be implemented, looking at the driver I see …
static int tegra210_mixer_get_gain(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
return 0;
}
To fix this you can make the following change …
diff --git a/sound/soc/tegra-alt/tegra210_mixer_alt.c b/sound/soc/tegra-alt/tegra210_mixer_alt.c
index 4c65dbc7501e..dcbd8893fdc5 100644
--- a/sound/soc/tegra-alt/tegra210_mixer_alt.c
+++ b/sound/soc/tegra-alt/tegra210_mixer_alt.c
@@ -230,6 +230,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;
}
I will get this fixed in future releases. Thanks for reporting.
Regards,
Jon