Skip to contentSkip to conversation

ASoC: dapm: Don't mark MICBIAS widgets as auto non-connected

PATCH Applied Lars-Peter Clausen 2 participants 3 messages Dec 21, 2014 – Dec 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ASoC: dapm: Don't mark MICBIAS widgets as auto non-connected

The connected flag of a widget only affects widgets that are either a source or a sink. The MICBIAS widget is a simple pass-through widget though and hence its behavior is the same regardless of whether the connected flag is set or not.

Hence there is not much point in trying to automatically mark MICBIAS widgets as non-connected, so just remove it.

---
 sound/soc/soc-dapm.c | 1 -
 1 file changed, 1 deletion(-)
sound/soc/soc-dapm.c +0 -1
index c5136bb..b8eba93 100644
@@ -3880,7 +3880,6 @@ void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card)
 		switch (w->id) {
 		case snd_soc_dapm_input:
 		case snd_soc_dapm_output:
-		case snd_soc_dapm_micbias:
 			dev_dbg(card->dev, "ASoC: Auto NC: Checking widget %s\n",
 				w->name);
 			if (!snd_soc_dapm_widget_in_card_paths(card, w)) {
Signature · 1 line
1.8.0
#1 lore raw

PATCH 2/2 ASoC: dapm: Simplify fully route card handling

For legacy reasons the ASoC framework assumes that a CODEC INPUT or OUTPUT widget that is not explicitly connected to a external source or sink is potentially connected to a source or a sink and hence the framework treats the widget itself as source (for INPUT) or sink (for OUTPUT). For this reason a INPUT or OUTPUT widget that is really not connected needs to be explicitly marked as so.

Setting the card's fully_routed flag will cause the ASoC core, once that all widgets and routes have been registered, to go through the list of all widgets and mark all INPUT and OUTPUT that are not externally connected as non-connected. This essentially negates the default behaviour of treating INPUT or OUTPUT widgets without external routes as sources or sinks.

This patch takes a different approach while getting the same result. Instead of first marking INPUT and OUTPUT widgets as sinks/sources and then later marking them as non-connected, just never mark them as a sink or a source if the fully_routed flag is set on a card.

This requires a lot less code and also results in a slightly faster card initialization since there is no need to iterate over all widgets and check whether the INPUT and OUTPUT widgets are connected or not.

---
 include/sound/soc-dapm.h |   1 -
 sound/soc/soc-core.c     |   3 --
 sound/soc/soc-dapm.c     | 104 ++++++++---------------------------------------
 3 files changed, 16 insertions(+), 92 deletions(-)
include/sound/soc-dapm.h +0 -1
index 89823cf..ecffecc 100644
@@ -431,7 +431,6 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
 					   const char *pin);
 int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
 				const char *pin);
-void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
 unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
 
 /* Mostly internal - should not normally be used */
sound/soc/soc-core.c +0 -3
index 2c62620..c024962 100644
@@ -1626,9 +1626,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
 		}
 	}
 
-	if (card->fully_routed)
-		snd_soc_dapm_auto_nc_pins(card);
-
 	snd_soc_dapm_new_widgets(card);
 
 	ret = snd_card_register(card->snd_card);
sound/soc/soc-dapm.c +16 -88

136 lines not on this page · raw message

Signature · 1 line
1.8.0
maintainer Applied
#2 lore raw
In reply to Lars-Peter Clausen
Quoted 4 lines · Lars-Peter Clausen

The connected flag of a widget only affects widgets that are either a source or a sink. The MICBIAS widget is a simple pass-through widget though and hence its behavior is the same regardless of whether the connected flag is set or not.

Applied both, thanks.