mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Subject: [PATCH 1/2] ASoC: simple-card-utils: revert port changes to follow graph binding
Date: Mon, 10 Dec 2018 18:05:56 -0800	[thread overview]
Message-ID: <20181211020557.61783-2-tony@atomide.com> (raw)
In-Reply-To: <20181211020557.61783-1-tony@atomide.com>

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@renesas.com>
Signed-off-by: Tony Lindgren <tony@atomide.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

  reply	other threads:[~2018-12-11  2:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11  2:05 [PATCH 0/2] Graph fixes for using multiple endpoints per port Tony Lindgren
2018-12-11  2:05 ` Tony Lindgren [this message]
2018-12-11  2:05 ` [PATCH 2/2] ASoC: audio-graph-card: Fix parsing of multiple endpoints Tony Lindgren
2018-12-11  3:31 ` [PATCH 0/2] Graph fixes for using multiple endpoints per port Kuninori Morimoto
2018-12-11  4:52   ` Tony Lindgren
2018-12-11  5:16     ` Kuninori Morimoto
2018-12-11  5:30       ` Kuninori Morimoto
2018-12-11  5:44         ` Tony Lindgren
2018-12-11  5:35       ` Tony Lindgren
2018-12-11  6:14         ` Kuninori Morimoto
2018-12-11 14:16           ` Tony Lindgren
2018-12-11 23:16             ` Kuninori Morimoto
2018-12-12  0:12               ` Kuninori Morimoto
2018-12-12  0:43                 ` Tony Lindgren
2018-12-12  0:50                   ` Tony Lindgren
2018-12-12  0:19               ` Tony Lindgren
2018-12-12  2:11                 ` Kuninori Morimoto
2018-12-12  6:51                   ` [alsa-devel] " Kuninori Morimoto
2018-12-12 15:27                     ` Tony Lindgren
2018-12-13  0:24                       ` Kuninori Morimoto
2018-12-13  0:40                         ` Tony Lindgren
2018-12-13  1:06                           ` Kuninori Morimoto
2018-12-13  1:13                             ` Tony Lindgren
2018-12-12 13:05                 ` Peter Ujfalusi
2018-12-12 14:50                   ` Tony Lindgren
2018-12-13  6:53                     ` Peter Ujfalusi
2018-12-13 16:55                       ` Tony Lindgren
2018-12-12 12:48         ` Peter Ujfalusi
2018-12-12 14:58           ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181211020557.61783-2-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®