Commit 63ddcd7b authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/wm8985' into asoc-next

parents 555df91a 5f3d25c0
...@@ -830,33 +830,30 @@ static int wm8985_set_pll(struct snd_soc_dai *dai, int pll_id, ...@@ -830,33 +830,30 @@ static int wm8985_set_pll(struct snd_soc_dai *dai, int pll_id,
struct pll_div pll_div; struct pll_div pll_div;
codec = dai->codec; codec = dai->codec;
if (freq_in && freq_out) { if (!freq_in || !freq_out) {
/* disable the PLL */
snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
WM8985_PLLEN_MASK, 0);
} else {
ret = pll_factors(&pll_div, freq_out * 4 * 2, freq_in); ret = pll_factors(&pll_div, freq_out * 4 * 2, freq_in);
if (ret) if (ret)
return ret; return ret;
}
/* disable the PLL before reprogramming it */ /* set PLLN and PRESCALE */
snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1, snd_soc_write(codec, WM8985_PLL_N,
WM8985_PLLEN_MASK, 0); (pll_div.div2 << WM8985_PLL_PRESCALE_SHIFT)
| pll_div.n);
if (!freq_in || !freq_out) /* set PLLK */
return 0; snd_soc_write(codec, WM8985_PLL_K_3, pll_div.k & 0x1ff);
snd_soc_write(codec, WM8985_PLL_K_2, (pll_div.k >> 9) & 0x1ff);
/* set PLLN and PRESCALE */ snd_soc_write(codec, WM8985_PLL_K_1, (pll_div.k >> 18));
snd_soc_write(codec, WM8985_PLL_N, /* set the source of the clock to be the PLL */
(pll_div.div2 << WM8985_PLL_PRESCALE_SHIFT) snd_soc_update_bits(codec, WM8985_CLOCK_GEN_CONTROL,
| pll_div.n); WM8985_CLKSEL_MASK, WM8985_CLKSEL);
/* set PLLK */ /* enable the PLL */
snd_soc_write(codec, WM8985_PLL_K_3, pll_div.k & 0x1ff); snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
snd_soc_write(codec, WM8985_PLL_K_2, (pll_div.k >> 9) & 0x1ff); WM8985_PLLEN_MASK, WM8985_PLLEN);
snd_soc_write(codec, WM8985_PLL_K_1, (pll_div.k >> 18)); }
/* set the source of the clock to be the PLL */
snd_soc_update_bits(codec, WM8985_CLOCK_GEN_CONTROL,
WM8985_CLKSEL_MASK, WM8985_CLKSEL);
/* enable the PLL */
snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
WM8985_PLLEN_MASK, WM8985_PLLEN);
return 0; return 0;
} }
......
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