Skip to contentSkip to conversation

ASoC: soc-pcm: skip dpcm path checking with incapable/unready FE

PATCH Applied Qiao Zhou 2 participants 3 messages Nov 17, 2014 – Nov 24, 2014

Subsystems (2)
lore
Share & tools
lore

Qiao Zhou

author
#0 lore raw

PATCH 1/1 ASoC: soc-pcm: skip dpcm path checking with incapable/unready FE

Skip dpcm path checking for playback or capture, if corresponding FE doesn't support playback or capture, or currently is not ready. It can reduce the unnecessary cost to search connected widgets.

---
 sound/soc/soc-pcm.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
sound/soc/soc-pcm.c +14 -2
index 002311a..3b068d4 100644
@@ -2248,7 +2248,13 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card)
 			fe->dai_link->name);
 
 		/* skip if FE doesn't have playback capability */
-		if (!fe->cpu_dai->driver->playback.channels_min)
+		if (!fe->cpu_dai->driver->playback.channels_min
+		    || !fe->codec_dai->driver->playback.channels_min)
+			goto capture;
+
+		/* skip if FE doesn't do playback */
+		if (!fe->cpu_dai->playback_active
+		    || !fe->codec_dai->playback_active)
 			goto capture;
 
 		paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list);
@@ -2278,7 +2284,13 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card)
 		dpcm_path_put(&list);
 capture:
 		/* skip if FE doesn't have capture capability */
-		if (!fe->cpu_dai->driver->capture.channels_min)
+		if (!fe->cpu_dai->driver->capture.channels_min
+		    || !fe->codec_dai->driver->capture.channels_min)
+			continue;
+
+		/* skip if FE doesn't do capture */
+		if (!fe->cpu_dai->capture_active
+		    || !fe->codec_dai->capture_active)
 			continue;
 
 		paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list);
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw
Quoted 3 lines · Qiao Zhou

Skip dpcm path checking for playback or capture, if corresponding FE doesn't support playback or capture, or currently is not ready. It can reduce the unnecessary cost to search connected widgets.

Applied, but I did change...

sound/soc/soc-pcm.c int soc_dpcm_runtime_update(struct snd_soc_card *card) · line 2257

Quoted 3 lines
sound/soc/soc-pcm.c +3 -0
+		/* skip if FE doesn't do playback */
+		if (!fe->cpu_dai->playback_active
+		    || !fe->codec_dai->playback_active)

...this and the corresponding capture comment to say "isn't currently playing" - it's not if the front end can play, it's if it is playing right now.

author
#2 lore raw
Quoted 7 lines · Mark Brown
Quoted 3 lines · Qiao Zhou

Skip dpcm path checking for playback or capture, if corresponding FE doesn't support playback or capture, or currently is not ready. It can reduce the unnecessary cost to search connected widgets.

Applied, but I did change...

Quoted 8 lines

sound/soc/soc-pcm.c int soc_dpcm_runtime_update(struct snd_soc_card *card) · line 2257

Quoted 3 lines
sound/soc/soc-pcm.c +3 -0
+		/* skip if FE doesn't do playback */
+		if (!fe->cpu_dai->playback_active
+		    || !fe->codec_dai->playback_active)

...this and the corresponding capture comment to say "isn't currently playing" - it's not if the front end can play, it's if it is playing right now.

Mark,

Thanks for the correction.

Signature · 2 lines
Best Regards
Qiao