[alsa-devel] [PATCH 2/2][RFC] ASoC: soc-core: no more implicit snd-soc-dummy platform on modern dai_link

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Jan 30 03:07:01 CET 2019


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

Current ALSA SoC will automatically selects snd-soc-dummy platform
by snd_soc_init_platform() if dai_link doesn't select specified platform
at legacy style dai_link.
Current ALSA SoC is supporting both "legacy style" (= xxx_name,
xxx_of_node, xxx_dai_name) and "modern style"
(= snd_soc_dai_link_component). This "implicit snd-soc-dummy platform
selection" should be prohibited on "modern style".
This patch tidyup existing glue code, and doesn't allow it on modern
style any more.

Because of these background, this patch also need to update simple
card which is only user of modern style Platfrom.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/generic/simple-card-utils.c |  4 ++++
 sound/soc/soc-core.c                  | 17 ++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 5c1424f..21cffdb1 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -399,6 +399,10 @@ void asoc_simple_card_canonicalize_platform(struct snd_soc_dai_link *dai_link)
 	/* Assumes platform == cpu */
 	if (!dai_link->platforms->of_node)
 		dai_link->platforms->of_node = dai_link->cpu_of_node;
+
+	/* select snd_soc_dummy */
+	if (!dai_link->platforms->of_node)
+		dai_link->platforms->name = "snd-soc-dummy";
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_platform);
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index cefd121..00018b0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1062,7 +1062,7 @@ static int snd_soc_init_platform(struct snd_soc_card *card,
 	    !dai_link->codec_dai_name &&
 	    !dai_link->platform_name &&
 	    !dai_link->platform_of_node)
-		goto init_end;
+		return 0;
 
 	/* convert Legacy platform link */
 	if (!platform || dai_link->legacy_platform) {
@@ -1078,13 +1078,12 @@ static int snd_soc_init_platform(struct snd_soc_card *card,
 		platform->name		  = dai_link->platform_name;
 		platform->of_node	  = dai_link->platform_of_node;
 		platform->dai_name	  = NULL;
-	}
 
-init_end:
-	/* if there's no platform we match on the empty platform */
-	if (!platform->name &&
-	    !platform->of_node)
-		platform->name = "snd-soc-dummy";
+		/* if there's no platform we match on the empty platform */
+		if (!platform->name &&
+		    !platform->of_node)
+			platform->name = "snd-soc-dummy";
+	}
 
 	return 0;
 }
@@ -1181,9 +1180,9 @@ static int soc_init_dai_link(struct snd_soc_card *card,
 			return -EINVAL;
 		}
 
-		if (link->platforms->name && link->platforms->of_node) {
+		if (!!link->platforms->name == !!link->platforms->of_node) {
 			dev_err(card->dev,
-				"ASoC: Both platform name/of_node are set for %s\n",
+				"ASoC: Neither/Both platform name/of_node are set for %s\n",
 				link->name);
 			return -EINVAL;
 		}
-- 
2.7.4



More information about the Alsa-devel mailing list