Commit 86027ae7 authored by Jonas Andersson's avatar Jonas Andersson Committed by Mark Brown

ASoC: wm8510 pll settings

When setting WM8510_MCLKDIV the pll was turned off.

When setting pll frequency you got twice the expected freq, because
the  code calculated  with postscaler of 8,  but  the hardware divide by 4.
Signed-off-by: default avatarJonas Andersson <jonas@microbit.se>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent ec67624d
...@@ -164,38 +164,38 @@ static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream, ...@@ -164,38 +164,38 @@ static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream,
*/ */
switch (params_rate(params)) { switch (params_rate(params)) {
case 48000: case 48000:
pll_out = 12288000; pll_out = 24576000;
mclk_div = WM8510_MCLKDIV_1; mclk_div = WM8510_MCLKDIV_2;
bclk = WM8510_BCLKDIV_8; bclk = WM8510_BCLKDIV_8;
break; break;
case 44100: case 44100:
pll_out = 11289600; pll_out = 22579200;
mclk_div = WM8510_MCLKDIV_1; mclk_div = WM8510_MCLKDIV_2;
bclk = WM8510_BCLKDIV_8; bclk = WM8510_BCLKDIV_8;
break; break;
case 22050: case 22050:
pll_out = 11289600; pll_out = 22579200;
mclk_div = WM8510_MCLKDIV_2; mclk_div = WM8510_MCLKDIV_4;
bclk = WM8510_BCLKDIV_8; bclk = WM8510_BCLKDIV_8;
break; break;
case 16000: case 16000:
pll_out = 12288000; pll_out = 24576000;
mclk_div = WM8510_MCLKDIV_3; mclk_div = WM8510_MCLKDIV_6;
bclk = WM8510_BCLKDIV_8; bclk = WM8510_BCLKDIV_8;
break; break;
case 11025: case 11025:
pll_out = 11289600; pll_out = 22579200;
mclk_div = WM8510_MCLKDIV_4; mclk_div = WM8510_MCLKDIV_8;
bclk = WM8510_BCLKDIV_8; bclk = WM8510_BCLKDIV_8;
break; break;
case 8000: case 8000:
pll_out = 12288000; pll_out = 24576000;
mclk_div = WM8510_MCLKDIV_6; mclk_div = WM8510_MCLKDIV_12;
bclk = WM8510_BCLKDIV_8; bclk = WM8510_BCLKDIV_8;
break; break;
......
...@@ -336,7 +336,7 @@ static int wm8510_set_dai_pll(struct snd_soc_dai *codec_dai, ...@@ -336,7 +336,7 @@ static int wm8510_set_dai_pll(struct snd_soc_dai *codec_dai,
return 0; return 0;
} }
pll_factors(freq_out*8, freq_in); pll_factors(freq_out*4, freq_in);
wm8510_write(codec, WM8510_PLLN, (pll_div.pre_div << 4) | pll_div.n); wm8510_write(codec, WM8510_PLLN, (pll_div.pre_div << 4) | pll_div.n);
wm8510_write(codec, WM8510_PLLK1, pll_div.k >> 18); wm8510_write(codec, WM8510_PLLK1, pll_div.k >> 18);
...@@ -367,7 +367,7 @@ static int wm8510_set_dai_clkdiv(struct snd_soc_dai *codec_dai, ...@@ -367,7 +367,7 @@ static int wm8510_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
wm8510_write(codec, WM8510_GPIO, reg | div); wm8510_write(codec, WM8510_GPIO, reg | div);
break; break;
case WM8510_MCLKDIV: case WM8510_MCLKDIV:
reg = wm8510_read_reg_cache(codec, WM8510_CLOCK) & 0x1f; reg = wm8510_read_reg_cache(codec, WM8510_CLOCK) & 0x11f;
wm8510_write(codec, WM8510_CLOCK, reg | div); wm8510_write(codec, WM8510_CLOCK, reg | div);
break; break;
case WM8510_ADCCLK: case WM8510_ADCCLK:
......
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