All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [PATCH 3/7] ASoC: simple-scu-card: add dai-link support
Date: Tue, 4 Dec 2018 08:20:26 +0000	[thread overview]
Message-ID: <87a7ll3e5y.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87efax3e85.wl-kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting dai-link support, but simple-scu-card
doesn't have it.
This patch support it. This is prepare for merging simple-card
and simple-scu-card.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-scu-card.c | 46 ++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 77c1efb..666ace6 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -202,14 +202,15 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
 
 {
 	struct device *dev = simple_priv_to_dev(priv);
-	struct device_node *node = dev->of_node;
+	struct device_node *top = dev->of_node;
+	struct device_node *node;
 	struct device_node *np;
 	struct device_node *codec;
 	struct snd_soc_card *card = simple_priv_to_card(priv);
 	bool is_fe;
-	int ret, i;
+	int ret, i, loop;
 
-	if (!node)
+	if (!top)
 		return -EINVAL;
 
 	ret = asoc_simple_card_of_parse_widgets(card, PREFIX);
@@ -220,25 +221,34 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
 	if (ret < 0)
 		return ret;
 
-	asoc_simple_card_parse_convert(dev, node, PREFIX, &priv->adata);
+	asoc_simple_card_parse_convert(dev, top, PREFIX, &priv->adata);
 
+	loop = 1;
 	i = 0;
-	codec = of_get_child_by_name(node, PREFIX "codec");
-	if (!codec)
-		return -ENODEV;
-
-	for_each_child_of_node(node, np) {
-		is_fe = false;
-		if (strcmp(np->name, PREFIX "cpu") == 0)
-			is_fe = true;
-
-		ret = asoc_simple_card_dai_link_of(node, np, codec, priv,
-						   i, is_fe, true);
-		if (ret < 0)
-			return ret;
-		i++;
+	node = of_get_child_by_name(top, PREFIX "dai-link");
+	if (!node) {
+		node = dev->of_node;
+		loop = 0;
 	}
 
+	do  {
+		codec = of_get_child_by_name(node,
+					     loop ? "codec" : PREFIX "codec");
+		if (!codec)
+			return -ENODEV;
+
+		for_each_child_of_node(node, np) {
+			is_fe = (np != codec);
+
+			ret = asoc_simple_card_dai_link_of(node, np, codec, priv,
+							   i, is_fe, !loop);
+			if (ret < 0)
+				return ret;
+			i++;
+		}
+		node = of_get_next_child(top, node);
+	} while (loop && node);
+
 	ret = asoc_simple_card_parse_card_name(card, PREFIX);
 	if (ret < 0)
 		return ret;
-- 
2.7.4

  parent reply	other threads:[~2018-12-04  8:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04  8:19 [PATCH 0/7] ASoC: merge simple-scu-card into simple-card - step1 Kuninori Morimoto
2018-12-04  8:19 ` [PATCH 1/7] ASoC: simple-card: use cpu/codec pointer on simple_dai_props Kuninori Morimoto
2018-12-11  1:15   ` Applied "ASoC: simple-card: use cpu/codec pointer on simple_dai_props" to the asoc tree Mark Brown
2018-12-04  8:20 ` [PATCH 2/7] ASoC: simple-scu-card: tidyup asoc_simple_card_parse_daifmt() timing Kuninori Morimoto
2018-12-04  8:20 ` Kuninori Morimoto [this message]
2018-12-11  1:12   ` [PATCH 3/7] ASoC: simple-scu-card: add dai-link support Mark Brown
2018-12-11  3:04     ` Kuninori Morimoto
2018-12-04  8:20 ` [PATCH 4/7] ASoC: simple-scu-card: care link / dai count Kuninori Morimoto
2018-12-04  8:21 ` [PATCH 5/7] ASoC: simple-scu-card: tidyup "convert-rate/channels" parsing Kuninori Morimoto
2018-12-04  8:21 ` [PATCH 6/7] ASoC: simple-scu-card: use cpu/codec pointer on graph_dai_props Kuninori Morimoto
2018-12-04  8:25 ` [PATCH 7/7] ASoC: simple-scu-card: care multi DPCM codec_conf Kuninori Morimoto

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=87a7ll3e5y.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.