All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt9120: Make dev PM runtime bind AsoC component PM
@ 2022-12-29  8:03 ` cy_huang
  0 siblings, 0 replies; 4+ messages in thread
From: cy_huang @ 2022-12-29  8:03 UTC (permalink / raw)
  To: lgirdwood, broonie
  Cc: cy_huang, jeff_chang, oder_chiou, perex, tiwai, alsa-devel, linux-kernel

From: ChiYuan Huang <cy_huang@richtek.com>

RT9120 uses PM runtime autosuspend to decrease the frequently on/off
spent time. This exists one case, when pcm is closed and dev PM is
waiting for autosuspend time expired to enter runtime suspend state.
At the mean time, system is going to enter suspend, dev PM runtime
suspend won't be called. It makes the rt9120 suspend consumption
current not as expected.

This patch can fix the rt9120 dev PM issue during runtime autosuspend
and system suspend by binding dev PM runtime and ASoC component PM.

Fixes: 80b949f332e3 ("ASoC: rt9120: Use pm_runtime and regcache to optimize 'pwdnn' logic")
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
---
 sound/soc/codecs/rt9120.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/soc/codecs/rt9120.c b/sound/soc/codecs/rt9120.c
index 644300e..fcf4fba 100644
--- a/sound/soc/codecs/rt9120.c
+++ b/sound/soc/codecs/rt9120.c
@@ -177,8 +177,20 @@ static int rt9120_codec_probe(struct snd_soc_component *comp)
 	return 0;
 }
 
+static int rt9120_codec_suspend(struct snd_soc_component *comp)
+{
+	return pm_runtime_force_suspend(comp->dev);
+}
+
+static int rt9120_codec_resume(struct snd_soc_component *comp)
+{
+	return pm_runtime_force_resume(comp->dev);
+}
+
 static const struct snd_soc_component_driver rt9120_component_driver = {
 	.probe = rt9120_codec_probe,
+	.suspend = rt9120_codec_suspend,
+	.resume = rt9120_codec_resume,
 	.controls = rt9120_snd_controls,
 	.num_controls = ARRAY_SIZE(rt9120_snd_controls),
 	.dapm_widgets = rt9120_dapm_widgets,
-- 
2.7.4


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

* [PATCH] ASoC: rt9120: Make dev PM runtime bind AsoC component PM
@ 2022-12-29  8:03 ` cy_huang
  0 siblings, 0 replies; 4+ messages in thread
From: cy_huang @ 2022-12-29  8:03 UTC (permalink / raw)
  To: lgirdwood, broonie
  Cc: oder_chiou, alsa-devel, linux-kernel, tiwai, cy_huang, jeff_chang

From: ChiYuan Huang <cy_huang@richtek.com>

RT9120 uses PM runtime autosuspend to decrease the frequently on/off
spent time. This exists one case, when pcm is closed and dev PM is
waiting for autosuspend time expired to enter runtime suspend state.
At the mean time, system is going to enter suspend, dev PM runtime
suspend won't be called. It makes the rt9120 suspend consumption
current not as expected.

This patch can fix the rt9120 dev PM issue during runtime autosuspend
and system suspend by binding dev PM runtime and ASoC component PM.

Fixes: 80b949f332e3 ("ASoC: rt9120: Use pm_runtime and regcache to optimize 'pwdnn' logic")
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
---
 sound/soc/codecs/rt9120.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/soc/codecs/rt9120.c b/sound/soc/codecs/rt9120.c
index 644300e..fcf4fba 100644
--- a/sound/soc/codecs/rt9120.c
+++ b/sound/soc/codecs/rt9120.c
@@ -177,8 +177,20 @@ static int rt9120_codec_probe(struct snd_soc_component *comp)
 	return 0;
 }
 
+static int rt9120_codec_suspend(struct snd_soc_component *comp)
+{
+	return pm_runtime_force_suspend(comp->dev);
+}
+
+static int rt9120_codec_resume(struct snd_soc_component *comp)
+{
+	return pm_runtime_force_resume(comp->dev);
+}
+
 static const struct snd_soc_component_driver rt9120_component_driver = {
 	.probe = rt9120_codec_probe,
+	.suspend = rt9120_codec_suspend,
+	.resume = rt9120_codec_resume,
 	.controls = rt9120_snd_controls,
 	.num_controls = ARRAY_SIZE(rt9120_snd_controls),
 	.dapm_widgets = rt9120_dapm_widgets,
-- 
2.7.4


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

* Re: [PATCH] ASoC: rt9120: Make dev PM runtime bind AsoC component PM
  2022-12-29  8:03 ` cy_huang
@ 2022-12-29 20:24   ` Mark Brown
  -1 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-12-29 20:24 UTC (permalink / raw)
  To: lgirdwood, cy_huang
  Cc: cy_huang, jeff_chang, oder_chiou, perex, tiwai, alsa-devel, linux-kernel

On Thu, 29 Dec 2022 16:03:53 +0800, cy_huang wrote:
> RT9120 uses PM runtime autosuspend to decrease the frequently on/off
> spent time. This exists one case, when pcm is closed and dev PM is
> waiting for autosuspend time expired to enter runtime suspend state.
> At the mean time, system is going to enter suspend, dev PM runtime
> suspend won't be called. It makes the rt9120 suspend consumption
> current not as expected.
> 
> [...]

Applied to

   broonie/sound.git for-next

Thanks!

[1/1] ASoC: rt9120: Make dev PM runtime bind AsoC component PM
      commit: 7161bd540eebebae2bbe8c79de25d8caf12dbf78

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] 4+ messages in thread

* Re: [PATCH] ASoC: rt9120: Make dev PM runtime bind AsoC component PM
@ 2022-12-29 20:24   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-12-29 20:24 UTC (permalink / raw)
  To: lgirdwood, cy_huang
  Cc: oder_chiou, alsa-devel, linux-kernel, tiwai, cy_huang, jeff_chang

On Thu, 29 Dec 2022 16:03:53 +0800, cy_huang wrote:
> RT9120 uses PM runtime autosuspend to decrease the frequently on/off
> spent time. This exists one case, when pcm is closed and dev PM is
> waiting for autosuspend time expired to enter runtime suspend state.
> At the mean time, system is going to enter suspend, dev PM runtime
> suspend won't be called. It makes the rt9120 suspend consumption
> current not as expected.
> 
> [...]

Applied to

   broonie/sound.git for-next

Thanks!

[1/1] ASoC: rt9120: Make dev PM runtime bind AsoC component PM
      commit: 7161bd540eebebae2bbe8c79de25d8caf12dbf78

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] 4+ messages in thread

end of thread, other threads:[~2022-12-29 20:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-29  8:03 [PATCH] ASoC: rt9120: Make dev PM runtime bind AsoC component PM cy_huang
2022-12-29  8:03 ` cy_huang
2022-12-29 20:24 ` Mark Brown
2022-12-29 20:24   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.