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

* Re: ALSA framework problem: FE disconnected, BE still connected!
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2013-04-18 16:58 UTC (permalink / raw)
  To: lkasam; +Cc: asishb, alsa-devel, plai, lgirdwood, gsantosh


[-- Attachment #1.1: Type: text/plain, Size: 326 bytes --]

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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: ALSA framework problem: FE disconnected, BE still connected!
  2013-04-18 16:58 ` Mark Brown
@ 2013-04-18 20:26   ` Patrick Lai
  2013-04-19 10:27     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Lai @ 2013-04-18 20:26 UTC (permalink / raw)
  To: Mark Brown; +Cc: asishb, lkasam, alsa-devel, lgirdwood, gsantosh

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
>


-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

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

* Re: ALSA framework problem: FE disconnected, BE still connected!
  2013-04-18 20:26   ` Patrick Lai
@ 2013-04-19 10:27     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-04-19 10:27 UTC (permalink / raw)
  To: Patrick Lai; +Cc: asishb, lkasam, alsa-devel, lgirdwood, gsantosh


[-- Attachment #1.1: Type: text/plain, Size: 577 bytes --]

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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[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.