aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Yao <yao.jin@linux.intel.com>2015-03-09 21:05:38 -0400
committerMark Brown <broonie@kernel.org>2015-03-10 16:40:51 -0400
commit8d0c38a3f2a6bb70e952f127ed817fc7a08db52c (patch)
tree3200cc2fa97c70ef6c6d1a3a43f67c7b2c4a53ca
parent1a5ab21c2e0f3d6b25ee9f7ca3429fac57027f76 (diff)
ASoC: Intel: move sysclk source setting to platform_clock_control for balance.
A playback noise happens after suspend/resume on Braswell. The issue is due to the codec PLL and codec ASRC are not enabled correctly due to the incorrect sysclk setting after resume. This patch resets the sysclk source setting in platform clock control widget handler. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Jin Yao <yao.jin@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/cht_bsw_rt5672.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c
index bc8dcacd5e6a..279df4c43de1 100644
--- a/sound/soc/intel/cht_bsw_rt5672.c
+++ b/sound/soc/intel/cht_bsw_rt5672.c
@@ -50,6 +50,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
50 struct snd_soc_dapm_context *dapm = w->dapm; 50 struct snd_soc_dapm_context *dapm = w->dapm;
51 struct snd_soc_card *card = dapm->card; 51 struct snd_soc_card *card = dapm->card;
52 struct snd_soc_dai *codec_dai; 52 struct snd_soc_dai *codec_dai;
53 int ret;
53 54
54 codec_dai = cht_get_codec_dai(card); 55 codec_dai = cht_get_codec_dai(card);
55 if (!codec_dai) { 56 if (!codec_dai) {
@@ -57,17 +58,31 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
57 return -EIO; 58 return -EIO;
58 } 59 }
59 60
60 if (!SND_SOC_DAPM_EVENT_OFF(event)) 61 if (SND_SOC_DAPM_EVENT_ON(event)) {
61 return 0; 62 /* set codec PLL source to the 19.2MHz platform clock (MCLK) */
62 63 ret = snd_soc_dai_set_pll(codec_dai, 0, RT5670_PLL1_S_MCLK,
63 /* Set codec sysclk source to its internal clock because codec PLL will 64 CHT_PLAT_CLK_3_HZ, 48000 * 512);
64 * be off when idle and MCLK will also be off by ACPI when codec is 65 if (ret < 0) {
65 * runtime suspended. Codec needs clock for jack detection and button 66 dev_err(card->dev, "can't set codec pll: %d\n", ret);
66 * press. 67 return ret;
67 */ 68 }
68 snd_soc_dai_set_sysclk(codec_dai, RT5670_SCLK_S_RCCLK, 69
69 0, SND_SOC_CLOCK_IN); 70 /* set codec sysclk source to PLL */
70 71 ret = snd_soc_dai_set_sysclk(codec_dai, RT5670_SCLK_S_PLL1,
72 48000 * 512, SND_SOC_CLOCK_IN);
73 if (ret < 0) {
74 dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
75 return ret;
76 }
77 } else {
78 /* Set codec sysclk source to its internal clock because codec
79 * PLL will be off when idle and MCLK will also be off by ACPI
80 * when codec is runtime suspended. Codec needs clock for jack
81 * detection and button press.
82 */
83 snd_soc_dai_set_sysclk(codec_dai, RT5670_SCLK_S_RCCLK,
84 48000 * 512, SND_SOC_CLOCK_IN);
85 }
71 return 0; 86 return 0;
72} 87}
73 88
@@ -77,7 +92,8 @@ static const struct snd_soc_dapm_widget cht_dapm_widgets[] = {
77 SND_SOC_DAPM_MIC("Int Mic", NULL), 92 SND_SOC_DAPM_MIC("Int Mic", NULL),
78 SND_SOC_DAPM_SPK("Ext Spk", NULL), 93 SND_SOC_DAPM_SPK("Ext Spk", NULL),
79 SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, 94 SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
80 platform_clock_control, SND_SOC_DAPM_POST_PMD), 95 platform_clock_control, SND_SOC_DAPM_PRE_PMU |
96 SND_SOC_DAPM_POST_PMD),
81}; 97};
82 98
83static const struct snd_soc_dapm_route cht_audio_map[] = { 99static const struct snd_soc_dapm_route cht_audio_map[] = {