aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOskar Schirmer <oskar@scara.com>2013-08-05 03:36:02 -0400
committerMark Brown <broonie@linaro.org>2013-08-05 12:03:42 -0400
commite06e4c2d530fd4995c41083009647263ccd77d3b (patch)
treef9a823c1ad1b12e386089d9ad1436845486ef0c6
parentcb23e852aabb50f5083fb734c2067220d087d26e (diff)
ASoC: sgtl5000: fix codec clock source transition to avoid clockless moment
Powering down PLL before switching to a mode that does not use it is a bad idea. It would cause the SGTL5000 be without internal clock supply, especially on the I2C interface, which would make subsequent access to it fail. Thus, in case of not using PLL any longer, first set the mode control, then power down PLL. Signed-off-by: Oskar Schirmer <oskar@scara.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/codecs/sgtl5000.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 7c99f3ccb1c6..54ca169ec27e 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -644,16 +644,19 @@ static int sgtl5000_set_clock(struct snd_soc_codec *codec, int frame_rate)
644 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, 644 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
645 SGTL5000_PLL_POWERUP | SGTL5000_VCOAMP_POWERUP, 645 SGTL5000_PLL_POWERUP | SGTL5000_VCOAMP_POWERUP,
646 SGTL5000_PLL_POWERUP | SGTL5000_VCOAMP_POWERUP); 646 SGTL5000_PLL_POWERUP | SGTL5000_VCOAMP_POWERUP);
647
648 /* if using pll, clk_ctrl must be set after pll power up */
649 snd_soc_write(codec, SGTL5000_CHIP_CLK_CTRL, clk_ctl);
647 } else { 650 } else {
651 /* otherwise, clk_ctrl must be set before pll power down */
652 snd_soc_write(codec, SGTL5000_CHIP_CLK_CTRL, clk_ctl);
653
648 /* power down pll */ 654 /* power down pll */
649 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, 655 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
650 SGTL5000_PLL_POWERUP | SGTL5000_VCOAMP_POWERUP, 656 SGTL5000_PLL_POWERUP | SGTL5000_VCOAMP_POWERUP,
651 0); 657 0);
652 } 658 }
653 659
654 /* if using pll, clk_ctrl must be set after pll power up */
655 snd_soc_write(codec, SGTL5000_CHIP_CLK_CTRL, clk_ctl);
656
657 return 0; 660 return 0;
658} 661}
659 662