Commit 6bb74514 authored by Stuart Henderson's avatar Stuart Henderson Committed by Mark Brown

ASoC: wm8960: Fix WM8960_SYSCLK_PLL mode

With the introduction of WM8960_SYSCLK_AUTO mode, WM8960_SYSCLK_PLL mode was
made unusable.  Ensure we're not PLL mode before trying to use MCLK.

Fixes: 3176bf2d ("ASoC: wm8960: update pll and clock setting function")
Signed-off-by: default avatarStuart Henderson <stuart.henderson@cirrus.com>
Reviewed-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 95826a37
...@@ -631,20 +631,21 @@ static int wm8960_configure_clocking(struct snd_soc_codec *codec) ...@@ -631,20 +631,21 @@ static int wm8960_configure_clocking(struct snd_soc_codec *codec)
return -EINVAL; return -EINVAL;
} }
if (wm8960->clk_id != WM8960_SYSCLK_PLL) {
/* check if the sysclk frequency is available. */ /* check if the sysclk frequency is available. */
for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) {
if (sysclk_divs[i] == -1) if (sysclk_divs[i] == -1)
continue; continue;
sysclk = freq_out / sysclk_divs[i]; sysclk = freq_out / sysclk_divs[i];
for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) {
if (sysclk == dac_divs[j] * lrclk) { if (sysclk != dac_divs[j] * lrclk)
continue;
for (k = 0; k < ARRAY_SIZE(bclk_divs); ++k) for (k = 0; k < ARRAY_SIZE(bclk_divs); ++k)
if (sysclk == bclk * bclk_divs[k] / 10) if (sysclk == bclk * bclk_divs[k] / 10)
break; break;
if (k != ARRAY_SIZE(bclk_divs)) if (k != ARRAY_SIZE(bclk_divs))
break; break;
} }
}
if (j != ARRAY_SIZE(dac_divs)) if (j != ARRAY_SIZE(dac_divs))
break; break;
} }
...@@ -655,6 +656,7 @@ static int wm8960_configure_clocking(struct snd_soc_codec *codec) ...@@ -655,6 +656,7 @@ static int wm8960_configure_clocking(struct snd_soc_codec *codec)
dev_err(codec->dev, "failed to configure clock\n"); dev_err(codec->dev, "failed to configure clock\n");
return -EINVAL; return -EINVAL;
} }
}
/* get a available pll out frequency and set pll */ /* get a available pll out frequency and set pll */
for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) {
if (sysclk_divs[i] == -1) if (sysclk_divs[i] == -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment