alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: add suspend and resume for ES8316
@ 2022-08-25  1:49 Zhu Ning
  2022-08-25 12:45 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Ning @ 2022-08-25  1:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: Zhu Ning, broonie, Zhu Ning, pierre-louis.bossart, tiwai

The registers may be lost after suspend due to powerdown.
regcache_sync solves this issue.

Signed-off-by: Zhu Ning <zhuning@everest-semi.com>
---
 sound/soc/codecs/es8316.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index de7185f73e1e..8643014472ae 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -767,9 +767,31 @@ static void es8316_remove(struct snd_soc_component *component)
 	clk_disable_unprepare(es8316->mclk);
 }
 
+static int es8316_resume(struct snd_soc_component *component)
+{
+	struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
+
+	regcache_cache_only(es8316->regmap, false);
+	regcache_sync(es8316->regmap);
+
+	return 0;
+}
+
+static int es8316_suspend(struct snd_soc_component *component)
+{
+	struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
+
+	regcache_cache_only(es8316->regmap, true);
+	regcache_mark_dirty(es8316->regmap);
+
+	return 0;
+}
+
 static const struct snd_soc_component_driver soc_component_dev_es8316 = {
 	.probe			= es8316_probe,
 	.remove			= es8316_remove,
+	.resume			= es8316_resume,
+	.suspend		= es8316_suspend,
 	.set_jack		= es8316_set_jack,
 	.controls		= es8316_snd_controls,
 	.num_controls		= ARRAY_SIZE(es8316_snd_controls),
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: codecs: add suspend and resume for ES8316
  2022-08-25  1:49 [PATCH] ASoC: codecs: add suspend and resume for ES8316 Zhu Ning
@ 2022-08-25 12:45 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-08-25 12:45 UTC (permalink / raw)
  To: alsa-devel, Zhu Ning; +Cc: Zhu Ning, tiwai, pierre-louis.bossart

On Thu, 25 Aug 2022 09:49:52 +0800, Zhu Ning wrote:
> The registers may be lost after suspend due to powerdown.
> regcache_sync solves this issue.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: add suspend and resume for ES8316
      commit: 4bac47a7b2f9f0c84411cb06944bab8f85c08757

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-25 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25  1:49 [PATCH] ASoC: codecs: add suspend and resume for ES8316 Zhu Ning
2022-08-25 12:45 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).