]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: simple-card-utils: use for_each_of_graph_port() on graph_get_dai_id()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 3 Dec 2024 02:10:32 +0000 (02:10 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 9 Dec 2024 13:11:45 +0000 (13:11 +0000)
commitbd4a5c8d5356fa42a1d63b684d34cf58a21eb8f7
tree5d04b2cdd81360f46a0b04c996f93642ef8b8c9f
parent76deee29153b8313cc9629d3db45e56024b3dd26
ASoC: simple-card-utils: use for_each_of_graph_port() on graph_get_dai_id()

Because DT check when compiling become very strict in these days,
we need to add reg = <x> if it has multi port/endpoint, otherwise
it will get error or warning. But it was not so strict and/or
mandatry before.

Current code is counting "endpoint" to get DAI ID, but it should count
"port" instead, otherwise strange ID will be used for DAI if it was multi
connected case (A). There is no issue if it was not multi connected (B).

One note is that this code will be used if neither port/endpoint doesn't
have reg = <x> property on DT.

case (A)

/* This should be handled as DAI-0 */
port@0 {
endpoint@0 {  } /* It will be DAI-0 by endpoint count */
endpoint@1 {  } /* It will be DAI-1 by endpoint count */
};
/* This should be handled as DAI-1 */
port@1 {
endpoint {  } /* It will be DAI-2 by endpoint count */
};

case (B)
/* both endpoint cound and port count are same */
port@0 {
endpoint { ... }
};
port@1 {
endpoint { ... }
};

It will be issue if Audio-Graph-Card is used with Multi Connection.
No issue will be happen with Audio-Graph-Card2 / Simple-Card.

This patch uses for_each_of_graph_port() instead of
for_each_endpoint_of_node(), and thus, we can use "break" to quit
from loop. Because for_each_of_graph_port() uses __free(device_node)
inside.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87o71tfrdz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/simple-card-utils.c