alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Re: DPCM: skip DAPM_STREAM_STOP event to BE, if still used by other FE
@ 2016-06-05  6:58 Kai Chieh Chuang
       [not found] ` <1466749294.16718.1.camel@mtkswgap22>
  2016-06-29 19:08 ` Mark Brown
  0 siblings, 2 replies; 8+ messages in thread
From: Kai Chieh Chuang @ 2016-06-05  6:58 UTC (permalink / raw)
  To: alsa-devel, broonie; +Cc: lgirdwood, chipeng.chang, kaichieh.chuang

> If this isn't happening that seems like a bug, I'm a bit surprised
> nobody else ran into it?  Shouldn't the counts of stream events that
> happen be symmetric (ie, we get as many stops as starts), or are we
> possibly missing some from things being switched in and out or
something?

This idea is same as the DPCM BE state control, in

int dpcm_be_dai_hw_free(..)
{
......
                /* do not free hw if this BE is used by other FE */
                if (be->dpcm[stream].users > 1)
                        continue;

and

int dpcm_be_dai_shutdown(...)
{
....
                if (--be->dpcm[stream].users != 0)
                        continue;

The BE receiving SND_SOC_DAPM_STREAM_STOP event, while still used by a
FE who is in STREAM_START state. The DAPM will just inactive BE related
widget/dai without checking. This just doesn't seems right.

And the last FE using the BE calls in to dpcm_fe_dai_shutdown(), will
run the process normally.


Actually, i trace the log, when one of the FE sent stop event to "still
in use BE", the BE power state will not be changed. Until the system
goes into
SNDRV_CTL_POWER_D3cold, the BE will be shutdown (i did set the
ignore_suspend=1). I didn't check why the BE is not turned off at the
point when receiving the stop event.

I'm also curious why no one seems to have the same issue. Probably there
is not much DPCM architecture system yet on the Linux?

^ permalink raw reply	[flat|nested] 8+ messages in thread
* DPCM: skip DAPM_STREAM_STOP event to BE, if still used by other FE
@ 2016-05-31  5:45 Kai Chieh Chuang
  2016-06-03  0:18 ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Kai Chieh Chuang @ 2016-05-31  5:45 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

Hi,
      Let me illustrate the system first.
FE1 -----+----> BE
         |
FE2 -----+

      When there is multi-FE stream to a single BE, the BE will receive
SND_SOC_DAPM_STREAM_STOP if one of the FE shutdown.
However, the BE is stilled used by another, this will let BE cpu_dai and
codec_dai think they are inactive. The later power check will go wrong.

I have check the latest linux version, and didn't find any related
change.
The following is my change to address this, and will re-send a formal
patch if it's ok.


diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 70e8088..9c2d159 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -163,6 +163,13 @@ int dpcm_dapm_stream_event(struct
snd_soc_pcm_runtime *fe, int dir,
 		dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n",
 				be->dai_link->name, event, dir);

+		/* don't sent stop event if this BE is used by other FE */
+		if (event == SND_SOC_DAPM_STREAM_STOP &&
+		    be->dpcm[dir].users >= 1) {
+			pr_warn("kc, %s(), be->dai_link->name %s skip stop event\n",
__func__, be->dai_link->name);
+			continue;
+		}
+
 		snd_soc_dapm_stream_event(be, dir, event);
 	}
 

Sincerely,
Kai Chieh

^ permalink raw reply related	[flat|nested] 8+ messages in thread
* DPCM: skip DAPM_STREAM_STOP event to BE, if still used by other FE
@ 2016-05-24  5:13 Chuang Eric
  0 siblings, 0 replies; 8+ messages in thread
From: Chuang Eric @ 2016-05-24  5:13 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org; +Cc: kaichieh.chuang@mediatek.com

Hi,

      Let me
illustrate the system first.

FE1 -----+----> BE

         |

FE2 -----+

 

      When there is
multi-FE stream to a single BE, the BE will receive SND_SOC_DAPM_STREAM_STOP if
one of the FE shutdown.

However, the BE is stilled used by another, this will let
BE cpu_dai and codec_dai think they are inactive. The later power check will go
wrong.

 

I have check the latest linux version, and didn't find
any related change.

The following is my change to address this, and will
re-send a formal patch if it's ok.

 

 

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 70e8088..9c2d159 100644

--- a/sound/soc/soc-pcm.c

+++ b/sound/soc/soc-pcm.c

@@ -163,6 +163,13 @@ int dpcm_dapm_stream_event(struct
snd_soc_pcm_runtime *fe, int dir,

            dev_dbg(be->dev, "ASoC: BE %s
event %d dir %d\n",

                        be->dai_link->name,
event, dir);

 

+           /* don't
sent stop event if this BE is used by other FE */

+           if
(event == SND_SOC_DAPM_STREAM_STOP &&

+               be->dpcm[dir].users >= 1) {

+                 pr_warn("kc,
%s(), be->dai_link->name %s skip stop event\n",

__func__, be->dai_link->name);

+                 continue;

+           }

+

            snd_soc_dapm_stream_event(be, dir,
event);

      }

 

 

Sincerely,

Kai Chieh 		 	   		  

^ permalink raw reply	[flat|nested] 8+ messages in thread
* DPCM: skip DAPM_STREAM_STOP event to BE, if still used by other FE
@ 2016-05-24  5:06 srv_kaichieh.chaung
  0 siblings, 0 replies; 8+ messages in thread
From: srv_kaichieh.chaung @ 2016-05-24  5:06 UTC (permalink / raw)
  To: alsa-devel; +Cc: kaichieh.chuang

Hi,
      Let me illustrate the system first.
FE1 -----+----> BE
         |
FE2 -----+

      When there is multi-FE stream to a single BE, the BE will receive
SND_SOC_DAPM_STREAM_STOP if one of the FE shutdown.
However, the BE is stilled used by another, this will let BE cpu_dai and
codec_dai think they are inactive. The later power check will go wrong.

I have check the latest linux version, and didn't find any related
change.
The following is my change to address this, and will re-send a formal
patch if it's ok.


diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 70e8088..9c2d159 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -163,6 +163,13 @@ int dpcm_dapm_stream_event(struct
snd_soc_pcm_runtime *fe, int dir,
 		dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n",
 				be->dai_link->name, event, dir);

+		/* don't sent stop event if this BE is used by other FE */
+		if (event == SND_SOC_DAPM_STREAM_STOP &&
+		    be->dpcm[dir].users >= 1) {
+			pr_warn("kc, %s(), be->dai_link->name %s skip stop event\n",
__func__, be->dai_link->name);
+			continue;
+		}
+
 		snd_soc_dapm_stream_event(be, dir, event);
 	}
 

Sincerely,
Kai Chieh

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

end of thread, other threads:[~2016-07-04  9:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-05  6:58 DPCM: skip DAPM_STREAM_STOP event to BE, if still used by other FE Kai Chieh Chuang
     [not found] ` <1466749294.16718.1.camel@mtkswgap22>
2016-06-29 19:04   ` Mark Brown
2016-06-29 19:08 ` Mark Brown
     [not found]   ` <1467599214.21156.2.camel@mtkswgap22>
2016-07-04  9:11     ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2016-05-31  5:45 Kai Chieh Chuang
2016-06-03  0:18 ` Mark Brown
2016-05-24  5:13 Chuang Eric
2016-05-24  5:06 srv_kaichieh.chaung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).