alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* ASoC:simple-card: problem with multi-DAIs
@ 2014-09-02  7:00 Jean-Francois Moine
  2014-09-02 11:03 ` Kuninori Morimoto
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Francois Moine @ 2014-09-02  7:00 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: Linux-ALSA, Lars-Peter Clausen

Hi Kuninori,

In your patch
	ASoC: simple-card: remove dai_link->cpu_dai_name when DT
	(commit 179949bc04c7157a4b2279f62a842638b61f78f9
	 in /kernel/git/broonie/sound.git/)
you removed all 'cpu_dai_name's, and this creates problems in my system.

I have an audio controller with 2 DAIs. The audio system is defined as:

	sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "Cubox Audio";

		simple-audio-card,dai-link@0 {		/* I2S - HDMI */
			format = "i2s";
			cpu {
				sound-dai = <&audio1 0>;
			};
			codec {
				sound-dai = <&hdmi 0>;
			};
		};

		simple-audio-card,dai-link@1 {		/* S/PDIF - HDMI */
			cpu {
				sound-dai = <&audio1 1>;
			};
			codec@0 {
				sound-dai = <&hdmi 1>;
			};
		};
		...
	}

The 'cpu_of_node' of both CPU DAIs is the same ('audio1'), and only the
cpu_dai_name permits to know the CPU DAI.

But, as you removed it, both DAI links are built with the 1st CPU DAI
(I2S), and the second link (via S/PDIF) does not work.

-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: ASoC:simple-card: problem with multi-DAIs
  2014-09-02  7:00 ASoC:simple-card: problem with multi-DAIs Jean-Francois Moine
@ 2014-09-02 11:03 ` Kuninori Morimoto
  2014-09-02 11:05   ` [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case Kuninori Morimoto
  0 siblings, 1 reply; 5+ messages in thread
From: Kuninori Morimoto @ 2014-09-02 11:03 UTC (permalink / raw)
  To: Jean-Francois Moine; +Cc: Linux-ALSA, Mark Brown, Lars-Peter Clausen


Hi Jean

> I have an audio controller with 2 DAIs. The audio system is defined as:
(snip)
> The 'cpu_of_node' of both CPU DAIs is the same ('audio1'), and only the
> cpu_dai_name permits to know the CPU DAI.
> 
> But, as you removed it, both DAI links are built with the 1st CPU DAI
> (I2S), and the second link (via S/PDIF) does not work.

I guess, there were 2 problems
 1) simple-card doesn't care about multi dai-link case
 2) simple-card doesn't care <&xxx y> case

Your kernel works well before, but it seems lucky case.
The problem is not dai-link num size,
it should care cpu dai's args_count size

I will send patch

your case

Best regards
---
Kuninori Morimoto

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

* [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case
  2014-09-02 11:03 ` Kuninori Morimoto
@ 2014-09-02 11:05   ` Kuninori Morimoto
  2014-09-02 18:00     ` Jean-Francois Moine
  2014-09-03 12:54     ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2014-09-02 11:05 UTC (permalink / raw)
  To: Jean-Francois Moine, Mark Brown; +Cc: Linux-ALSA, Lars-Peter Clausen

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

f687d900d30a61dda38db2a99239f5284a86a309
(ASoC: simple-card: cpu_dai_name creates confusion when DT case)
cleared cpu_dai_name for caring fmt_single_name case,
and
179949bc04c7157a4b2279f62a842638b61f78f9
(ASoC: simple-card: remove dai_link->cpu_dai_name when DT)
cared multi dai-link case.
but, cpu_dai_name matching is required when fmt_multiple_name was used

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

