tegra-alt: mixer: add control for instant volume
Viraj Karandikar [Wed, 6 May 2015 09:14:16 +0000 (14:14 +0530)]
Add control for setting volume instantly without ramp.

Bug 1626776

Change-Id: Ief8c31ce5c537381496e85b585020291d1e1b470
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/739519
(cherry picked from commit f4b25e4114839ddded939cf838ca00902f05c23a)
Reviewed-on: http://git-master/r/740611
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>

sound/soc/tegra-alt/tegra210_mixer_alt.c

index a66eccd..e26053d 100644 (file)
@@ -161,9 +161,19 @@ static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol,
 
        pm_runtime_get_sync(codec->dev);
        /* write default gain config poly coefficients */
-       for (i = 0; i < 14; i++)
+       for (i = 0; i < 10; i++)
                tegra210_mixer_write_ram(mixer, reg + i, mixer->gain_coeff[i]);
 
+       /* set duration parameter */
+       if (strstr(kcontrol->id.name, "Instant")) {
+               for (; i < 14; i++)
+                       tegra210_mixer_write_ram(mixer, reg + i, 1);
+       } else {
+               for (; i < 14; i++)
+                       tegra210_mixer_write_ram(mixer, reg + i,
+                               mixer->gain_coeff[i]);
+       }
+
        /* write new gain and trigger config */
        ret = tegra210_mixer_write_ram(mixer, reg + 0x09,
                                ucontrol->value.integer.value[0]);
@@ -376,6 +386,26 @@ static const struct snd_kcontrol_new tegra210_mixer_gain_ctls[] = {        \
                tegra210_mixer_get_gain, tegra210_mixer_put_gain),
        SOC_SINGLE_EXT("RX10 Gain", MIXER_GAIN_CONFIG_RAM_ADDR(9), 0, 0x20000, 0,
                tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX1 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(0), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX2 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(1), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX3 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(2), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX4 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(3), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX5 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(4), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX6 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(5), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX7 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(6), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX8 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(7), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX9 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(8), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
+       SOC_SINGLE_EXT("RX10 Gain Instant", MIXER_GAIN_CONFIG_RAM_ADDR(9), 0,
+               0x20000, 0, tegra210_mixer_get_gain, tegra210_mixer_put_gain),
        SOC_SINGLE("Mixer Enable", TEGRA210_MIXER_ENABLE, 0, 1, 0),
 };