Skip to contentSkip to conversation

ASoC: dapm: Treat DAI widgets like AIF widgets for power

PATCH In review Mark Brown 3 participants 3 messages Jun 5, 2013

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: dapm: Treat DAI widgets like AIF widgets for power

Even though they are virtual widgets DAI widgets still get counted for the DAPM context power management so we can't just use the active state to check if they should be powered as they may not be part of a complete path.

Instead split them into input and output widgets and do the same power checks as we perform on AIFs.

---

Compile tested only thus far.

 include/sound/soc-dapm.h |    3 ++-
 sound/soc/soc-dapm.c     |   49 ++++++++++++++++++++++++----------------------
 sound/soc/soc-pcm.c      |    7 ++++++-
 3 files changed, 34 insertions(+), 25 deletions(-)
include/sound/soc-dapm.h +2 -1
index f4f85dd..69e8e07 100644
@@ -452,7 +452,8 @@ enum snd_soc_dapm_type {
 	snd_soc_dapm_aif_in,		/* audio interface input */
 	snd_soc_dapm_aif_out,		/* audio interface output */
 	snd_soc_dapm_siggen,		/* signal generator */
-	snd_soc_dapm_dai,		/* link to DAI structure */
+	snd_soc_dapm_dai_in,		/* link to DAI structure */
+	snd_soc_dapm_dai_out,
 	snd_soc_dapm_dai_link,		/* link between two DAI structures */
 };
 
sound/soc/soc-dapm.c +26 -23

133 lines not on this page · raw message

sound/soc/soc-pcm.c +6 -1
index a14335e..b6c6403 100644
@@ -931,8 +931,13 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
 	/* Create any new FE <--> BE connections */
 	for (i = 0; i < list->num_widgets; i++) {
 
-		if (list->widgets[i]->id != snd_soc_dapm_dai)
+		switch (list->widgets[i]->id) {
+		case snd_soc_dapm_dai_in:
+		case snd_soc_dapm_dai_out:
+			break;
+		default:
 			continue;
+		}
 
 		/* is there a valid BE rtd for this widget */
 		be = dpcm_get_be(card, list->widgets[i], stream);
Signature · 1 line
1.7.10.4
Tested-by on v1 1/1
#1 lore raw
Quoted 10 lines · Mark Brown

Even though they are virtual widgets DAI widgets still get counted for the DAPM context power management so we can't just use the active state to check if they should be powered as they may not be part of a complete path.

Instead split them into input and output widgets and do the same power checks as we perform on AIFs.

sound/soc/soc-dapm.c int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) · line 3424

Quoted 5 lines
sound/soc/soc-dapm.c +1 -1
@@ -3428,8 +3421,13 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
 
 	/* For each DAI widget... */
 	list_for_each_entry(dai_w, &card->widgets, list) {
-		if (dai_w->id != snd_soc_dapm_dai)
+		switch (w->id) {

That should be dai_w->id not w->id.

With that fixed,

I tested two things:

1) General audio playback in next-20130605, for regressions. System suspend wasn't tested since it doesn't work there on Tegra yet.

2) System suspend, in a kernel based on v3.8, with this patch replacing my previous "ASoC: dapm: check suspend state in dapm_dai_check_power()".

Thanks!

maintainer
#2 lore raw
Quoted 9 lines · Stephen Warren

sound/soc/soc-dapm.c int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) · line 3424

Quoted 2 lines · Mark Brown
sound/soc/soc-dapm.c +1 -1
-		if (dai_w->id != snd_soc_dapm_dai)
+		switch (w->id) {

That should be dai_w->id not w->id.

With that fixed,

Great, thanks for testing.