All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhucancan <zhucancan@vivo.com>
To: lgirdwood <lgirdwood@gmail.com>, broonie <broonie@kernel.org>,
	perex <perex@perex.cz>, tiwai <tiwai@suse.com>,
	alsa-devel <alsa-devel@alsa-project.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: kernel <kernel@vivo.com>, 朱灿灿 <zhucancan@vivo.com>,
	trivial <trivial@kernel.org>
Subject: Subject: [PATCH] ASoC: soc-pcm: fix BE dai not hw_free and shutdown during mixer update
Date: Fri, 29 May 2020 12:10:26 +0800 (GMT+08:00)	[thread overview]
Message-ID: <AJIAHAA7CLDayC1bgc0c0qq9.1.1590725427357.Hmail.zhucancan@vivo.com> (raw)

FE state is SND_SOC_DPCM_STATE_PREPARE now, BE1 is
used by FE.

Later when new BE2 is added to FE by mixer update,
it will call dpcm_run_update_startup() to update
BE2's state, but unfortunately BE2 .prepare() meets
error, it will disconnect all non started BE.

This make BE1 dai skip .hw_free() and .shutdown(),
and the BE1 users will never decrease to zero.

Signed-off-by: zhucancan <zhucancan@vivo.com>
---
 sound/soc/soc-pcm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 1f302de44052..df34422bd0dd 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2730,12 +2730,12 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
 close:
  dpcm_be_dai_shutdown(fe, stream);
 disconnect:
- /* disconnect any non started BEs */
+ /* disconnect any closed BEs */
  spin_lock_irqsave(&fe->card->dpcm_lock, flags);
  for_each_dpcm_be(fe, stream, dpcm) {
   struct snd_soc_pcm_runtime *be = dpcm->be;
-  if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START)
-    dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
+  if (be->dpcm[stream].state == SND_SOC_DPCM_STATE_CLOSE)
+   dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
  }
  spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
 
-- 
2.21.0



2020-05-29

zhucancan 


             reply	other threads:[~2020-05-29  4:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29  4:10 zhucancan [this message]
2020-05-29  9:44 ` Subject: [PATCH] ASoC: soc-pcm: fix BE dai not hw_free and shutdown during mixer update Mark Brown
2020-05-29  9:44   ` 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=AJIAHAA7CLDayC1bgc0c0qq9.1.1590725427357.Hmail.zhucancan@vivo.com \
    --to=zhucancan@vivo.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kernel@vivo.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=trivial@kernel.org \
    /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.