alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm8962: Force suspend/resume during system suspend/resume
@ 2020-04-24  6:12 Shengjiu Wang
  2020-04-24 10:43 ` Charles Keepax
  0 siblings, 1 reply; 3+ messages in thread
From: Shengjiu Wang @ 2020-04-24  6:12 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, shengjiu.wang, tglx, allison,
	info, patches, alsa-devel, linux-kernel

Use force_suspend/resume to make sure clocks are disabled/enabled
accordingly during system suspend/resume.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/codecs/wm8962.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 0a2cfff44441..80332c147da9 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3854,6 +3854,8 @@ static int wm8962_runtime_suspend(struct device *dev)
 
 static const struct dev_pm_ops wm8962_pm = {
 	SET_RUNTIME_PM_OPS(wm8962_runtime_suspend, wm8962_runtime_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+				pm_runtime_force_resume)
 };
 
 static const struct i2c_device_id wm8962_i2c_id[] = {
-- 
2.21.0


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

* Re: [PATCH] ASoC: wm8962: Force suspend/resume during system suspend/resume
  2020-04-24  6:12 [PATCH] ASoC: wm8962: Force suspend/resume during system suspend/resume Shengjiu Wang
@ 2020-04-24 10:43 ` Charles Keepax
  2020-04-24 10:46   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Charles Keepax @ 2020-04-24 10:43 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, linux-kernel, patches, tiwai, lgirdwood, broonie,
	tglx, info, allison

On Fri, Apr 24, 2020 at 02:12:07PM +0800, Shengjiu Wang wrote:
> Use force_suspend/resume to make sure clocks are disabled/enabled
> accordingly during system suspend/resume.
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
>  sound/soc/codecs/wm8962.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index 0a2cfff44441..80332c147da9 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -3854,6 +3854,8 @@ static int wm8962_runtime_suspend(struct device *dev)
>  
>  static const struct dev_pm_ops wm8962_pm = {
>  	SET_RUNTIME_PM_OPS(wm8962_runtime_suspend, wm8962_runtime_resume, NULL)
> +	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> +				pm_runtime_force_resume)

I would be interested in a little more explaination of why this is
the correct fix here?

My concern is this presumably precludes the CODEC being used in any
application where it is expected to process audio during system
suspend. Admittedly, the target market for this device probably
makes that unlikely, but I am slightly uncomfortable just assuming
that will always be true.

As far as I can see the expectation is that DAPM shutdowns down
all audio streams during system suspend (except those marked to
ignore suspend, as per my above concerns) and that will cause
a pm_runtime_put on each DAPM context which I would imagine is
intended to put the CODEC into runtime suspend. I am guessing the
reason you have problems is because of the driver doing its own
pm_runtime operations in set_fll, which probably takes an extra
reference preventing the power down. Is a more complex fix
correcting the interaction with DAPM the correct solution here?

Thanks,
Charles

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

* Re: [PATCH] ASoC: wm8962: Force suspend/resume during system suspend/resume
  2020-04-24 10:43 ` Charles Keepax
@ 2020-04-24 10:46   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-04-24 10:46 UTC (permalink / raw)
  To: Charles Keepax
  Cc: alsa-devel, linux-kernel, patches, Shengjiu Wang, tiwai,
	lgirdwood, tglx, info, allison

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Fri, Apr 24, 2020 at 10:43:47AM +0000, Charles Keepax wrote:

> intended to put the CODEC into runtime suspend. I am guessing the
> reason you have problems is because of the driver doing its own
> pm_runtime operations in set_fll, which probably takes an extra
> reference preventing the power down. Is a more complex fix
> correcting the interaction with DAPM the correct solution here?

Or just updating the machine driver to turn off the FLL when shutting
down (or even when the device is idle in general).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-04-24 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24  6:12 [PATCH] ASoC: wm8962: Force suspend/resume during system suspend/resume Shengjiu Wang
2020-04-24 10:43 ` Charles Keepax
2020-04-24 10:46   ` 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).