aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2012-12-11 22:24:40 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-24 10:55:40 -0500
commit6757d8cc0c6ff2e61972d84797d358a2f69f2217 (patch)
treeb487bff990207e374f37b8398b34cdf541771de5 /sound
parenta49f0d1ea3ec94fc7cf33a7c36a16343b74bd565 (diff)
ASoC: wm8993: Refactor set_pll code to avoid GCC warnings
Refactor set_pll code to avoid the following warnings: sound/soc/codecs/wm8983.c:873:40: warning: 'pll_div.k' may be used uninitialized in this function [-Wuninitialized] sound/soc/codecs/wm8983.c:870:9: warning: 'pll_div.n' may be used uninitialized in this function [-Wuninitialized] sound/soc/codecs/wm8983.c:869:23: warning: 'pll_div.div2' may be used uninitialized in this function [-Wuninitialized] Do the same as in commit 86ce6c9a (ASoC: WM8804: Refactor set_pll code to avoid GCC warnings). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm8983.c41
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