Skip to contentSkip to conversation

ASoC: rt5677: Reconfigure PLL1 after resume

PATCH In review Ben Zhang 3 participants 5 messages Dec 15, 2015 – Dec 17, 2015

Subsystems (3)
lore
Share & tools
lore

Ben Zhang

author
#0 lore raw

PATCH 1/1 ASoC: rt5677: Reconfigure PLL1 after resume

Sometimes PLL1 stops working if the codec loses power during suspend (when pow-ldo2 or reset gpio is used). MX-7Bh(RT5677_PLL1_CTRL2) is cleared and won't be restored by regcache since it's volatile. MX-7Bh has one status bit and M code for PLL1. rt5677_set_dai_pll doesn't reconfigure PLL1 after resume because it thinks the PLL params are not changed.

This patch clears the cached PLL params at resume so that rt5677_set_dai_pll can reconfigure the PLL after resume.

---
 sound/soc/codecs/rt5677.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/codecs/rt5677.c +3 -0
index f73fd12..c404f51 100644
@@ -4792,6 +4792,9 @@ static int rt5677_resume(struct snd_soc_codec *codec)
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
 	if (!rt5677->dsp_vad_en) {
+		rt5677->pll_src = 0;
+		rt5677->pll_in = 0;
+		rt5677->pll_out = 0;
 		gpiod_set_value_cansleep(rt5677->pow_ldo2, 1);
 		gpiod_set_value_cansleep(rt5677->reset_pin, 0);
 		if (rt5677->pow_ldo2 || rt5677->reset_pin)
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
maintainer
#1 lore raw
Quoted 10 lines · Ben Zhang

Sometimes PLL1 stops working if the codec loses power during suspend (when pow-ldo2 or reset gpio is used). MX-7Bh(RT5677_PLL1_CTRL2) is cleared and won't be restored by regcache since it's volatile. MX-7Bh has one status bit and M code for PLL1. rt5677_set_dai_pll doesn't reconfigure PLL1 after resume because it thinks the PLL params are not changed.

This patch clears the cached PLL params at resume so that rt5677_set_dai_pll can reconfigure the PLL after resume.

This is something I'd expect the machine driver to handle - if it's stopped using the PLL I'd expect it to explicitly turn it off, suspend (or the CODEC going idle for that matter normally, the PLL is burning power) should do that. If anything I'd expect the CODEC driver to restore the current settings.

That said I'll apply this since it at least doesn't make things worse.

#2 lore raw
Quoted 17 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Thursday, December 17, 2015 3:21 AM
To: Ben Zhang
Cc: [email protected]; Liam Girdwood; Bard Liao; Oder Chiou; John Lin; Dylan Reid; Anatol Pomozov
Subject: Re: [PATCH] ASoC: rt5677: Reconfigure PLL1 after resume

Quoted 3 lines · Ben Zhang

Sometimes PLL1 stops working if the codec loses power during suspend (when pow-ldo2 or reset gpio is used). MX-7Bh(RT5677_PLL1_CTRL2) is cleared and won't be restored by

regcache

Quoted 3 lines

since it's volatile. MX-7Bh has one status bit and M code for PLL1. rt5677_set_dai_pll doesn't reconfigure
PLL1 after resume because it thinks the PLL params are not changed.

Quoted 8 lines
Quoted 2 lines

This patch clears the cached PLL params at resume so that rt5677_set_dai_pll can reconfigure the PLL after resume.

This is something I'd expect the machine driver to handle - if it's stopped using the PLL I'd expect it to explicitly turn it off, suspend (or the CODEC going idle for that matter normally, the PLL is burning
power) should do that. If anything I'd expect the CODEC driver to restore the current settings.

The main reason of this patch is MX-7Bh(RT5677_PLL1_CTRL2) is volatile. However, the status bit of MX-7Bh is currently not used by codec driver. So, it should be no problem if we set it non-volatile.

Quoted 2 lines

That said I'll apply this since it at least doesn't make things worse.

Can we revert it and resend a patch?

Quoted 2 lines

------Please consider the environment before printing this e-mail.

maintainer
#3 lore raw
Quoted 6 lines · Bard Liao
Quoted 5 lines

This is something I'd expect the machine driver to handle - if it's stopped using the PLL I'd expect it to explicitly turn it off, suspend (or the CODEC going idle for that matter normally, the PLL is burning
power) should do that. If anything I'd expect the CODEC driver to restore the current settings.

Quoted 7 lines

The main reason of this patch is MX-7Bh(RT5677_PLL1_CTRL2) is volatile. However, the status bit of MX-7Bh is currently not used by codec driver. So, it should be no problem if we set it non-volatile.

Quoted 1 line

That said I'll apply this since it at least doesn't make things worse.

Can we revert it and resend a patch?

Sure.

maintainer
#4 lore raw

Applied "ASoC: rt5677: Reconfigure PLL1 after resume" to the asoc tree

In reply to Ben Zhang

The patch

ASoC: rt5677: Reconfigure PLL1 after resume

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 1aa844cd56c7a2b94824f02495ff7ae5d52a7e91 Mon Sep 17 00:00:00 2001

From: Ben Zhang <[email protected]>
Date: Tue, 15 Dec 2015 13:51:25 -0800
Subject: [PATCH] ASoC: rt5677: Reconfigure PLL1 after resume

Sometimes PLL1 stops working if the codec loses power during suspend (when pow-ldo2 or reset gpio is used). MX-7Bh(RT5677_PLL1_CTRL2) is cleared and won't be restored by regcache since it's volatile. MX-7Bh has one status bit and M code for PLL1. rt5677_set_dai_pll doesn't reconfigure PLL1 after resume because it thinks the PLL params are not changed.

This patch clears the cached PLL params at resume so that rt5677_set_dai_pll can reconfigure the PLL after resume.

---
 sound/soc/codecs/rt5677.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/codecs/rt5677.c +3 -0
index f73fd125e49c..c404f515376e 100644
@@ -4792,6 +4792,9 @@ static int rt5677_resume(struct snd_soc_codec *codec)
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
 	if (!rt5677->dsp_vad_en) {
+		rt5677->pll_src = 0;
+		rt5677->pll_in = 0;
+		rt5677->pll_out = 0;
 		gpiod_set_value_cansleep(rt5677->pow_ldo2, 1);
 		gpiod_set_value_cansleep(rt5677->reset_pin, 0);
 		if (rt5677->pow_ldo2 || rt5677->reset_pin)
Signature · 1 line
2.6.2