ASoC: soc-dapm.c: tidyup dapm_connect_dai_pair()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 5 Apr 2023 22:57:55 +0000 (22:57 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 6 Apr 2023 13:44:54 +0000 (14:44 +0100)
commit3456aeb02a28e82235d45da434752e6f441427f0
tree46e747049a71ab88ff64c41a4649fb5cd8427ca3
parent99fddc1618ff64cc71bd51dbf83bd13e74778fe0
ASoC: soc-dapm.c: tidyup dapm_connect_dai_pair()

dapm_connect_dai_pair() handles
"Normal/Codec2Codec" x "CPU/Codec" x "Playback/Capture".

(A) is "Codec2Codec" case of "CPU"   widget x "Playback/Capture",
(B) is "Normal"      case of "CPU"   widget x "Playback/Capture",
(C) is each          case of "Codec" widget.

(X) is handling "Playback" case DAI connecting,
(Y) is handling "Capture"  case DAI connecting.

static void dapm_connect_dai_pair(...)
{
...

(A) if (dai_link->params) {
playback_cpu = ...
capture_cpu = ...
(B) } else {
playback_cpu = ...
capture_cpu = ...
}

 ^ /* connect BE DAI playback if widgets are valid */
 | stream = SNDRV_PCM_STREAM_PLAYBACK;
 | (C) codec = codec_dai->playback_widget;
 |
 | if (playback_cpu && codec) {
(X) if (dai_link->params && !rtd->c2c_widget[stream]) {
 | ...
 | }
 |
 | (z) dapm_connect_dai_routes(...);
 v }

capture:
 ^ /* connect BE DAI capture if widgets are valid */
 | stream = SNDRV_PCM_STREAM_CAPTURE;
 | (C) codec = codec_dai->capture_widget;
 |
 | if (codec && capture_cpu) {
(Y) if (dai_link->params && !rtd->c2c_widget[stream]) {
 | ...
 | }
 |
 | (z) dapm_connect_dai_routes(...);
 v }
}

(X) part and (Y) part are almost same.
Main purpose of these parts (and this function) is calling
dapm_connect_dai_routes() (= z) on each cases.
The difference is "parameter"
(= Normal/Codec2Codec x CPU/Codec x Playback/Capture).

This patch cleanup these, but nothing changed for meaning.

Link: https://lore.kernel.org/r/87ilen6ni4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877cuqvswc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c