ASoC: twl6040: Prepare for core put_volsw/volsw_2r merger
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Wed, 5 Oct 2011 07:29:21 +0000 (10:29 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 5 Oct 2011 16:10:09 +0000 (17:10 +0100)
Avoid using the mc->rreg to identify the 2r type of gain control.
Introduce a variable to track this.
This change is needed to avoid breakage with the upcoming volsw volsw_2r
merger.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/twl6040.c

index 4ad04e3d5c4027314dc37ee292d1ee34e04c7c12..c9a601d43ca207637bcac98135b995b0021885b5 100644 (file)
@@ -746,7 +746,7 @@ static int twl6040_put_volsw(struct snd_kcontrol *kcontrol,
        struct twl6040_output *out = NULL;
        struct soc_mixer_control *mc =
                (struct soc_mixer_control *)kcontrol->private_value;
-       int ret;
+       int ret, type_2r;
 
        /* For HS and HF we shadow the values and only actually write
         * them out when active in order to ensure the amplifier comes on
@@ -754,9 +754,11 @@ static int twl6040_put_volsw(struct snd_kcontrol *kcontrol,
        switch (mc->reg) {
        case TWL6040_REG_HSGAIN:
                out = &twl6040_priv->headset;
+               type_2r = 0;
                break;
        case TWL6040_REG_HFLGAIN:
                out = &twl6040_priv->handsfree;
+               type_2r = 1;
                break;
        default:
                return -EINVAL;
@@ -768,7 +770,7 @@ static int twl6040_put_volsw(struct snd_kcontrol *kcontrol,
                return 1;
 
        /* call the appropriate handler depending on the rreg */
-       if (mc->rreg)
+       if (type_2r)
                ret = snd_soc_put_volsw_2r(kcontrol, ucontrol);
        else
                ret = snd_soc_put_volsw(kcontrol, ucontrol);