ASoC: audio-graph: count DAI / link numbers as in order
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 26 Mar 2021 03:26:11 +0000 (12:26 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 31 Mar 2021 12:42:41 +0000 (13:42 +0100)
commit674b9438e2d4c44f45af2a38521767c06c46eacb
tree0d1607e8990d98ae63f4bdfe07d154be4dcf122a
parent050c7950fd706fec229af9f30e8ce254cea9b675
ASoC: audio-graph: count DAI / link numbers as in order

audio-graph checks DT links 2 times. 1st is for counting DAIs / links
to allocating memory, 2nd is for detecting DAIs.
To detecting DAIs as CPU-dummy -> dummy-Codec order when DPCM case,
it uses loops 2 times at 2nd DT link check.
But it doesn't do it at 1st DT link check.

for (li.cpu = 1; li.cpu >= 0; li.cpu--) {
/*
 * Detect all CPU first, and Detect all Codec 2n
 *
 * In Normal sound case, all DAIs are detected
 * as "CPU-Codec".
 *
 * In DPCM sound case,
 * all CPUs   are detected as "CPU-dummy", and
 * all Codecs are detected as "dummy-Codec".
 * To avoid random sub-device numbering,
 * detect "dummy-Codec" in last;
 */
ret = graph_for_each_link(...);
...
}

To prepare supporting multi-CPU/Codec, and code cleanup,
this patch use same loop for 1st DT link check, too.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6qq1tpp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/audio-graph-card.c