[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181211020557.61783-2-tony@atomide.com>
Date: Mon, 10 Dec 2018 18:05:56 -0800
From: Tony Lindgren <tony@...mide.com>
To: Mark Brown <broonie@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Subject: [PATCH 1/2] ASoC: simple-card-utils: revert port changes to follow graph binding
Commit b6f3fc005a2c ("ASoC: simple-card-utils: fixup
asoc_simple_card_get_dai_id() counting") changed endpoint parsing for
asoc_simple_card_get_dai_id(), but it seems the old code is correct.
This code should follow the generic binding documentation for
Documentation/devicetree/bindings/graph.txt that allows multiple
endpoints for each port.
Cc: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Signed-off-by: Tony Lindgren <tony@...mide.com>
---
sound/soc/generic/simple-card-utils.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -269,19 +269,35 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai);
static int asoc_simple_card_get_dai_id(struct device_node *ep)
{
- struct of_endpoint info;
+ struct device_node *node;
+ struct device_node *endpoint;
+ int i, id;
int ret;
ret = snd_soc_get_dai_id(ep);
if (ret != -ENOTSUPP)
return ret;
+ node = of_graph_get_port_parent(ep);
+
/*
* Non HDMI sound case, counting port/endpoint on its DT
* is enough. Let's count it.
*/
- of_graph_parse_endpoint(ep, &info);
- return info.port;
+ i = 0;
+ id = -1;
+ for_each_endpoint_of_node(node, endpoint) {
+ if (endpoint == ep)
+ id = i;
+ i++;
+ }
+
+ of_node_put(node);
+
+ if (id < 0)
+ return -ENODEV;
+
+ return id;
}
int asoc_simple_card_parse_graph_dai(struct device_node *ep,
--
2.19.2
Powered by blists - more mailing lists