ASoC: dapm: Simplify fully route card handling
authorLars-Peter Clausen <lars@metafoo.de>
Sun, 21 Dec 2014 10:05:44 +0000 (11:05 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 22 Dec 2014 12:44:59 +0000 (12:44 +0000)
commit86d7500326ea71ea72aeaf0da78671eef28be2af
treeb839a6c58819f2d9d3a278d422112a6caba5fe62
parent768c0564439bce179e3f0f2ffafe8dcab6a08f40
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.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dapm.h
sound/soc/soc-core.c
sound/soc/soc-dapm.c