OSDN Git Service

Merge remote-tracking branches 'asoc/topic/suspend', 'asoc/topic/tas2552', 'asoc...
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / sound / soc / codecs / tlv320aic3x.c
index f2c416d..f7c2a57 100644 (file)
@@ -1121,6 +1121,7 @@ static int aic3x_regulator_event(struct notifier_block *nb,
 static int aic3x_set_power(struct snd_soc_codec *codec, int power)
 {
        struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
+       unsigned int pll_c, pll_d;
        int ret;
 
        if (power) {
@@ -1138,6 +1139,18 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power)
                /* Sync reg_cache with the hardware */
                regcache_cache_only(aic3x->regmap, false);
                regcache_sync(aic3x->regmap);
+
+               /* Rewrite paired PLL D registers in case cached sync skipped
+                * writing one of them and thus caused other one also not
+                * being written
+                */
+               pll_c = snd_soc_read(codec, AIC3X_PLL_PROGC_REG);
+               pll_d = snd_soc_read(codec, AIC3X_PLL_PROGD_REG);
+               if (pll_c == aic3x_reg[AIC3X_PLL_PROGC_REG].def ||
+                       pll_d == aic3x_reg[AIC3X_PLL_PROGD_REG].def) {
+                       snd_soc_write(codec, AIC3X_PLL_PROGC_REG, pll_c);
+                       snd_soc_write(codec, AIC3X_PLL_PROGD_REG, pll_d);
+               }
        } else {
                /*
                 * Do soft reset to this codec instance in order to clear