[alsa-devel] [PATCH][RFC] ASoC: soc-core: remove regacy dai_link binding method

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Jan 16 09:27:44 CET 2019


Legacy ALSA SoC used these name matching
	xxx_name
	xxx_of_node
	xxx_dai_name

Now we can use snd_soc_dai_link_component instead of it.
No one is using legacy style now, let's remove these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 include/sound/soc.h  |  17 --------
 sound/soc/soc-core.c | 121 +--------------------------------------------------
 2 files changed, 1 insertion(+), 137 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 213187e..b6dd33a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -898,15 +898,11 @@ struct snd_soc_dai_link {
 	 * must be globally unique. These fields are currently typically used
 	 * only for codec to codec links, or systems using device tree.
 	 */
-	const char *cpu_name;
-	struct device_node *cpu_of_node;
 	/*
 	 * You MAY specify the DAI name of the CPU DAI. If this information is
 	 * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node
 	 * only, which only works well when that device exposes a single DAI.
 	 */
-	const char *cpu_dai_name;
-
 	struct snd_soc_dai_link_component *cpus;
 	unsigned int num_cpus;
 
@@ -914,11 +910,7 @@ struct snd_soc_dai_link {
 	 * You MUST specify the link's codec, either by device name, or by
 	 * DT/OF node, but not both.
 	 */
-	const char *codec_name;
-	struct device_node *codec_of_node;
 	/* You MUST specify the DAI name within the codec */
-	const char *codec_dai_name;
-
 	struct snd_soc_dai_link_component *codecs;
 	unsigned int num_codecs;
 
@@ -927,8 +919,6 @@ struct snd_soc_dai_link {
 	 * device name, or by DT/OF node, but not both. Some forms of link
 	 * do not need a platform.
 	 */
-	const char *platform_name;
-	struct device_node *platform_of_node;
 	struct snd_soc_dai_link_component *platforms;
 	unsigned int num_platforms;
 
@@ -990,13 +980,6 @@ struct snd_soc_dai_link {
 	/* Do not create a PCM for this DAI link (Backend link) */
 	unsigned int ignore:1;
 
-	/*
-	 * This driver uses legacy platform naming. Set by the core, machine
-	 * drivers should not modify this value.
-	 */
-	unsigned int legacy_platform:1;
-	unsigned int legacy_cpu:1;
-
 	struct list_head list; /* DAI link list of the soc card */
 	struct snd_soc_dobj dobj; /* For topology */
 };
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b782f19..f41c9ab 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1029,126 +1029,12 @@ static void soc_remove_dai_links(struct snd_soc_card *card)
 	}
 }
 
-static int snd_soc_init_cpu(struct snd_soc_card *card,
-			    struct snd_soc_dai_link *dai_link)
-{
-	struct snd_soc_dai_link_component *cpu = dai_link->cpus;
-
-	/*
-	 * FIXME
-	 *
-	 * this function should be removed in the future
-	 */
-	/* convert Legacy platform link */
-	if (!cpu || dai_link->legacy_cpu) {
-		cpu = devm_kzalloc(card->dev,
-				   sizeof(struct snd_soc_dai_link_component),
-				   GFP_KERNEL);
-		if (!cpu)
-			return -ENOMEM;
-
-		dai_link->cpus		= cpu;
-		dai_link->num_cpus	= 1;
-		dai_link->legacy_cpu	= 1;
-
-		cpu->name	= dai_link->cpu_name;
-		cpu->of_node	= dai_link->cpu_of_node;
-		cpu->dai_name	= dai_link->cpu_dai_name;
-	}
-
-	if (!dai_link->cpus) {
-		dev_err(card->dev, "ASoC: DAI link has no CPUs\n");
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int snd_soc_init_platform(struct snd_soc_card *card,
-				 struct snd_soc_dai_link *dai_link)
-{
-	struct snd_soc_dai_link_component *platform = dai_link->platforms;
-
-	/*
-	 * FIXME
-	 *
-	 * this function should be removed in the future
-	 */
-	/* convert Legacy platform link */
-	if (!platform || dai_link->legacy_platform) {
-		platform = devm_kzalloc(card->dev,
-				sizeof(struct snd_soc_dai_link_component),
-				GFP_KERNEL);
-		if (!platform)
-			return -ENOMEM;
-
-		dai_link->platforms	  = platform;
-		dai_link->num_platforms	  = 1;
-		dai_link->legacy_platform = 1;
-		platform->name		  = dai_link->platform_name;
-		platform->of_node	  = dai_link->platform_of_node;
-		platform->dai_name	  = NULL;
-	}
-
-	/* if there's no platform we match on the empty platform */
-	if (!platform->name &&
-	    !platform->of_node)
-		platform->name = "snd-soc-dummy";
-
-	return 0;
-}
-
-static int snd_soc_init_multicodec(struct snd_soc_card *card,
-				   struct snd_soc_dai_link *dai_link)
-{
-	/* Legacy codec/codec_dai link is a single entry in multicodec */
-	if (dai_link->codec_name || dai_link->codec_of_node ||
-	    dai_link->codec_dai_name) {
-		dai_link->num_codecs = 1;
-
-		dai_link->codecs = devm_kzalloc(card->dev,
-				sizeof(struct snd_soc_dai_link_component),
-				GFP_KERNEL);
-		if (!dai_link->codecs)
-			return -ENOMEM;
-
-		dai_link->codecs[0].name = dai_link->codec_name;
-		dai_link->codecs[0].of_node = dai_link->codec_of_node;
-		dai_link->codecs[0].dai_name = dai_link->codec_dai_name;
-	}
-
-	if (!dai_link->codecs) {
-		dev_err(card->dev, "ASoC: DAI link has no CODECs\n");
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static int soc_init_dai_link(struct snd_soc_card *card,
 			     struct snd_soc_dai_link *link)
 {
-	int i, ret;
+	int i;
 	struct snd_soc_dai_link_component *codec;
 
-	ret = snd_soc_init_cpu(card, link);
-	if (ret) {
-		dev_err(card->dev, "ASoC: failed to init cpu\n");
-		return ret;
-	}
-
-	ret = snd_soc_init_platform(card, link);
-	if (ret) {
-		dev_err(card->dev, "ASoC: failed to init multiplatform\n");
-		return ret;
-	}
-
-	ret = snd_soc_init_multicodec(card, link);
-	if (ret) {
-		dev_err(card->dev, "ASoC: failed to init multicodec\n");
-		return ret;
-	}
-
 	for_each_link_codecs(link, i, codec) {
 		/*
 		 * Codec must be specified by 1 of name or OF node,
@@ -1993,11 +1879,6 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)
 			dev_info(card->dev, "info: override FE DAI link %s\n",
 				 card->dai_link[i].name);
 
-			/* override platform component */
-			if (snd_soc_init_platform(card, dai_link) < 0) {
-				dev_err(card->dev, "init platform error");
-				continue;
-			}
 			dai_link->platforms->name = component->name;
 
 			/* convert non BE into BE */
-- 
2.7.4



More information about the Alsa-devel mailing list