Skip to contentSkip to conversation

ASoC: simple-card: cpu_dai_name creates confusion when DT case

PATCH Superseded Kuninori Morimoto 2 participants 7 messages Feb 25, 2014 – Feb 28, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: simple-card: cpu_dai_name creates confusion when DT case

From: Kuninori Morimoto <[email protected]>

Basically, soc_bind_dai_link() checks cpu_dai->dev->of_node and dai_link->cpu_of_node in DT case. But after that it will check
cpu_dai->name and dai_link->cpu_dai_name too.

On the other hand, snd_soc_dai :: name is created by fmt_single_name() or fmt_multiple_name().

There is no confusion if dai name is created by fmt_multiple_name(), since cpu_dai->name is same as dai_link->cpu_dai_name.
but, if dai name is created by fmt_single_name(), CPU DAI never match.

Thus, simple-card not set dai_link->cpu_dai_name if DT case to skip naming match on soc_bind_dai_link()

---
 sound/soc/generic/simple-card.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/generic/simple-card.c +2 -1
index 2a1b1b5..4a0e06e 100644
@@ -242,7 +242,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	 */
 	cinfo->snd_link.name		= cinfo->name;
 	cinfo->snd_link.stream_name	= cinfo->name;
-	cinfo->snd_link.cpu_dai_name	= cinfo->cpu_dai.name;
+	if (!of_cpu)
+		cinfo->snd_link.cpu_dai_name	= cinfo->cpu_dai.name;
 	cinfo->snd_link.platform_name	= cinfo->platform;
 	cinfo->snd_link.codec_name	= cinfo->codec;
 	cinfo->snd_link.codec_dai_name	= cinfo->codec_dai.name;
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 9 lines · Kuninori Morimoto

From: Kuninori Morimoto <[email protected]>

Basically, soc_bind_dai_link() checks cpu_dai->dev->of_node and dai_link->cpu_of_node in DT case. But after that it will check
cpu_dai->name and dai_link->cpu_dai_name too.

On the other hand, snd_soc_dai :: name is created by fmt_single_name() or fmt_multiple_name().

This looks like a valid issue which still affects current code but it doesn't apply due changes on the latest topic/simple branch. Can you please check and resend?

#2 lore raw

Hi Mark

Quoted 11 lines
Quoted 7 lines

Basically, soc_bind_dai_link() checks cpu_dai->dev->of_node and dai_link->cpu_of_node in DT case. But after that it will check
cpu_dai->name and dai_link->cpu_dai_name too.

On the other hand, snd_soc_dai :: name is created by fmt_single_name() or fmt_multiple_name().

This looks like a valid issue which still affects current code but it doesn't apply due changes on the latest topic/simple branch. Can you please check and resend?

OK
I will send it again tomorrow.
Thank you

#3 lore raw

PATCH v2 1/1 ASoC: simple-card: cpu_dai_name creates confusion when DT case

From: Kuninori Morimoto <[email protected]>

Basically, soc_bind_dai_link() checks cpu_dai->dev->of_node and dai_link->cpu_of_node in DT case. But after that it will check
cpu_dai->name and dai_link->cpu_dai_name too.

On the other hand, snd_soc_dai :: name is created by fmt_single_name() or fmt_multiple_name().

There is no confusion if dai name is created by fmt_multiple_name(), since cpu_dai->name is same as dai_link->cpu_dai_name.
but, if dai name is created by fmt_single_name(), CPU DAI never match.

Thus, simple-card not set dai_link->cpu_dai_name if DT case to skip naming match on soc_bind_dai_link()

---
v1 -> v2

- for latest mark/topic/simple branch

 sound/soc/generic/simple-card.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
sound/soc/generic/simple-card.c +11 -0
index bdd176d..034a2b7 100644
@@ -234,6 +234,17 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 		priv->codec_dai.fmt,
 		priv->codec_dai.sysclk);
 
+	/*
+	 * soc_bind_dai_link() will check cpu name
+	 * after of_node matching if dai_link has cpu_dai_name.
+	 * but, it will never match if name was created by fmt_single_name()
+	 * remove cpu_dai_name to escape name matching.
+	 * see
+	 *	fmt_single_name()
+	 *	fmt_multiple_name()
+	 */
+	dai_link->cpu_dai_name = NULL;
+
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
maintainer
#4 lore raw

sound/soc/generic/simple-card.c static int asoc_simple_card_parse_of(struct device_node *node, · line 247

Quoted 6 lines · Kuninori Morimoto
sound/soc/generic/simple-card.c +6 -0
+	 * see
+	 *	fmt_single_name()
+	 *	fmt_multiple_name()
+	 */
+	dai_link->cpu_dai_name = NULL;
+

Why do this by overwriting rather than at the point where the variable gets assigned?

#5 lore raw

Hi Mark

Quoted 9 lines

sound/soc/generic/simple-card.c static int asoc_simple_card_parse_of(struct device_node *node, · line 247

Quoted 6 lines
sound/soc/generic/simple-card.c +6 -0
+	 * see
+	 *	fmt_single_name()
+	 *	fmt_multiple_name()
+	 */
+	dai_link->cpu_dai_name = NULL;
+

Why do this by overwriting rather than at the point where the variable gets assigned?

Do you mean why I did it end of asoc_simple_card_parse_of() ? Because this cpu_dai_name itself is used for dai_link->name, dai_link->stream_name;
This patch set NULL after that.

maintainer
#6 lore raw
Quoted 4 lines · Kuninori Morimoto

Do you mean why I did it end of asoc_simple_card_parse_of() ? Because this cpu_dai_name itself is used for dai_link->name, dai_link->stream_name;
This patch set NULL after that.

OK, makes sense. Applied, thanks.