Can you please test this patch ?
Is your issue solved ?

 sound/soc/generic/simple-card.c |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index fd8b045..b63860d 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -112,8 +112,10 @@ static int
 asoc_simple_card_sub_parse_of(struct device_node *np,
 			      struct asoc_simple_dai *dai,
 			      struct device_node **p_node,
-			      const char **name)
+			      const char **name,
+			      int *args_count)
 {
+	struct of_phandle_args args;
 	struct device_node *node;
 	struct clk *clk;
 	u32 val;
@@ -123,10 +125,15 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	 * get node via "sound-dai = <&phandle port>"
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
 	 */
-	node = of_parse_phandle(np, "sound-dai", 0);
-	if (!node)
-		return -ENODEV;
-	*p_node = node;
+	ret = of_parse_phandle_with_args(np, "sound-dai",
+					 "#sound-dai-cells", 0, &args);
+	if (ret)
+		return ret;
+
+	*p_node = args.np;
+
+	if (args_count)
+		*args_count = args.args_count;
 
 	/* get dai->name */
 	ret = snd_soc_of_get_dai_name(np, name);
@@ -176,7 +183,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	char *name;
 	char prop[128];
 	char *prefix = "";
-	int ret;
+	int ret, cpu_args;
 
 	if (is_top_level_node)
 		prefix = "simple-audio-card,";
@@ -195,7 +202,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 
 	ret = asoc_simple_card_sub_parse_of(np, &dai_props->cpu_dai,
 					    &dai_link->cpu_of_node,
-					    &dai_link->cpu_dai_name);
+					    &dai_link->cpu_dai_name,
+					    &cpu_args);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -226,7 +234,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 
 	ret = asoc_simple_card_sub_parse_of(np, &dai_props->codec_dai,
 					    &dai_link->codec_of_node,
-					    &dai_link->codec_dai_name);
+					    &dai_link->codec_dai_name, NULL);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -290,12 +298,13 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	 * 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.
+	 * remove cpu_dai_name if cpu_args was 0.
 	 * see
 	 *	fmt_single_name()
 	 *	fmt_multiple_name()
 	 */
-	dai_link->cpu_dai_name = NULL;
+	if (!cpu_args)
+		dai_link->cpu_dai_name = NULL;
 
 dai_link_of_err:
 	if (np)
-- 
1.7.9.5

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

* Re: [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case
  2014-09-02 11:05   ` [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case Kuninori Morimoto
@ 2014-09-02 18:00     ` Jean-Francois Moine
  2014-09-03 12:54     ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Francois Moine @ 2014-09-02 18:00 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown, Lars-Peter Clausen

On Tue, 02 Sep 2014 04:05:30 -0700 (PDT)
Kuninori Morimoto <kuninori.morimoto.gx@gmail.com> wrote:

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> f687d900d30a61dda38db2a99239f5284a86a309
> (ASoC: simple-card: cpu_dai_name creates confusion when DT case)
> cleared cpu_dai_name for caring fmt_single_name case,
> and
> 179949bc04c7157a4b2279f62a842638b61f78f9
> (ASoC: simple-card: remove dai_link->cpu_dai_name when DT)
> cared multi dai-link case.
> but, cpu_dai_name matching is required when fmt_multiple_name was used
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> >> Jean  
> 
> Can you please test this patch ?
> Is your issue solved ?
> 
>  sound/soc/generic/simple-card.c |   29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)

Everything works fine. Thanks.

Tested-by: Jean-Francois Moine <moinejf@free.fr>

-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case
  2014-09-02 11:05   ` [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case Kuninori Morimoto
  2014-09-02 18:00     ` Jean-Francois Moine
@ 2014-09-03 12:54     ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-09-03 12:54 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Jean-Francois Moine, Linux-ALSA, Lars-Peter Clausen


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

On Tue, Sep 02, 2014 at 04:05:30AM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> f687d900d30a61dda38db2a99239f5284a86a309
> (ASoC: simple-card: cpu_dai_name creates confusion when DT case)
> cleared cpu_dai_name for caring fmt_single_name case,
> and

Applied, thanks.

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

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



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

end of thread, other threads:[~2014-09-03 12:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-02  7:00 ASoC:simple-card: problem with multi-DAIs Jean-Francois Moine
2014-09-02 11:03 ` Kuninori Morimoto
2014-09-02 11:05   ` [PATCH][RFC] ASoC: simple-card: fixup cpu_dai_name clear case Kuninori Morimoto
2014-09-02 18:00     ` Jean-Francois Moine
2014-09-03 12:54     ` 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).