All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: pcm: allow delayed suspending request by users
@ 2016-01-05 11:44 Vinod Koul
  2016-01-05 17:49 ` Applied "ASoC: pcm: allow delayed suspending request by users" to the asoc tree Mark Brown
  2016-01-06 13:08 ` [PATCH] ASoC: pcm: allow delayed suspending request by users Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Vinod Koul @ 2016-01-05 11:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Lars-Peter Clausen, patches.audio, liam.r.girdwood, Vinod Koul,
	broonie, Sanyog Kale

From: Sanyog Kale <sanyog.r.kale@intel.com>

If a device would like to use delayed suspending then PM
recommendation is to set ‘power.use_autosuspend’ flag. To allow
users to do so we need to change runtime calls in core to use
autosuspend counterparts.

For user who do not wish to use delayed suspend not setting the
device's ‘power.use_autosuspend’ flag will result in non-delayed
suspend even with these APIs which incidentally is also the default
behaviour, so only users will be impacted who opt in for this.

Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/soc-pcm.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index c86dc96e8986..efad248efd4f 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -599,10 +599,15 @@ platform_err:
 out:
 	mutex_unlock(&rtd->pcm_mutex);
 
-	pm_runtime_put(platform->dev);
-	for (i = 0; i < rtd->num_codecs; i++)
-		pm_runtime_put(rtd->codec_dais[i]->dev);
-	pm_runtime_put(cpu_dai->dev);
+	pm_runtime_mark_last_busy(platform->dev);
+	pm_runtime_put_autosuspend(platform->dev);
+	for (i = 0; i < rtd->num_codecs; i++) {
+		pm_runtime_mark_last_busy(rtd->codec_dais[i]->dev);
+		pm_runtime_put_autosuspend(rtd->codec_dais[i]->dev);
+	}
+
+	pm_runtime_mark_last_busy(cpu_dai->dev);
+	pm_runtime_put_autosuspend(cpu_dai->dev);
 	for (i = 0; i < rtd->num_codecs; i++) {
 		if (!rtd->codec_dais[i]->active)
 			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
@@ -706,10 +711,17 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 
 	mutex_unlock(&rtd->pcm_mutex);
 
-	pm_runtime_put(platform->dev);
-	for (i = 0; i < rtd->num_codecs; i++)
-		pm_runtime_put(rtd->codec_dais[i]->dev);
-	pm_runtime_put(cpu_dai->dev);
+	pm_runtime_mark_last_busy(platform->dev);
+	pm_runtime_put_autosuspend(platform->dev);
+
+	for (i = 0; i < rtd->num_codecs; i++) {
+		pm_runtime_mark_last_busy(rtd->codec_dais[i]->dev);
+		pm_runtime_put_autosuspend(rtd->codec_dais[i]->dev);
+	}
+
+	pm_runtime_mark_last_busy(cpu_dai->dev);
+	pm_runtime_put_autosuspend(cpu_dai->dev);
+
 	for (i = 0; i < rtd->num_codecs; i++) {
 		if (!rtd->codec_dais[i]->active)
 			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
-- 
1.9.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Applied "ASoC: pcm: allow delayed suspending request by users" to the asoc tree
  2016-01-05 11:44 [PATCH] ASoC: pcm: allow delayed suspending request by users Vinod Koul
@ 2016-01-05 17:49 ` Mark Brown
  2016-01-06 13:08 ` [PATCH] ASoC: pcm: allow delayed suspending request by users Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-01-05 17:49 UTC (permalink / raw)
  To: Sanyog Kale, Vinod Koul, Mark Brown; +Cc: alsa-devel

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

The patch

   ASoC: pcm: allow delayed suspending request by users

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

>From 3f80978397f447973d278198e8bbde82826cb9c1 Mon Sep 17 00:00:00 2001
From: Sanyog Kale <sanyog.r.kale@intel.com>
Date: Tue, 5 Jan 2016 17:14:49 +0530
Subject: [PATCH] ASoC: pcm: allow delayed suspending request by users
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If a device would like to use delayed suspending then PM
recommendation is to set ‘power.use_autosuspend’ flag. To allow
users to do so we need to change runtime calls in core to use
autosuspend counterparts.

For user who do not wish to use delayed suspend not setting the
device's ‘power.use_autosuspend’ flag will result in non-delayed
suspend even with these APIs which incidentally is also the default
behaviour, so only users will be impacted who opt in for this.

Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-pcm.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index c86dc96e8986..efad248efd4f 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -599,10 +599,15 @@ platform_err:
 out:
 	mutex_unlock(&rtd->pcm_mutex);
 
-	pm_runtime_put(platform->dev);
-	for (i = 0; i < rtd->num_codecs; i++)
-		pm_runtime_put(rtd->codec_dais[i]->dev);
-	pm_runtime_put(cpu_dai->dev);
+	pm_runtime_mark_last_busy(platform->dev);
+	pm_runtime_put_autosuspend(platform->dev);
+	for (i = 0; i < rtd->num_codecs; i++) {
+		pm_runtime_mark_last_busy(rtd->codec_dais[i]->dev);
+		pm_runtime_put_autosuspend(rtd->codec_dais[i]->dev);
+	}
+
+	pm_runtime_mark_last_busy(cpu_dai->dev);
+	pm_runtime_put_autosuspend(cpu_dai->dev);
 	for (i = 0; i < rtd->num_codecs; i++) {
 		if (!rtd->codec_dais[i]->active)
 			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
@@ -706,10 +711,17 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 
 	mutex_unlock(&rtd->pcm_mutex);
 
-	pm_runtime_put(platform->dev);
-	for (i = 0; i < rtd->num_codecs; i++)
-		pm_runtime_put(rtd->codec_dais[i]->dev);
-	pm_runtime_put(cpu_dai->dev);
+	pm_runtime_mark_last_busy(platform->dev);
+	pm_runtime_put_autosuspend(platform->dev);
+
+	for (i = 0; i < rtd->num_codecs; i++) {
+		pm_runtime_mark_last_busy(rtd->codec_dais[i]->dev);
+		pm_runtime_put_autosuspend(rtd->codec_dais[i]->dev);
+	}
+
+	pm_runtime_mark_last_busy(cpu_dai->dev);
+	pm_runtime_put_autosuspend(cpu_dai->dev);
+
 	for (i = 0; i < rtd->num_codecs; i++) {
 		if (!rtd->codec_dais[i]->active)
 			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
-- 
2.7.0.rc3


[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ASoC: pcm: allow delayed suspending request by users
  2016-01-05 11:44 [PATCH] ASoC: pcm: allow delayed suspending request by users Vinod Koul
  2016-01-05 17:49 ` Applied "ASoC: pcm: allow delayed suspending request by users" to the asoc tree Mark Brown
@ 2016-01-06 13:08 ` Takashi Iwai
  2016-01-07  8:25   ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2016-01-06 13:08 UTC (permalink / raw)
  To: Vinod Koul
  Cc: alsa-devel, Lars-Peter Clausen, patches.audio, liam.r.girdwood,
	broonie, Sanyog Kale

On Tue, 05 Jan 2016 12:44:49 +0100,
Vinod Koul wrote:
> 
> From: Sanyog Kale <sanyog.r.kale@intel.com>
> 
> If a device would like to use delayed suspending then PM
> recommendation is to set ‘power.use_autosuspend’ flag. To allow
> users to do so we need to change runtime calls in core to use
> autosuspend counterparts.
> 
> For user who do not wish to use delayed suspend not setting the
> device's ‘power.use_autosuspend’ flag will result in non-delayed
> suspend even with these APIs which incidentally is also the default
> behaviour, so only users will be impacted who opt in for this.
> 
> Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>  sound/soc/soc-pcm.c | 28 ++++++++++++++++++++--------
>  1 file changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index c86dc96e8986..efad248efd4f 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -599,10 +599,15 @@ platform_err:
>  out:
>  	mutex_unlock(&rtd->pcm_mutex);
>  
> -	pm_runtime_put(platform->dev);
> -	for (i = 0; i < rtd->num_codecs; i++)
> -		pm_runtime_put(rtd->codec_dais[i]->dev);
> -	pm_runtime_put(cpu_dai->dev);
> +	pm_runtime_mark_last_busy(platform->dev);
> +	pm_runtime_put_autosuspend(platform->dev);
> +	for (i = 0; i < rtd->num_codecs; i++) {
> +		pm_runtime_mark_last_busy(rtd->codec_dais[i]->dev);
> +		pm_runtime_put_autosuspend(rtd->codec_dais[i]->dev);
> +	}
> +
> +	pm_runtime_mark_last_busy(cpu_dai->dev);
> +	pm_runtime_put_autosuspend(cpu_dai->dev);
>  	for (i = 0; i < rtd->num_codecs; i++) {
>  		if (!rtd->codec_dais[i]->active)
>  			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
> @@ -706,10 +711,17 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
>  
>  	mutex_unlock(&rtd->pcm_mutex);
>  
> -	pm_runtime_put(platform->dev);
> -	for (i = 0; i < rtd->num_codecs; i++)
> -		pm_runtime_put(rtd->codec_dais[i]->dev);
> -	pm_runtime_put(cpu_dai->dev);
> +	pm_runtime_mark_last_busy(platform->dev);
> +	pm_runtime_put_autosuspend(platform->dev);
> +
> +	for (i = 0; i < rtd->num_codecs; i++) {
> +		pm_runtime_mark_last_busy(rtd->codec_dais[i]->dev);
> +		pm_runtime_put_autosuspend(rtd->codec_dais[i]->dev);
> +	}
> +
> +	pm_runtime_mark_last_busy(cpu_dai->dev);
> +	pm_runtime_put_autosuspend(cpu_dai->dev);
> +
>  	for (i = 0; i < rtd->num_codecs; i++) {
>  		if (!rtd->codec_dais[i]->active)
>  			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);

Lots of duplicated codes there...  Worth to have a common helper?


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] ASoC: pcm: allow delayed suspending request by users
  2016-01-06 13:08 ` [PATCH] ASoC: pcm: allow delayed suspending request by users Takashi Iwai
@ 2016-01-07  8:25   ` Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2016-01-07  8:25 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: alsa-devel, Lars-Peter Clausen, patches.audio, liam.r.girdwood,
	broonie, Sanyog Kale

On Wed, Jan 06, 2016 at 02:08:57PM +0100, Takashi Iwai wrote:
> On Tue, 05 Jan 2016 12:44:49 +0100,
> Vinod Koul wrote:
> > -	pm_runtime_put(platform->dev);
> > -	for (i = 0; i < rtd->num_codecs; i++)
> > -		pm_runtime_put(rtd->codec_dais[i]->dev);
> > -	pm_runtime_put(cpu_dai->dev);
> > +	pm_runtime_mark_last_busy(platform->dev);
> > +	pm_runtime_put_autosuspend(platform->dev);
> > +
> > +	for (i = 0; i < rtd->num_codecs; i++) {
> > +		pm_runtime_mark_last_busy(rtd->codec_dais[i]->dev);
> > +		pm_runtime_put_autosuspend(rtd->codec_dais[i]->dev);
> > +	}
> > +
> > +	pm_runtime_mark_last_busy(cpu_dai->dev);
> > +	pm_runtime_put_autosuspend(cpu_dai->dev);
> > +
> >  	for (i = 0; i < rtd->num_codecs; i++) {
> >  		if (!rtd->codec_dais[i]->active)
> >  			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
> 
> Lots of duplicated codes there...  Worth to have a common helper?

I certainly think so :) will do this after merge window

-- 
~Vinod

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

end of thread, other threads:[~2016-01-07  8:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-05 11:44 [PATCH] ASoC: pcm: allow delayed suspending request by users Vinod Koul
2016-01-05 17:49 ` Applied "ASoC: pcm: allow delayed suspending request by users" to the asoc tree Mark Brown
2016-01-06 13:08 ` [PATCH] ASoC: pcm: allow delayed suspending request by users Takashi Iwai
2016-01-07  8:25   ` Vinod Koul

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.