[alsa-devel] [PATCH 3/3] ASoC: audio-graph-scu-card: use asoc_simple_card_of_canonicalize_cpu()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Jun 21 05:53:16 CEST 2017


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

snd_soc_find_dai() will check dai_name after of_node matching
if dai_link has it. but, it will never match if name was
created by fmt_single_name(). Thus, we need to remove cpu_dai_name
if cpu was single.

Before, simple-card assumed that CPU was single if Card has single
link. It is no problem in below case

/* Card uses 1 link */
card {
	compatible = "audio-graph-card";
	...
	dais = <&cpu_port0>;
};

/* CPU has single endpoints */
cpu {
	...
	cpu_port0: port at 0 {
		endpoint { ... };
	};
};

But it can't handle correctly below case.
This patch uses new asoc_simple_card_of_canonicalize_cpu() and
confirm it was single or not by counting endpoint.

/* Card uses only 1 link */
card {
	compatible = "audio-graph-card";
	...
	dais = <&cpu_port0>;
};

/* CPU has many endpoints */
cpu {
	...
	ports {
		cpu_port0: port at 0 {
			endpoint { ... };
		};
		cpu_port1: port at 1 {
			endpoint { ... };
		};
		...
	};
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/generic/audio-graph-scu-card.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index 05934b2..bd924b1 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -123,9 +123,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *ep,
 		if (ret < 0)
 			return ret;
 
-		/* card->num_links includes Codec */
-		asoc_simple_card_canonicalize_cpu(dai_link,
-					(card->num_links - 1) == 1);
+		asoc_simple_card_of_canonicalize_cpu(dai_link);
 	} else {
 		/* FE is dummy */
 		dai_link->cpu_of_node		= NULL;
-- 
1.9.1



More information about the Alsa-devel mailing list