All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Qiao Zhou <zhouqiao@marvell.com>
Cc: alsa-devel@alsa-project.org, shangll@marvell.com, tiwai@suse.de,
	lgirdwood@gmail.com, broonie@kernel.org
Subject: Re: [PATCH] ASoC: soc-pcm: do not hw_free BE if it's still used
Date: Wed, 03 Dec 2014 20:37:31 +0000	[thread overview]
Message-ID: <1417639051.2559.37.camel@loki> (raw)
In-Reply-To: <1417572823-22420-1-git-send-email-zhouqiao@marvell.com>

On Wed, 2014-12-03 at 10:13 +0800, Qiao Zhou wrote:
> Do not free BE hw if it's still used by other FE during dpcm runtime
> shutdown. Otherwise the BE runtime state will be STATE_HW_FREE and
> won't be updated to STATE_CLOSE when shutdown ends, because BE dai
> shutdown function won't close pcm when detecting BE is still under
> use. With STATE_HW_FREE, BE can't be triggered start again.
> 
> This corner case can easily appear when one BE is used by two FE,
> without this patch "ASoC: dpcm: Fix race between FE/BE updates and
> trigger"(ea9d0d771fcd32cd56070819749477d511ec9117). One FE tries to
> shutdown but it's raced against xrun on another FE. It improves the
> be dai hw_free logic.
> 
> Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>

Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

> ---
>  sound/soc/soc-pcm.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 57277dd..70e8088 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -1664,6 +1664,10 @@ int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
>  		if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
>  				continue;
>  
> +		/* do not free hw if this BE is used by other FE */
> +		if (be->dpcm[stream].users > 1)
> +			continue;
> +
>  		if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
>  		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
>  		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&

  reply	other threads:[~2014-12-03 22:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03  2:13 [PATCH] ASoC: soc-pcm: do not hw_free BE if it's still used Qiao Zhou
2014-12-03 20:37 ` Liam Girdwood [this message]
2014-12-04 22:42 ` Mark Brown

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=1417639051.2559.37.camel@loki \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=shangll@marvell.com \
    --cc=tiwai@suse.de \
    --cc=zhouqiao@marvell.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.