All of lore.kernel.org
 help / color / mirror / Atom feed
* ALSA framework problem: FE disconnected, BE still connected!
@ 2013-04-18 16:56 lkasam
  2013-04-18 16:58 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: lkasam @ 2013-04-18 16:56 UTC (permalink / raw)
  To: alsa-devel, lgirdwood; +Cc: asishb, plai, broonie, gsantosh

Hi Liam,
We have a problem encountered in ALSA framework wrt FE/BE disconnection and
fix to it is mentioned in below code change. please check it and provide
your valuable comments.


----------------------
From: Laxminath Kasam <lkasam@codeaurora.org>
Date: Wed, 3 Apr 2013 14:03:17 +0530
Subject: [PATCH] ASoC: audio: Fix BE not disconnected even codec teardown

Scenario:
When FE1(LowLatency) comes in which opens BE1 and puts it in state
SND_SOC_DPCM_STATE_START. Similarly FE2(LPA) comes in with
connecting to same BE. Now FE2 is in SND_SOC_DPCM_STATE_PREPARE
state and waits for TRIGGER_START. Meanwhile FE1 is closed which
doesn't affect BE1 and FE2 which are connected.
Also, for FE2 pcm_close is called before TRIGGER_START itself.
In such a case, BE1 is not getting disconnected  while Codec is teared
down resulting in failures.

Fix:
Whenever BE1 is found to be in SND_SOC_DPCM_STATE_START state
and FE1 being connected is not started yet, and close sequence
happens for this FE, then allow hw_free to happen for BE1 if
this is the only FE connected to this BE1. This allows BE to be
disconnected which calls afe_close then followed by Codec teardown
not resulting in any failures.

Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
---
sound/soc/soc-pcm.c |    7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 915c3c2..ed0ea86 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1765,7 +1765,12 @@ static int soc_dpcm_be_dai_hw_free(struct
snd_soc_pcm_runtime *fe, int stream)
                    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
                        (be->dpcm[stream].state !=
SND_SOC_DPCM_STATE_HW_FREE) &&
                    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) &&
-                   (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
+                   (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
+                   !((be->dpcm[stream].state == SND_SOC_DPCM_STATE_START)&&
+                     ((fe->dpcm[stream].state !=
SND_SOC_DPCM_STATE_START) &&
+                       (fe->dpcm[stream].state !=
SND_SOC_DPCM_STATE_PAUSED) &&
+                       (fe->dpcm[stream].state !=
+
SND_SOC_DPCM_STATE_SUSPEND))))
                        continue;

                dev_dbg(be->dev, "dpcm: hw_free BE %s\n",
--
-----------------------------------------


Please let me know if you are looking for more details.

Thanks
Kasam

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

end of thread, other threads:[~2013-04-19 10:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 16:56 ALSA framework problem: FE disconnected, BE still connected! lkasam
2013-04-18 16:58 ` Mark Brown
2013-04-18 20:26   ` Patrick Lai
2013-04-19 10:27     ` Mark Brown

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.