ASoC: cs42l52: convert pdata config to regmap_update_bits
authorBrian Austin <brian.austin@cirrus.com>
Fri, 25 Oct 2013 15:01:16 +0000 (10:01 -0500)
committerMark Brown <broonie@linaro.org>
Fri, 25 Oct 2013 15:37:58 +0000 (16:37 +0100)
Moving platform data to bus probe and convert to regmap_update_bits.
This will work nicer when converted to device tree instead of having it
split into multiple probes

Signed-off-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/cs42l52.c

index 8367f3c571ebadcda81bea690542a0c019d019d2..56c5611fa75231faf877f13ef82c2dd0e5216846 100644 (file)
@@ -1117,40 +1117,6 @@ static int cs42l52_probe(struct snd_soc_codec *codec)
        cs42l52->sysclk = CS42L52_DEFAULT_CLK;
        cs42l52->config.format = CS42L52_DEFAULT_FORMAT;
 
-       /* Set Platform MICx CFG */
-       snd_soc_update_bits(codec, CS42L52_MICA_CTL,
-                           CS42L52_MIC_CTL_TYPE_MASK,
-                               cs42l52->pdata.mica_cfg <<
-                               CS42L52_MIC_CTL_TYPE_SHIFT);
-
-       snd_soc_update_bits(codec, CS42L52_MICB_CTL,
-                           CS42L52_MIC_CTL_TYPE_MASK,
-                               cs42l52->pdata.micb_cfg <<
-                               CS42L52_MIC_CTL_TYPE_SHIFT);
-
-       /* if Single Ended, Get Mic_Select */
-       if (cs42l52->pdata.mica_cfg)
-               snd_soc_update_bits(codec, CS42L52_MICA_CTL,
-                                   CS42L52_MIC_CTL_MIC_SEL_MASK,
-                               cs42l52->pdata.mica_sel <<
-                               CS42L52_MIC_CTL_MIC_SEL_SHIFT);
-       if (cs42l52->pdata.micb_cfg)
-               snd_soc_update_bits(codec, CS42L52_MICB_CTL,
-                                   CS42L52_MIC_CTL_MIC_SEL_MASK,
-                               cs42l52->pdata.micb_sel <<
-                               CS42L52_MIC_CTL_MIC_SEL_SHIFT);
-
-       /* Set Platform Charge Pump Freq */
-       snd_soc_update_bits(codec, CS42L52_CHARGE_PUMP,
-                           CS42L52_CHARGE_PUMP_MASK,
-                               cs42l52->pdata.chgfreq <<
-                               CS42L52_CHARGE_PUMP_SHIFT);
-
-       /* Set Platform Bias Level */
-       snd_soc_update_bits(codec, CS42L52_IFACE_CTL2,
-                           CS42L52_IFACE_CTL2_BIAS_LVL,
-                               cs42l52->pdata.micbias_lvl);
-
        return ret;
 }
 
@@ -1257,7 +1223,40 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
                return ret;
        }
 
-       regcache_cache_only(cs42l52->regmap, true);
+       /* Set Platform Data */
+       if (cs42l52->pdata.mica_cfg)
+               regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL,
+                                  CS42L52_MIC_CTL_TYPE_MASK,
+                               cs42l52->pdata.mica_cfg <<
+                               CS42L52_MIC_CTL_TYPE_SHIFT);
+
+       if (cs42l52->pdata.micb_cfg)
+               regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL,
+                                  CS42L52_MIC_CTL_TYPE_MASK,
+                               cs42l52->pdata.micb_cfg <<
+                               CS42L52_MIC_CTL_TYPE_SHIFT);
+
+       if (cs42l52->pdata.mica_sel)
+               regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL,
+                                  CS42L52_MIC_CTL_MIC_SEL_MASK,
+                               cs42l52->pdata.mica_sel <<
+                               CS42L52_MIC_CTL_MIC_SEL_SHIFT);
+       if (cs42l52->pdata.micb_sel)
+               regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL,
+                                  CS42L52_MIC_CTL_MIC_SEL_MASK,
+                               cs42l52->pdata.micb_sel <<
+                               CS42L52_MIC_CTL_MIC_SEL_SHIFT);
+
+       if (cs42l52->pdata.chgfreq)
+               regmap_update_bits(cs42l52->regmap, CS42L52_CHARGE_PUMP,
+                                  CS42L52_CHARGE_PUMP_MASK,
+                               cs42l52->pdata.chgfreq <<
+                               CS42L52_CHARGE_PUMP_SHIFT);
+
+       if (cs42l52->pdata.micbias_lvl)
+               regmap_update_bits(cs42l52->regmap, CS42L52_IFACE_CTL2,
+                                  CS42L52_IFACE_CTL2_BIAS_LVL,
+                               cs42l52->pdata.micbias_lvl);
 
        ret =  snd_soc_register_codec(&i2c_client->dev,
                        &soc_codec_dev_cs42l52, &cs42l52_dai, 1);