aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-12-04 04:22:16 -0500
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:47:37 -0400
commitaf2f333bccd2923b9f155a38e3b2b51afde0393a (patch)
treeb8efd279bff85240a1ab4efcd7a9b99dea9342f8 /sound/soc/codecs
parent6773514a979fb27e0c2241a086dcae4c053a51c4 (diff)
ASoC: wm8962: Enable SYSCLK provisonally before fetching generated DSPCLK_DIV
DSPCLK_DIV can be only generated correctly after enabling SYSCLK. But if the current bias_level hasn't reached SND_SOC_BIAS_ON, DAPM won't enable SYSCLK, which would cause the calculation result from DSPCLK_DIV invalid since bit DSPCLK_DIV will be finally turned to its true value after DAPM enables SYSCLK while the driver won't calculate it again for the current instance. In this circumstance, a playback which needs non-zero DSPCLK_DIV would be distorted due to unexpected clock frequency resulted from an invalid DSPCLK_DIV value. So this patch provisionally enables the SYSCLK to get a valid DSPCLK_DIV for calculation and then disables it afterward. Signed-off-by: Nicolin Chen <b42378@freescale.com> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org> (cherry picked from commit 75704ecfbb4124139b78b71dd603f05d61abe689)
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/wm8962.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index ffff0bed0cf3..138d3c9c52ff 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2432,7 +2432,20 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec)
2432 snd_soc_update_bits(codec, WM8962_CLOCKING_4, 2432 snd_soc_update_bits(codec, WM8962_CLOCKING_4,
2433 WM8962_SYSCLK_RATE_MASK, clocking4); 2433 WM8962_SYSCLK_RATE_MASK, clocking4);
2434 2434
2435 /* DSPCLK_DIV can be only generated correctly after enabling SYSCLK.
2436 * So we here provisionally enable it and then disable it afterward
2437 * if current bias_level hasn't reached SND_SOC_BIAS_ON.
2438 */
2439 if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
2440 snd_soc_update_bits(codec, WM8962_CLOCKING2,
2441 WM8962_SYSCLK_ENA_MASK, WM8962_SYSCLK_ENA);
2442
2435 dspclk = snd_soc_read(codec, WM8962_CLOCKING1); 2443 dspclk = snd_soc_read(codec, WM8962_CLOCKING1);
2444
2445 if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
2446 snd_soc_update_bits(codec, WM8962_CLOCKING2,
2447 WM8962_SYSCLK_ENA_MASK, 0);
2448
2436 if (dspclk < 0) { 2449 if (dspclk < 0) {
2437 dev_err(codec->dev, "Failed to read DSPCLK: %d\n", dspclk); 2450 dev_err(codec->dev, "Failed to read DSPCLK: %d\n", dspclk);
2438 return; 2451 return;