diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-11 06:06:55 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-11 06:06:55 -0500 |
| commit | 699ba4546cfe3f4eee73aff4f307bf16362f9232 (patch) | |
| tree | 7a0631db5d5591d303a0cfcca270fc83cbdfe8f5 | |
| parent | 63ddcd7ba5245b099531389fdfbac859888b0ce1 (diff) | |
| parent | 6757d8cc0c6ff2e61972d84797d358a2f69f2217 (diff) | |
Merge remote-tracking branch 'asoc/topic/wm8993' into asoc-next
| -rw-r--r-- | sound/soc/codecs/wm8983.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index 9fe1e041da49..c9c707b8698f 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c | |||
| @@ -851,30 +851,33 @@ static int wm8983_set_pll(struct snd_soc_dai *dai, int pll_id, | |||
| 851 | struct pll_div pll_div; | 851 | struct pll_div pll_div; |
| 852 | 852 | ||
| 853 | codec = dai->codec; | 853 | codec = dai->codec; |
| 854 | if (freq_in && freq_out) { | 854 | if (!freq_in || !freq_out) { |
| 855 | /* disable the PLL */ | ||
| 856 | snd_soc_update_bits(codec, WM8983_POWER_MANAGEMENT_1, | ||
| 857 | WM8983_PLLEN_MASK, 0); | ||
| 858 | return 0; | ||
| 859 | } else { | ||
| 855 | ret = pll_factors(&pll_div, freq_out * 4 * 2, freq_in); | 860 | ret = pll_factors(&pll_div, freq_out * 4 * 2, freq_in); |
| 856 | if (ret) | 861 | if (ret) |
| 857 | return ret; | 862 | return ret; |
| 858 | } | ||
| 859 | |||
| 860 | /* disable the PLL before re-programming it */ | ||
| 861 | snd_soc_update_bits(codec, WM8983_POWER_MANAGEMENT_1, | ||
| 862 | WM8983_PLLEN_MASK, 0); | ||
| 863 | 863 | ||
| 864 | if (!freq_in || !freq_out) | 864 | /* disable the PLL before re-programming it */ |
| 865 | return 0; | 865 | snd_soc_update_bits(codec, WM8983_POWER_MANAGEMENT_1, |
| 866 | WM8983_PLLEN_MASK, 0); | ||
| 867 | |||
| 868 | /* set PLLN and PRESCALE */ | ||
| 869 | snd_soc_write(codec, WM8983_PLL_N, | ||
| 870 | (pll_div.div2 << WM8983_PLL_PRESCALE_SHIFT) | ||
| 871 | | pll_div.n); | ||
| 872 | /* set PLLK */ | ||
| 873 | snd_soc_write(codec, WM8983_PLL_K_3, pll_div.k & 0x1ff); | ||
| 874 | snd_soc_write(codec, WM8983_PLL_K_2, (pll_div.k >> 9) & 0x1ff); | ||
| 875 | snd_soc_write(codec, WM8983_PLL_K_1, (pll_div.k >> 18)); | ||
| 876 | /* enable the PLL */ | ||
| 877 | snd_soc_update_bits(codec, WM8983_POWER_MANAGEMENT_1, | ||
| 878 | WM8983_PLLEN_MASK, WM8983_PLLEN); | ||
| 879 | } | ||
| 866 | 880 | ||
| 867 | /* set PLLN and PRESCALE */ | ||
| 868 | snd_soc_write(codec, WM8983_PLL_N, | ||
| 869 | (pll_div.div2 << WM8983_PLL_PRESCALE_SHIFT) | ||
| 870 | | pll_div.n); | ||
| 871 | /* set PLLK */ | ||
| 872 | snd_soc_write(codec, WM8983_PLL_K_3, pll_div.k & 0x1ff); | ||
| 873 | snd_soc_write(codec, WM8983_PLL_K_2, (pll_div.k >> 9) & 0x1ff); | ||
| 874 | snd_soc_write(codec, WM8983_PLL_K_1, (pll_div.k >> 18)); | ||
| 875 | /* enable the PLL */ | ||
| 876 | snd_soc_update_bits(codec, WM8983_POWER_MANAGEMENT_1, | ||
| 877 | WM8983_PLLEN_MASK, WM8983_PLLEN); | ||
| 878 | return 0; | 881 | return 0; |
| 879 | } | 882 | } |
| 880 | 883 | ||
