Commit b6f3fc00 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() counting

asoc_simple_card_get_dai_id() returns DAI ID, but it is based on
DT node's "endpoint" position.
Almost all cases 1 port has 1 endpoint, thus, it was no problem.
But in reality, port : endpoint = 1 : N, thus, counting endpoint
is BUG, it should based on "port" ID.
This patch fixup it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 538a4ffe
...@@ -269,35 +269,19 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai); ...@@ -269,35 +269,19 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai);
static int asoc_simple_card_get_dai_id(struct device_node *ep) static int asoc_simple_card_get_dai_id(struct device_node *ep)
{ {
struct device_node *node; struct of_endpoint info;
struct device_node *endpoint;
int i, id;
int ret; int ret;
ret = snd_soc_get_dai_id(ep); ret = snd_soc_get_dai_id(ep);
if (ret != -ENOTSUPP) if (ret != -ENOTSUPP)
return ret; return ret;
node = of_graph_get_port_parent(ep);
/* /*
* Non HDMI sound case, counting port/endpoint on its DT * Non HDMI sound case, counting port/endpoint on its DT
* is enough. Let's count it. * is enough. Let's count it.
*/ */
i = 0; of_graph_parse_endpoint(ep, &info);
id = -1; return info.port;
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, int asoc_simple_card_parse_graph_dai(struct device_node *ep,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment