ASoC: TWL4030: Move the twl4030_power_up and _power_down function
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>
Tue, 27 Jan 2009 09:29:43 +0000 (11:29 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 27 Jan 2009 10:43:02 +0000 (10:43 +0000)
Move the twl4030_power_up and twl4030_power_down function
earlier to facilitate the analog bypass implementation.

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

index 8fe059e..f985bef 100644 (file)
@@ -184,6 +184,48 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
 
 }
 
+static void twl4030_power_up(struct snd_soc_codec *codec)
+{
+       u8 anamicl, regmisc1, byte;
+       int i = 0;
+
+       /* set CODECPDZ to turn on codec */
+       twl4030_codec_enable(codec, 1);
+
+       /* initiate offset cancellation */
+       anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL);
+       twl4030_write(codec, TWL4030_REG_ANAMICL,
+               anamicl | TWL4030_CNCL_OFFSET_START);
+
+       /* wait for offset cancellation to complete */
+       do {
+               /* this takes a little while, so don't slam i2c */
+               udelay(2000);
+               twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte,
+                                   TWL4030_REG_ANAMICL);
+       } while ((i++ < 100) &&
+                ((byte & TWL4030_CNCL_OFFSET_START) ==
+                 TWL4030_CNCL_OFFSET_START));
+
+       /* Make sure that the reg_cache has the same value as the HW */
+       twl4030_write_reg_cache(codec, TWL4030_REG_ANAMICL, byte);
+
+       /* anti-pop when changing analog gain */
+       regmisc1 = twl4030_read_reg_cache(codec, TWL4030_REG_MISC_SET_1);
+       twl4030_write(codec, TWL4030_REG_MISC_SET_1,
+               regmisc1 | TWL4030_SMOOTH_ANAVOL_EN);
+
+       /* toggle CODECPDZ as per TRM */
+       twl4030_codec_enable(codec, 0);
+       twl4030_codec_enable(codec, 1);
+}
+
+static void twl4030_power_down(struct snd_soc_codec *codec)
+{
+       /* power down */
+       twl4030_codec_enable(codec, 0);
+}
+
 /* Earpiece */
 static const char *twl4030_earpiece_texts[] =
                {"Off", "DACL1", "DACL2", "DACR1"};
@@ -922,49 +964,6 @@ static int twl4030_add_widgets(struct snd_soc_codec *codec)
        return 0;
 }
 
-static void twl4030_power_up(struct snd_soc_codec *codec)
-{
-       u8 anamicl, regmisc1, byte;
-       int i = 0;
-
-       /* set CODECPDZ to turn on codec */
-       twl4030_codec_enable(codec, 1);
-
-       /* initiate offset cancellation */
-       anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL);
-       twl4030_write(codec, TWL4030_REG_ANAMICL,
-               anamicl | TWL4030_CNCL_OFFSET_START);
-
-
-       /* wait for offset cancellation to complete */
-       do {
-               /* this takes a little while, so don't slam i2c */
-               udelay(2000);
-               twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte,
-                                   TWL4030_REG_ANAMICL);
-       } while ((i++ < 100) &&
-                ((byte & TWL4030_CNCL_OFFSET_START) ==
-                 TWL4030_CNCL_OFFSET_START));
-
-       /* Make sure that the reg_cache has the same value as the HW */
-       twl4030_write_reg_cache(codec, TWL4030_REG_ANAMICL, byte);
-
-       /* anti-pop when changing analog gain */
-       regmisc1 = twl4030_read_reg_cache(codec, TWL4030_REG_MISC_SET_1);
-       twl4030_write(codec, TWL4030_REG_MISC_SET_1,
-               regmisc1 | TWL4030_SMOOTH_ANAVOL_EN);
-
-       /* toggle CODECPDZ as per TRM */
-       twl4030_codec_enable(codec, 0);
-       twl4030_codec_enable(codec, 1);
-}
-
-static void twl4030_power_down(struct snd_soc_codec *codec)
-{
-       /* power down */
-       twl4030_codec_enable(codec, 0);
-}
-
 static int twl4030_set_bias_level(struct snd_soc_codec *codec,
                                  enum snd_soc_bias_level level)
 {