[PATCH 2/3] ASoC: simple-card-utils: check port reg first on graph_get_dai_id()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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 uses reg number as DAI ID, but it will use "endpoint"
reg first and use "port" reg 2nd. But it should use port number as 1st (A)
if it was used for multi connected case. There is no priority for
port/endpoint if it was not multi connected (B).

case (A)
	port {
		/*
		 * "port" and "endpoint" are using different reg number.
		 * It should use <x> as DAI ID, not <y> not <z>
		 */
		reg = <x>;
		endpoint@y { reg = <y>; ... };
		endpoint@z { reg = <z>; ... };
	};

case (B)
	port {
		/*
		 * Both port/endpoint are using same reg numer <x>.
		 */
		reg = <x>;
		endpoint { reg = <x>; ... };
	};

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 swtich port/endpoint priority.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 sound/soc/generic/simple-card-utils.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index d2307d135931b..f67a1e58e821c 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -1045,12 +1045,15 @@ static int graph_get_dai_id(struct device_node *ep)
 		 * only of_graph_parse_endpoint().
 		 * We need to check "reg" property
 		 */
-		if (of_property_present(ep,   "reg"))
-			return info.id;
 
+		/* check port first */
 		ret = of_property_present(port, "reg");
 		if (ret)
 			return info.port;
+
+		/* check endpoint 2nd as backup */
+		if (of_property_present(ep,   "reg"))
+			return info.id;
 	}
 
 	/*
-- 
2.43.0





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux