summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-11-30 03:04:13 +0100
committerMark Brown <broonie@kernel.org>2018-12-04 17:28:03 +0100
commitb6f3fc005a2c8b425d7a0973b43bef05890bf479 (patch)
tree969a79165d068bd55b81cb2fe14a68b82e63ac87 /sound
parentASoC: rsnd: add missing TDM Split mode support for simple-card (diff)
downloadlinux-b6f3fc005a2c8b425d7a0973b43bef05890bf479.tar.xz
linux-b6f3fc005a2c8b425d7a0973b43bef05890bf479.zip
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card-utils.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index c69ce1e563cd..6a31d07976b9 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -269,35 +269,19 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai);
static int asoc_simple_card_get_dai_id(struct device_node *ep)
{
- struct device_node *node;
- struct device_node *endpoint;
- int i, id;
+ struct of_endpoint info;
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.
*/
- 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;
+ of_graph_parse_endpoint(ep, &info);
+ return info.port;
}
int asoc_simple_card_parse_graph_dai(struct device_node *ep,