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>