[alsa-devel] ALSA framework problem: FE disconnected, BE still connected!
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
On Thu, Apr 18, 2013 at 09:56:25AM -0700, lkasam@codeaurora.org wrote:
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.
Please submit patches in hte form covered in SubmittingPatches.
On 4/18/2013 9:58 AM, Mark Brown wrote:
On Thu, Apr 18, 2013 at 09:56:25AM -0700, lkasam@codeaurora.org wrote:
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.
Please submit patches in hte form covered in SubmittingPatches.
Hi Mark,
We are not sure if the solution is correct. Change from Kasam will skip the step which trigger stop the hardware and directly call hardware free. Is it expected that every driver internally stops the hardware before freeing the hardware resource if not stopped?
Thanks Patrick
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Thu, Apr 18, 2013 at 01:26:40PM -0700, Patrick Lai wrote:
On 4/18/2013 9:58 AM, Mark Brown wrote:
Please submit patches in hte form covered in SubmittingPatches.
We are not sure if the solution is correct. Change from Kasam will skip
Even if you're not sure it's best to post as a normal patch so if the patch is a good solution it can be applied.
the step which trigger stop the hardware and directly call hardware free. Is it expected that every driver internally stops the hardware before freeing the hardware resource if not stopped?
That seems silly.
participants (3)
-
lkasam@codeaurora.org
-
Mark Brown
-
Patrick Lai