alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card: cpu_dai_name creates confusion when DT case
@ 2014-02-25  6:06 Kuninori Morimoto
  2014-02-27  5:07 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2014-02-25  6:06 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto, Kuninori Morimoto

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

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()

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

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2a1b1b5..4a0e06e 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -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;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: simple-card: cpu_dai_name creates confusion when DT case
  2014-02-25  6:06 [PATCH] ASoC: simple-card: cpu_dai_name creates confusion when DT case Kuninori Morimoto
@ 2014-02-27  5:07 ` Mark Brown
  2014-02-27 10:21   ` Kuninori Morimoto
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2014-02-27  5:07 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


[-- Attachment #1.1: Type: text/plain, Size: 594 bytes --]

On Mon, Feb 24, 2014 at 10:06:09PM -0800, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 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?

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ASoC: simple-card: cpu_dai_name creates confusion when DT case
  2014-02-27  5:07 ` Mark Brown
@ 2014-02-27 10:21   ` Kuninori Morimoto
  2014-02-28  2:25     ` [PATCH v2] " Kuninori Morimoto
  0 siblings, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2014-02-27 10:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


Hi Mark

> > 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] ASoC: simple-card: cpu_dai_name creates confusion when DT case
  2014-02-27 10:21   ` Kuninori Morimoto
@ 2014-02-28  2:25     ` Kuninori Morimoto
  2014-02-28  3:53       ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2014-02-28  2:25 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto

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

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()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - for latest mark/topic/simple branch

 sound/soc/generic/simple-card.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index bdd176d..034a2b7 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -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;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ASoC: simple-card: cpu_dai_name creates confusion when DT case
  2014-02-28  2:25     ` [PATCH v2] " Kuninori Morimoto
@ 2014-02-28  3:53       ` Mark Brown
  2014-02-28  4:31         ` Kuninori Morimoto
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2014-02-28  3:53 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


[-- Attachment #1.1: Type: text/plain, Size: 265 bytes --]

On Thu, Feb 27, 2014 at 06:25:24PM -0800, Kuninori Morimoto wrote:

> +	 * 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?

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ASoC: simple-card: cpu_dai_name creates confusion when DT case
  2014-02-28  3:53       ` Mark Brown
@ 2014-02-28  4:31         ` Kuninori Morimoto
  2014-02-28  5:25           ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2014-02-28  4:31 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


Hi Mark

> > +	 * 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ASoC: simple-card: cpu_dai_name creates confusion when DT case
  2014-02-28  4:31         ` Kuninori Morimoto
@ 2014-02-28  5:25           ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-02-28  5:25 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto


[-- Attachment #1.1: Type: text/plain, Size: 290 bytes --]

On Thu, Feb 27, 2014 at 08:31:45PM -0800, Kuninori Morimoto wrote:

> 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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-28  5:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-25  6:06 [PATCH] ASoC: simple-card: cpu_dai_name creates confusion when DT case Kuninori Morimoto
2014-02-27  5:07 ` Mark Brown
2014-02-27 10:21   ` Kuninori Morimoto
2014-02-28  2:25     ` [PATCH v2] " Kuninori Morimoto
2014-02-28  3:53       ` Mark Brown
2014-02-28  4:31         ` Kuninori Morimoto
2014-02-28  5:25           ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).