ASoC: STA32x: Preserve reserved register bits
authorJohannes Stezenbach <js@sig21.net>
Mon, 11 Jul 2011 15:01:24 +0000 (17:01 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 13 Jul 2011 15:24:32 +0000 (00:24 +0900)
Chip documentation explicitly requires that the reset values
of reserved register bits are left untouched.  It is possible
there are differences between STA326 and STA328 or future
chip revisions in these bits, and clobbering them might
cause malfunction.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/sta32x.c

index 9bf944c..409d89d 100644 (file)
@@ -756,6 +756,22 @@ static int sta32x_probe(struct snd_soc_codec *codec)
        for (i = 0; i < STA32X_REGISTER_COUNT; i++)
                snd_soc_cache_write(codec, i, sta32x_regs[i]);
 
+       /* preserve reset values of reserved register bits */
+       snd_soc_cache_write(codec, STA32X_CONFC,
+                           codec->hw_read(codec, STA32X_CONFC));
+       snd_soc_cache_write(codec, STA32X_CONFE,
+                           codec->hw_read(codec, STA32X_CONFE));
+       snd_soc_cache_write(codec, STA32X_CONFF,
+                           codec->hw_read(codec, STA32X_CONFF));
+       snd_soc_cache_write(codec, STA32X_MMUTE,
+                           codec->hw_read(codec, STA32X_MMUTE));
+       snd_soc_cache_write(codec, STA32X_AUTO1,
+                           codec->hw_read(codec, STA32X_AUTO1));
+       snd_soc_cache_write(codec, STA32X_AUTO3,
+                           codec->hw_read(codec, STA32X_AUTO3));
+       snd_soc_cache_write(codec, STA32X_C3CFG,
+                           codec->hw_read(codec, STA32X_C3CFG));
+
        /* FIXME enable thermal warning adjustment and recovery  */
        snd_soc_update_bits(codec, STA32X_CONFA,
                            STA32X_CONFA_TWAB | STA32X_CONFA_TWRB, 0);