ASoC: wm8994: Lower AIFnCLK divisor when dropping to 32kHz
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 24 Oct 2012 09:56:30 +0000 (10:56 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 24 Oct 2012 09:58:01 +0000 (10:58 +0100)
When lowering SYSCLK to 50kHz for accessory detection also lower the
AIFnCLK divisor to normalise the clocking configuration within the
device. This will not disrupt audio as we cannot support active audio
with such a low SYSCLK.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8994.c

index 4d0ae9dcbc57711108ed0cddc3ab39bbb94ac80e..1d1b43fe1722205f6939b38b05fc1f537263d9c0 100644 (file)
@@ -2346,6 +2346,18 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
 
        configure_clock(codec);
 
+       /*
+        * If SYSCLK will be less than 50kHz adjust AIFnCLK dividers
+        * for detection.
+        */
+       if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) {
+               dev_dbg(codec->dev, "Configuring AIFs for 128fs\n");
+               snd_soc_update_bits(codec, WM8994_AIF1_RATE,
+                                   WM8994_AIF1CLK_RATE_MASK, 0x1);
+               snd_soc_update_bits(codec, WM8994_AIF2_RATE,
+                                   WM8994_AIF2CLK_RATE_MASK, 0x1);
+       }
+
        return 0;
 }