All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Vinod Koul <vinod.koul@intel.com>
Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>,
	patches.audio@intel.com, liam.r.girdwood@linux.intel.com,
	broonie@kernel.org, Sanyog Kale <sanyog.r.kale@intel.com>
Subject: Re: [PATCH] ASoC: pcm: allow delayed suspending request by	users
Date: Wed, 06 Jan 2016 14:08:57 +0100	[thread overview]
Message-ID: <s5hegdusvme.wl-tiwai@suse.de> (raw)
In-Reply-To: <1451994289-29256-1-git-send-email-vinod.koul@intel.com>

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

  parent reply	other threads:[~2016-01-06 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-01-07  8:25   ` [PATCH] ASoC: pcm: allow delayed suspending request by users Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hegdusvme.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.