ASoC: uda134x: correct bias level setup for codecs family
authorVladimir Zapolskiy <vzapolskiy@gmail.com>
Thu, 24 Jun 2010 13:19:25 +0000 (17:19 +0400)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 30 Jun 2010 13:46:56 +0000 (14:46 +0100)
For UDA1341 codec power control is managed in STATUS1 register, and
for all other codecs in DATA011 register.

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/uda134x.c

index 7552ea2c2fc7fbce1de7d9d59f5e20009456bf5f..f3b4c1d6a82d1927975d80c303a62d38448bb238 100644 (file)
@@ -341,8 +341,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec,
        switch (level) {
        case SND_SOC_BIAS_ON:
                /* ADC, DAC on */
-               reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
-               uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
+               switch (pd->model) {
+               case UDA134X_UDA1340:
+               case UDA134X_UDA1344:
+               case UDA134X_UDA1345:
+                       reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
+                       uda134x_write(codec, UDA134X_DATA011, reg | 0x03);
+                       break;
+               case UDA134X_UDA1341:
+                       reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
+                       uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
+                       break;
+               default:
+                       printk(KERN_ERR "UDA134X SoC codec: "
+                              "unsupported model %d\n", pd->model);
+                       return -EINVAL;
+               }
                break;
        case SND_SOC_BIAS_PREPARE:
                /* power on */
@@ -355,8 +369,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec,
                break;
        case SND_SOC_BIAS_STANDBY:
                /* ADC, DAC power off */
-               reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
-               uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
+               switch (pd->model) {
+               case UDA134X_UDA1340:
+               case UDA134X_UDA1344:
+               case UDA134X_UDA1345:
+                       reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
+                       uda134x_write(codec, UDA134X_DATA011, reg & ~(0x03));
+                       break;
+               case UDA134X_UDA1341:
+                       reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
+                       uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
+                       break;
+               default:
+                       printk(KERN_ERR "UDA134X SoC codec: "
+                              "unsupported model %d\n", pd->model);
+                       return -EINVAL;
+               }
                break;
        case SND_SOC_BIAS_OFF:
                /* power off */