ASoC: sgtl5000: Use specific variable for lo_vag
authorAlexander Stein <alexander.stein@systec-electronic.com>
Thu, 16 Apr 2015 12:51:56 +0000 (14:51 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 27 Apr 2015 14:42:20 +0000 (15:42 +0100)
This is a preparation for calculating lo_vol which needs both vag
and lo_vag.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/sgtl5000.c

index 3593a1496056d2aa7648142c67bd7952d5b589f6..bab2b5e5b3121d3c6fe3e6327181a6f769583af2 100644 (file)
@@ -1111,6 +1111,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
        u16 ana_pwr;
        u16 lreg_ctrl;
        int vag;
+       int lo_vag;
        struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
 
        vdda  = regulator_get_voltage(sgtl5000->supplies[VDDA].consumer);
@@ -1198,20 +1199,20 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
                        SGTL5000_ANA_GND_MASK, vag << SGTL5000_ANA_GND_SHIFT);
 
        /* set line out VAG to vddio / 2, in range (0.8v, 1.675v) */
-       vag = vddio / 2;
-       if (vag <= SGTL5000_LINE_OUT_GND_BASE)
-               vag = 0;
-       else if (vag >= SGTL5000_LINE_OUT_GND_BASE +
+       lo_vag = vddio / 2;
+       if (lo_vag <= SGTL5000_LINE_OUT_GND_BASE)
+               lo_vag = 0;
+       else if (lo_vag >= SGTL5000_LINE_OUT_GND_BASE +
                SGTL5000_LINE_OUT_GND_STP * SGTL5000_LINE_OUT_GND_MAX)
-               vag = SGTL5000_LINE_OUT_GND_MAX;
+               lo_vag = SGTL5000_LINE_OUT_GND_MAX;
        else
-               vag = (vag - SGTL5000_LINE_OUT_GND_BASE) /
+               lo_vag = (lo_vag - SGTL5000_LINE_OUT_GND_BASE) /
                    SGTL5000_LINE_OUT_GND_STP;
 
        snd_soc_update_bits(codec, SGTL5000_CHIP_LINE_OUT_CTRL,
                        SGTL5000_LINE_OUT_CURRENT_MASK |
                        SGTL5000_LINE_OUT_GND_MASK,
-                       vag << SGTL5000_LINE_OUT_GND_SHIFT |
+                       lo_vag << SGTL5000_LINE_OUT_GND_SHIFT |
                        SGTL5000_LINE_OUT_CURRENT_360u <<
                                SGTL5000_LINE_OUT_CURRENT_SHIFT);