All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card
@ 2018-08-20  5:09 Kuninori Morimoto
  2018-08-20  5:11 ` [PATCH 01/15][RFC] ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec Kuninori Morimoto
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:09 UTC (permalink / raw)
  To: Linux-ALSA


Hi Mark

I think ALSA SoC framework needs more update for modern style
As 1st step, codec/plaform are updated/converted to component style.
I think 2nd step is DAI/dai_link matching.
We want to use snd_soc_dai_link_component style instead of
legacy style for dai_link matching for CPU/Codec/Platform.
like this.

	[current]
	struct snd_soc_dai_link {
		...
		*cpu_name;
		*cpu_of_node;
		*cpu_dai_name;

		*codec_name;
		*codec_of_node;
		*codec_dai_name;
		*codecs;
		num_codecs;

		*platform_name;
		*platform_of_node;
		...
	}

	[we want]
	struct snd_soc_dai_link {
		...
		*cpus
		num_cpus;

		*codecs;
		num_codecs;

		*platform;
		...
	}

Above sample is still using CPU/Codec/Platform.
We can merge it into same snd_soc_dai_link_component list
if someone wants it. But anyway, CPU/Codec/Platform style
is not so bad, so far.

It will be more useful/simple code if we can use
snd_soc_dai_link_component for DAI instead of
xxx_name / xxx_of_node / xxx_dai_name.

Currently, only Codec is supporting/using snd_soc_dai_link_component
style. But we want to use it for CPU/Platform, too.
I know Shreyas is posting multi CPU style, then, it can support
snd_soc_dai_link_component style.

Using snd_soc_dai_link_component style for Platform is not difficult
I think. [09/15] patch add it on soc-core.
But, I can't test for all boards/platforms, thus,
I added [RFC] for these patches.

Now, we are still missing CPU part, but can use it for Codec/Platform.
These patches use it on simple/audio cards for Codec/Platform.
If these are OK, and if we could have CPU support in the future,
we can convert current legacy style to snd_soc_dai_link_component style
for all sound cards.

 1) -  8) use snd_soc_dai_link_component for Codec    on simple/audio card
 9) - 15) use snd_soc_dai_link_component for Platform on simple/audio card

Kuninori Morimoto (15):
   1) ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec
   2) ASoC: simple-card: support snd_soc_dai_link_component style for codec
   3) ASoC: simple-scu-card: use simple_dai_props
   4) ASoC: simple-scu-card: support snd_soc_dai_link_component style for codec
   5) ASoC: audio-graph-card: support snd_soc_dai_link_component style for codec
   6) ASoC: audio-graph-scu-card: use simple_dai_props
   7) ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec
   8) ASoC: simple-card-util: remove dai_link compatible code for codec
   9) ASoC: soc-core: use snd_soc_dai_link_component for platform
  10) ASoC: simple-card-util: support snd_soc_dai_link_component style for platform
  11) ASoC: simple-card: support snd_soc_dai_link_component style for platform
  12) ASoC: simple-scu-card: support snd_soc_dai_link_component style for platform
  13) ASoC: audio-graph-card: support snd_soc_dai_link_component style for platform
  14) ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for platform
  15) ASoC: simple-card-util: remove dai_link compatible code for platform

 include/sound/simple_card_utils.h        | 27 ++++++++++------
 include/sound/soc.h                      |  2 ++
 sound/soc/generic/audio-graph-card.c     | 18 +++++++++--
 sound/soc/generic/audio-graph-scu-card.c | 55 +++++++++++++++++++++-----------
 sound/soc/generic/simple-card-utils.c    | 47 ++++++++++++++++++++++++---
 sound/soc/generic/simple-card.c          | 30 ++++++++++++++---
 sound/soc/generic/simple-scu-card.c      | 54 ++++++++++++++++++++-----------
 sound/soc/soc-core.c                     | 48 ++++++++++++++++++++++++----
 8 files changed, 217 insertions(+), 64 deletions(-)

--
2.7.4

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

* [PATCH 01/15][RFC] ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
@ 2018-08-20  5:11 ` Kuninori Morimoto
  2018-08-20  5:11 ` [PATCH 02/15][RFC] ASoC: simple-card: " Kuninori Morimoto
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple_card_utils for codec.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_utils.h     | 27 ++++++++++++++--------
 sound/soc/generic/simple-card-utils.c | 42 +++++++++++++++++++++++++++++++++--
 2 files changed, 58 insertions(+), 11 deletions(-)

diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index 8bc5e2d..3b5bd6e 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -51,29 +51,35 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 
 #define asoc_simple_card_parse_clk_cpu(dev, node, dai_link, simple_dai)		\
 	asoc_simple_card_parse_clk(dev, node, dai_link->cpu_of_node, simple_dai, \
-				   dai_link->cpu_dai_name)
+				   dai_link->cpu_dai_name, NULL)
 #define asoc_simple_card_parse_clk_codec(dev, node, dai_link, simple_dai)	\
 	asoc_simple_card_parse_clk(dev, node, dai_link->codec_of_node, simple_dai,\
-				   dai_link->codec_dai_name)
+				   dai_link->codec_dai_name, dai_link->codecs)
 int asoc_simple_card_parse_clk(struct device *dev,
 			       struct device_node *node,
 			       struct device_node *dai_of_node,
 			       struct asoc_simple_dai *simple_dai,
-			       const char *name);
+			       const char *dai_name,
+			       struct snd_soc_dai_link_component *dlc);
 int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai);
 void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai);
 
 #define asoc_simple_card_parse_cpu(node, dai_link,				\
 				   list_name, cells_name, is_single_link)	\
-	asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node,		\
+	asoc_simple_card_parse_dai(node, NULL,					\
+		&dai_link->cpu_of_node,						\
 		&dai_link->cpu_dai_name, list_name, cells_name, is_single_link)
 #define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name)	\
-	asoc_simple_card_parse_dai(node, &dai_link->codec_of_node,		\
-		&dai_link->codec_dai_name, list_name, cells_name, NULL)
+	asoc_simple_card_parse_dai(node, dai_link->codecs,			\
+				   &dai_link->codec_of_node,			\
+				   &dai_link->codec_dai_name,			\
+				   list_name, cells_name, NULL)
 #define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name)	\
-	asoc_simple_card_parse_dai(node, &dai_link->platform_of_node,		\
+	asoc_simple_card_parse_dai(node, NULL,					\
+		&dai_link->platform_of_node,					\
 		NULL, list_name, cells_name, NULL)
 int asoc_simple_card_parse_dai(struct device_node *node,
+				  struct snd_soc_dai_link_component *dlc,
 				  struct device_node **endpoint_np,
 				  const char **dai_name,
 				  const char *list_name,
@@ -81,12 +87,15 @@ int asoc_simple_card_parse_dai(struct device_node *node,
 				  int *is_single_links);
 
 #define asoc_simple_card_parse_graph_cpu(ep, dai_link)			\
-	asoc_simple_card_parse_graph_dai(ep, &dai_link->cpu_of_node,	\
+	asoc_simple_card_parse_graph_dai(ep, NULL,			\
+					 &dai_link->cpu_of_node,	\
 					 &dai_link->cpu_dai_name)
 #define asoc_simple_card_parse_graph_codec(ep, dai_link)		\
-	asoc_simple_card_parse_graph_dai(ep, &dai_link->codec_of_node,	\
+	asoc_simple_card_parse_graph_dai(ep, dai_link->codecs,		\
+					 &dai_link->codec_of_node,	\
 					 &dai_link->codec_dai_name)
 int asoc_simple_card_parse_graph_dai(struct device_node *ep,
+				     struct snd_soc_dai_link_component *dlc,
 				     struct device_node **endpoint_np,
 				     const char **dai_name);
 
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index d3f3f0f..73c0a90 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -173,12 +173,24 @@ int asoc_simple_card_parse_clk(struct device *dev,
 			       struct device_node *node,
 			       struct device_node *dai_of_node,
 			       struct asoc_simple_dai *simple_dai,
-			       const char *name)
+			       const char *dai_name,
+			       struct snd_soc_dai_link_component *dlc)
 {
 	struct clk *clk;
 	u32 val;
 
 	/*
+	 * Use snd_soc_dai_link_component instead of legacy style.
+	 * It is only for codec, but cpu will be supported in the future.
+	 * see
+	 *	soc-core.c :: snd_soc_init_multicodec()
+	 */
+	if (dlc) {
+		dai_of_node	= dlc->of_node;
+		dai_name	= dlc->dai_name;
+	}
+
+	/*
 	 * Parse dai->sysclk come from "clocks = <&xxx>"
 	 * (if system has common clock)
 	 *  or "system-clock-frequency = <xxx>"
@@ -200,7 +212,7 @@ int asoc_simple_card_parse_clk(struct device *dev,
 	if (of_property_read_bool(node, "system-clock-direction-out"))
 		simple_dai->clk_direction = SND_SOC_CLOCK_OUT;
 
-	dev_dbg(dev, "%s : sysclk = %d, direction %d\n", name,
+	dev_dbg(dev, "%s : sysclk = %d, direction %d\n", dai_name,
 		simple_dai->sysclk, simple_dai->clk_direction);
 
 	return 0;
@@ -208,6 +220,7 @@ int asoc_simple_card_parse_clk(struct device *dev,
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk);
 
 int asoc_simple_card_parse_dai(struct device_node *node,
+				    struct snd_soc_dai_link_component *dlc,
 				    struct device_node **dai_of_node,
 				    const char **dai_name,
 				    const char *list_name,
@@ -221,6 +234,17 @@ int asoc_simple_card_parse_dai(struct device_node *node,
 		return 0;
 
 	/*
+	 * Use snd_soc_dai_link_component instead of legacy style.
+	 * It is only for codec, but cpu will be supported in the future.
+	 * see
+	 *	soc-core.c :: snd_soc_init_multicodec()
+	 */
+	if (dlc) {
+		dai_name	= &dlc->dai_name;
+		dai_of_node	= &dlc->of_node;
+	}
+
+	/*
 	 * Get node via "sound-dai = <&phandle port>"
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
 	 */
@@ -278,6 +302,7 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep)
 }
 
 int asoc_simple_card_parse_graph_dai(struct device_node *ep,
+				     struct snd_soc_dai_link_component *dlc,
 				     struct device_node **dai_of_node,
 				     const char **dai_name)
 {
@@ -285,6 +310,17 @@ int asoc_simple_card_parse_graph_dai(struct device_node *ep,
 	struct of_phandle_args args;
 	int ret;
 
+	/*
+	 * Use snd_soc_dai_link_component instead of legacy style.
+	 * It is only for codec, but cpu will be supported in the future.
+	 * see
+	 *	soc-core.c :: snd_soc_init_multicodec()
+	 */
+	if (dlc) {
+		dai_name	= &dlc->dai_name;
+		dai_of_node	= &dlc->of_node;
+	}
+
 	if (!ep)
 		return 0;
 	if (!dai_name)
@@ -374,6 +410,8 @@ int asoc_simple_card_clean_reference(struct snd_soc_card *card)
 	     num_links++, dai_link++) {
 		of_node_put(dai_link->cpu_of_node);
 		of_node_put(dai_link->codec_of_node);
+		if (dai_link->codecs)
+			of_node_put(dai_link->codecs->of_node);
 	}
 	return 0;
 }
-- 
2.7.4

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

* [PATCH 02/15][RFC] ASoC: simple-card: support snd_soc_dai_link_component style for codec
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
  2018-08-20  5:11 ` [PATCH 01/15][RFC] ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec Kuninori Morimoto
@ 2018-08-20  5:11 ` Kuninori Morimoto
  2018-08-20  5:11 ` [PATCH 03/15][RFC] ASoC: simple-scu-card: use simple_dai_props Kuninori Morimoto
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card for codec.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 64bf356..dd67516 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -20,6 +20,7 @@ struct simple_card_data {
 	struct simple_dai_props {
 		struct asoc_simple_dai cpu_dai;
 		struct asoc_simple_dai codec_dai;
+		struct snd_soc_dai_link_component codecs; /* single codec */
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
@@ -234,7 +235,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	ret = asoc_simple_card_set_dailink_name(dev, dai_link,
 						"%s-%s",
 						dai_link->cpu_dai_name,
-						dai_link->codec_dai_name);
+						dai_link->codecs->dai_name);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -363,7 +364,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct snd_soc_card *card;
-	int num, ret;
+	int num, ret, i;
 
 	/* Get the number of DAI links */
 	if (np && of_get_child_by_name(np, PREFIX "dai-link"))
@@ -381,6 +382,17 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	if (!dai_props || !dai_link)
 		return -ENOMEM;
 
+	/*
+	 * Use snd_soc_dai_link_component instead of legacy style
+	 * It is codec only. but cpu/platform will be supported in the future.
+	 * see
+	 *	soc-core.c :: snd_soc_init_multicodec()
+	 */
+	for (i = 0; i < num; i++) {
+		dai_link[i].codecs	= &dai_props[i].codecs;
+		dai_link[i].num_codecs	= 1;
+	}
+
 	priv->dai_props			= dai_props;
 	priv->dai_link			= dai_link;
 
@@ -403,6 +415,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 
 	} else {
 		struct asoc_simple_card_info *cinfo;
+		struct snd_soc_dai_link_component *codecs;
 
 		cinfo = dev->platform_data;
 		if (!cinfo) {
@@ -419,13 +432,15 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 			return -EINVAL;
 		}
 
+		codecs			= &dai_props->codecs;
+		codecs->name		= cinfo->codec;
+		codecs->dai_name	= cinfo->codec_dai.name;
+
 		card->name		= (cinfo->card) ? cinfo->card : cinfo->name;
 		dai_link->name		= cinfo->name;
 		dai_link->stream_name	= cinfo->name;
 		dai_link->platform_name	= cinfo->platform;
-		dai_link->codec_name	= cinfo->codec;
 		dai_link->cpu_dai_name	= cinfo->cpu_dai.name;
-		dai_link->codec_dai_name = cinfo->codec_dai.name;
 		dai_link->dai_fmt	= cinfo->daifmt;
 		dai_link->init		= asoc_simple_card_dai_init;
 		memcpy(&priv->dai_props->cpu_dai, &cinfo->cpu_dai,
-- 
2.7.4

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

* [PATCH 03/15][RFC] ASoC: simple-scu-card: use simple_dai_props
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
  2018-08-20  5:11 ` [PATCH 01/15][RFC] ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec Kuninori Morimoto
  2018-08-20  5:11 ` [PATCH 02/15][RFC] ASoC: simple-card: " Kuninori Morimoto
@ 2018-08-20  5:11 ` Kuninori Morimoto
  2018-08-20  5:12 ` [PATCH 04/15][RFC] ASoC: simple-scu-card: support snd_soc_dai_link_component style for codec Kuninori Morimoto
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


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

simple-card and simple-scu-card are very similar driver,
but using different feature. Thus we are keeping synchronization
on these 2 drivers style, because it is easy to confirm / check.

Current big difference between these 2 drivers are "dai_props" on
simple_card_data (= priv).
It will be difficult to keep synchronize if we will add new feature
on simple-scu-card. Thus, this patch synchronize it.

[simple]
struct simple_card_data {
	...
	struct simple_dai_props {
		...
	} *dai_props;
	...
};

[simple scu]
struct simple_card_data {
	...
	struct asoc_simple_dai *dai_props;
	...
};

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

diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 16a83bc..09be02e 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -22,7 +22,9 @@
 struct simple_card_data {
 	struct snd_soc_card snd_card;
 	struct snd_soc_codec_conf codec_conf;
-	struct asoc_simple_dai *dai_props;
+	struct simple_dai_props {
+		struct asoc_simple_dai dai;
+	} *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_card_data adata;
 };
@@ -40,20 +42,20 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
-	struct asoc_simple_dai *dai_props =
+	struct simple_dai_props *dai_props =
 		simple_priv_to_props(priv, rtd->num);
 
-	return asoc_simple_card_clk_enable(dai_props);
+	return asoc_simple_card_clk_enable(&dai_props->dai);
 }
 
 static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
-	struct asoc_simple_dai *dai_props =
+	struct simple_dai_props *dai_props =
 		simple_priv_to_props(priv, rtd->num);
 
-	asoc_simple_card_clk_disable(dai_props);
+	asoc_simple_card_clk_disable(&dai_props->dai);
 }
 
 static const struct snd_soc_ops asoc_simple_card_ops = {
@@ -66,7 +68,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai;
 	struct snd_soc_dai_link *dai_link;
-	struct asoc_simple_dai *dai_props;
+	struct simple_dai_props *dai_props;
 	int num = rtd->num;
 
 	dai_link	= simple_priv_to_link(priv, num);
@@ -75,7 +77,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 				rtd->cpu_dai :
 				rtd->codec_dai;
 
-	return asoc_simple_card_init_dai(dai, dai_props);
+	return asoc_simple_card_init_dai(dai, &dai_props->dai);
 }
 
 static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
@@ -95,7 +97,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
 {
 	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = simple_priv_to_props(priv, idx);
+	struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
 	struct snd_soc_card *card = simple_priv_to_card(priv);
 	int ret;
 
@@ -116,7 +118,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
 		if (ret)
 			return ret;
 
-		ret = asoc_simple_card_parse_clk_cpu(dev, np, dai_link, dai_props);
+		ret = asoc_simple_card_parse_clk_cpu(dev, np, dai_link, &dai_props->dai);
 		if (ret < 0)
 			return ret;
 
@@ -141,7 +143,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		ret = asoc_simple_card_parse_clk_codec(dev, np, dai_link, dai_props);
+		ret = asoc_simple_card_parse_clk_codec(dev, np, dai_link, &dai_props->dai);
 		if (ret < 0)
 			return ret;
 
@@ -157,7 +159,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
 					      PREFIX "prefix");
 	}
 
-	ret = asoc_simple_card_of_parse_tdm(np, dai_props);
+	ret = asoc_simple_card_of_parse_tdm(np, &dai_props->dai);
 	if (ret)
 		return ret;
 
@@ -230,7 +232,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 {
 	struct simple_card_data *priv;
 	struct snd_soc_dai_link *dai_link;
-	struct asoc_simple_dai *dai_props;
+	struct simple_dai_props *dai_props;
 	struct snd_soc_card *card;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
-- 
2.7.4

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

* [PATCH 04/15][RFC] ASoC: simple-scu-card: support snd_soc_dai_link_component style for codec
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2018-08-20  5:11 ` [PATCH 03/15][RFC] ASoC: simple-scu-card: use simple_dai_props Kuninori Morimoto
@ 2018-08-20  5:12 ` Kuninori Morimoto
  2018-08-20  5:12 ` [PATCH 05/15][RFC] ASoC: audio-graph-card: " Kuninori Morimoto
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-scu-card for codec.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 09be02e..1ba014c 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -24,6 +24,7 @@ struct simple_card_data {
 	struct snd_soc_codec_conf codec_conf;
 	struct simple_dai_props {
 		struct asoc_simple_dai dai;
+		struct snd_soc_dai_link_component codecs;
 	} *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_card_data adata;
@@ -103,11 +104,13 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
 
 	if (is_fe) {
 		int is_single_links = 0;
+		struct snd_soc_dai_link_component *codecs;
 
 		/* BE is dummy */
-		dai_link->codec_of_node		= NULL;
-		dai_link->codec_dai_name	= "snd-soc-dummy-dai";
-		dai_link->codec_name		= "snd-soc-dummy";
+		codecs			= &dai_props->codecs;
+		codecs->of_node		= NULL;
+		codecs->dai_name	= "snd-soc-dummy-dai";
+		codecs->name		= "snd-soc-dummy";
 
 		/* FE settings */
 		dai_link->dynamic		= 1;
@@ -149,13 +152,13 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
 
 		ret = asoc_simple_card_set_dailink_name(dev, dai_link,
 							"be.%s",
-							dai_link->codec_dai_name);
+							dai_link->codecs->dai_name);
 		if (ret < 0)
 			return ret;
 
 		snd_soc_of_parse_audio_prefix(card,
 					      &priv->codec_conf,
-					      dai_link->codec_of_node,
+					      dai_link->codecs->of_node,
 					      PREFIX "prefix");
 	}
 
@@ -236,7 +239,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	struct snd_soc_card *card;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
-	int num, ret;
+	int num, ret, i;
 
 	/* Allocate the private data */
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -250,6 +253,17 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	if (!dai_props || !dai_link)
 		return -ENOMEM;
 
+	/*
+	 * Use snd_soc_dai_link_component instead of legacy style
+	 * It is codec only. but cpu/platform will be supported in the future.
+	 * see
+	 *	soc-core.c :: snd_soc_init_multicodec()
+	 */
+	for (i = 0; i < num; i++) {
+		dai_link[i].codecs	= &dai_props[i].codecs;
+		dai_link[i].num_codecs	= 1;
+	}
+
 	priv->dai_props				= dai_props;
 	priv->dai_link				= dai_link;
 
-- 
2.7.4

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

* [PATCH 05/15][RFC] ASoC: audio-graph-card: support snd_soc_dai_link_component style for codec
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2018-08-20  5:12 ` [PATCH 04/15][RFC] ASoC: simple-scu-card: support snd_soc_dai_link_component style for codec Kuninori Morimoto
@ 2018-08-20  5:12 ` Kuninori Morimoto
  2018-08-20  5:12 ` [PATCH 06/15][RFC] ASoC: audio-graph-scu-card: use simple_dai_props Kuninori Morimoto
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-card for codec.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 2094d2c..5b2ecf8 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -25,6 +25,7 @@ struct graph_card_data {
 	struct graph_dai_props {
 		struct asoc_simple_dai cpu_dai;
 		struct asoc_simple_dai codec_dai;
+		struct snd_soc_dai_link_component codecs; /* single codec */
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
@@ -213,7 +214,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *cpu_port,
 	ret = asoc_simple_card_set_dailink_name(dev, dai_link,
 						"%s-%s",
 						dai_link->cpu_dai_name,
-						dai_link->codec_dai_name);
+						dai_link->codecs->dai_name);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -299,7 +300,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	struct graph_dai_props *dai_props;
 	struct device *dev = &pdev->dev;
 	struct snd_soc_card *card;
-	int num, ret;
+	int num, ret, i;
 
 	/* Allocate the private data and the DAI link array */
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -315,6 +316,17 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	if (!dai_props || !dai_link)
 		return -ENOMEM;
 
+	/*
+	 * Use snd_soc_dai_link_component instead of legacy style
+	 * It is codec only. but cpu/platform will be supported in the future.
+	 * see
+	 *	soc-core.c :: snd_soc_init_multicodec()
+	 */
+	for (i = 0; i < num; i++) {
+		dai_link[i].codecs	= &dai_props[i].codecs;
+		dai_link[i].num_codecs	= 1;
+	}
+
 	priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW);
 	if (IS_ERR(priv->pa_gpio)) {
 		ret = PTR_ERR(priv->pa_gpio);
-- 
2.7.4

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

* [PATCH 06/15][RFC] ASoC: audio-graph-scu-card: use simple_dai_props
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2018-08-20  5:12 ` [PATCH 05/15][RFC] ASoC: audio-graph-card: " Kuninori Morimoto
@ 2018-08-20  5:12 ` Kuninori Morimoto
  2018-08-20  5:13 ` [PATCH 07/15][RFC] ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec Kuninori Morimoto
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


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

audi-graph-card and audio-graph-scu-card are very similar driver,
but using different feature. Thus we are keeping synchronization
on these 2 drivers style, because it is easy to confirm / check.

Current big difference between these 2 drivers are "dai_props" on
graph_card_data (= priv).
It will be difficult to keep synchronize if we will add new feature
on audio-graph-scu-card. Thus, this patch synchronize it.

[audio-graph]
struct graph_card_data {
	...
	struct graph_dai_props {
		...
	} *dai_props;
	...
};

[audio-graph-scu]
struct graph_card_data {
	...
	struct asoc_simple_dai *dai_props;
	...
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/audio-graph-scu-card.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index 92882e3..043938f 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -25,7 +25,9 @@
 struct graph_card_data {
 	struct snd_soc_card snd_card;
 	struct snd_soc_codec_conf codec_conf;
-	struct asoc_simple_dai *dai_props;
+	struct graph_dai_props {
+		struct asoc_simple_dai dai;
+	} *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_card_data adata;
 };
@@ -39,18 +41,18 @@ static int asoc_graph_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
-	struct asoc_simple_dai *dai_props = graph_priv_to_props(priv, rtd->num);
+	struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num);
 
-	return asoc_simple_card_clk_enable(dai_props);
+	return asoc_simple_card_clk_enable(&dai_props->dai);
 }
 
 static void asoc_graph_card_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
-	struct asoc_simple_dai *dai_props = graph_priv_to_props(priv, rtd->num);
+	struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num);
 
-	asoc_simple_card_clk_disable(dai_props);
+	asoc_simple_card_clk_disable(&dai_props->dai);
 }
 
 static const struct snd_soc_ops asoc_graph_card_ops = {
@@ -63,7 +65,7 @@ static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct graph_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai;
 	struct snd_soc_dai_link *dai_link;
-	struct asoc_simple_dai *dai_props;
+	struct graph_dai_props *dai_props;
 	int num = rtd->num;
 
 	dai_link	= graph_priv_to_link(priv, num);
@@ -72,7 +74,7 @@ static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 				rtd->cpu_dai :
 				rtd->codec_dai;
 
-	return asoc_simple_card_init_dai(dai, dai_props);
+	return asoc_simple_card_init_dai(dai, &dai_props->dai);
 }
 
 static int asoc_graph_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
@@ -92,7 +94,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *ep,
 {
 	struct device *dev = graph_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = graph_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = graph_priv_to_props(priv, idx);
+	struct graph_dai_props *dai_props = graph_priv_to_props(priv, idx);
 	struct snd_soc_card *card = graph_priv_to_card(priv);
 	int ret;
 
@@ -110,7 +112,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *ep,
 		if (ret)
 			return ret;
 
-		ret = asoc_simple_card_parse_clk_cpu(dev, ep, dai_link, dai_props);
+		ret = asoc_simple_card_parse_clk_cpu(dev, ep, dai_link, &dai_props->dai);
 		if (ret < 0)
 			return ret;
 
@@ -137,7 +139,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *ep,
 		if (ret < 0)
 			return ret;
 
-		ret = asoc_simple_card_parse_clk_codec(dev, ep, dai_link, dai_props);
+		ret = asoc_simple_card_parse_clk_codec(dev, ep, dai_link, &dai_props->dai);
 		if (ret < 0)
 			return ret;
 
@@ -153,7 +155,7 @@ static int asoc_graph_card_dai_link_of(struct device_node *ep,
 					      "prefix");
 	}
 
-	ret = asoc_simple_card_of_parse_tdm(ep, dai_props);
+	ret = asoc_simple_card_of_parse_tdm(ep, &dai_props->dai);
 	if (ret)
 		return ret;
 
@@ -331,7 +333,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 {
 	struct graph_card_data *priv;
 	struct snd_soc_dai_link *dai_link;
-	struct asoc_simple_dai *dai_props;
+	struct graph_dai_props *dai_props;
 	struct device *dev = &pdev->dev;
 	struct snd_soc_card *card;
 	int num, ret;
-- 
2.7.4

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

* [PATCH 07/15][RFC] ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2018-08-20  5:12 ` [PATCH 06/15][RFC] ASoC: audio-graph-scu-card: use simple_dai_props Kuninori Morimoto
@ 2018-08-20  5:13 ` Kuninori Morimoto
  2018-08-20  5:13 ` [PATCH 08/15][RFC] ASoC: simple-card-util: remove dai_link compatible code " Kuninori Morimoto
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-scu-card for codec.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/audio-graph-scu-card.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index 043938f..8213d5f 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -27,6 +27,7 @@ struct graph_card_data {
 	struct snd_soc_codec_conf codec_conf;
 	struct graph_dai_props {
 		struct asoc_simple_dai dai;
+		struct snd_soc_dai_link_component codecs;
 	} *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_card_data adata;
@@ -99,10 +100,13 @@ static int asoc_graph_card_dai_link_of(struct device_node *ep,
 	int ret;
 
 	if (is_fe) {
+		struct snd_soc_dai_link_component *codecs;
+
 		/* BE is dummy */
-		dai_link->codec_of_node		= NULL;
-		dai_link->codec_dai_name	= "snd-soc-dummy-dai";
-		dai_link->codec_name		= "snd-soc-dummy";
+		codecs			= &dai_props->codecs;
+		codecs->of_node		= NULL;
+		codecs->dai_name	= "snd-soc-dummy-dai";
+		codecs->name		= "snd-soc-dummy";
 
 		/* FE settings */
 		dai_link->dynamic		= 1;
@@ -145,13 +149,13 @@ static int asoc_graph_card_dai_link_of(struct device_node *ep,
 
 		ret = asoc_simple_card_set_dailink_name(dev, dai_link,
 							"be.%s",
-							dai_link->codec_dai_name);
+							dai_link->codecs->dai_name);
 		if (ret < 0)
 			return ret;
 
 		snd_soc_of_parse_audio_prefix(card,
 					      &priv->codec_conf,
-					      dai_link->codec_of_node,
+					      dai_link->codecs->of_node,
 					      "prefix");
 	}
 
@@ -336,7 +340,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	struct graph_dai_props *dai_props;
 	struct device *dev = &pdev->dev;
 	struct snd_soc_card *card;
-	int num, ret;
+	int num, ret, i;
 
 	/* Allocate the private data and the DAI link array */
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -352,6 +356,17 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	if (!dai_props || !dai_link)
 		return -ENOMEM;
 
+	/*
+	 * Use snd_soc_dai_link_component instead of legacy style
+	 * It is codec only. but cpu/platform will be supported in the future.
+	 * see
+	 *	soc-core.c :: snd_soc_init_multicodec()
+	 */
+	for (i = 0; i < num; i++) {
+		dai_link[i].codecs	= &dai_props[i].codecs;
+		dai_link[i].num_codecs	= 1;
+	}
+
 	priv->dai_props			= dai_props;
 	priv->dai_link			= dai_link;
 
-- 
2.7.4

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

* [PATCH 08/15][RFC] ASoC: simple-card-util: remove dai_link compatible code for codec
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2018-08-20  5:13 ` [PATCH 07/15][RFC] ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec Kuninori Morimoto
@ 2018-08-20  5:13 ` Kuninori Morimoto
  2018-08-20  5:13 ` [PATCH 09/15][RFC] ASoC: soc-core: use snd_soc_dai_link_component for platform Kuninori Morimoto
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Now no simple/audio cards are using legacy dai_link style for codec.
Let's remove compatible code.

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

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 73c0a90..e7057be 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -409,9 +409,7 @@ int asoc_simple_card_clean_reference(struct snd_soc_card *card)
 	     num_links < card->num_links;
 	     num_links++, dai_link++) {
 		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-		if (dai_link->codecs)
-			of_node_put(dai_link->codecs->of_node);
+		of_node_put(dai_link->codecs->of_node);
 	}
 	return 0;
 }
-- 
2.7.4

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

* [PATCH 09/15][RFC] ASoC: soc-core: use snd_soc_dai_link_component for platform
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2018-08-20  5:13 ` [PATCH 08/15][RFC] ASoC: simple-card-util: remove dai_link compatible code " Kuninori Morimoto
@ 2018-08-20  5:13 ` Kuninori Morimoto
  2018-08-20  5:13 ` [PATCH 10/15][RFC] ASoC: simple-card-util: support snd_soc_dai_link_component style " Kuninori Morimoto
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current struct snd_soc_dai_link is supporting multicodec,
and it is supporting legacy style of
	codec_name
	codec_of_node
	code_dai_name
This is handled as single entry of multicodec.

We don't have multicpu support yet, but in the future we will.
In such case, we can use snd_soc_dai_link_component for both
cpu/codec. Then the code will be more simple and readble.

As next step, we want to use it for platform, too.
This patch adds snd_soc_dai_link_component style for platform.
We might have multiplatform support in the future, but we
don't know yet. To avoid un-known issue / complex code,
this patch supports just single-platform as 1st step.

If we could use snd_soc_dai_link_component for all CPU/Codec/Platform,
we will switch to new style, and remove legacy code.
This is prepare for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h  |  2 ++
 sound/soc/soc-core.c | 48 +++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 41cec42..96c19aa 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -915,6 +915,8 @@ struct snd_soc_dai_link {
 	 */
 	const char *platform_name;
 	struct device_node *platform_of_node;
+	struct snd_soc_dai_link_component *platform;
+
 	int id;	/* optional ID for machine driver link identification */
 
 	const struct snd_soc_pcm_stream *params;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 473eefe..2a73630 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -892,8 +892,8 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
 	rtd->codec_dai = codec_dais[0];
 
 	/* if there's no platform we match on the empty platform */
-	platform_name = dai_link->platform_name;
-	if (!platform_name && !dai_link->platform_of_node)
+	platform_name = dai_link->platform->name;
+	if (!platform_name && !dai_link->platform->of_node)
 		platform_name = "snd-soc-dummy";
 
 	/* find one from the set of registered platforms */
@@ -902,8 +902,8 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
 		if (!platform_of_node && component->dev->parent->of_node)
 			platform_of_node = component->dev->parent->of_node;
 
-		if (dai_link->platform_of_node) {
-			if (platform_of_node != dai_link->platform_of_node)
+		if (dai_link->platform->of_node) {
+			if (platform_of_node != dai_link->platform->of_node)
 				continue;
 		} else {
 			if (strcmp(component->name, platform_name))
@@ -1015,6 +1015,31 @@ static void soc_remove_dai_links(struct snd_soc_card *card)
 	}
 }
 
+static int snd_soc_init_platform(struct snd_soc_card *card,
+				 struct snd_soc_dai_link *dai_link)
+{
+	/*
+	 * FIXME
+	 *
+	 * this function should be removed in the future
+	 */
+	/* convert Legacy platform link */
+	if (dai_link->platform)
+		return 0;
+
+	dai_link->platform = devm_kzalloc(card->dev,
+				sizeof(struct snd_soc_dai_link_component),
+				GFP_KERNEL);
+	if (!dai_link->platform)
+		return -ENOMEM;
+
+	dai_link->platform->name	= dai_link->platform_name;
+	dai_link->platform->of_node	= dai_link->platform_of_node;
+	dai_link->platform->dai_name	= NULL;
+
+	return 0;
+}
+
 static int snd_soc_init_multicodec(struct snd_soc_card *card,
 				   struct snd_soc_dai_link *dai_link)
 {
@@ -1047,6 +1072,12 @@ static int soc_init_dai_link(struct snd_soc_card *card,
 {
 	int i, 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");
@@ -1076,13 +1107,12 @@ static int soc_init_dai_link(struct snd_soc_card *card,
 	 * Platform may be specified by either name or OF node, but
 	 * can be left unspecified, and a dummy platform will be used.
 	 */
-	if (link->platform_name && link->platform_of_node) {
+	if (link->platform->name && link->platform->of_node) {
 		dev_err(card->dev,
 			"ASoC: Both platform name/of_node are set for %s\n",
 			link->name);
 		return -EINVAL;
 	}
-
 	/*
 	 * CPU device may be specified by either name or OF node, but
 	 * can be left unspecified, and will be matched based on DAI
@@ -1917,7 +1947,11 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)
 				 card->dai_link[i].name);
 
 			/* override platform component */
-			dai_link->platform_name = component->name;
+			if (snd_soc_init_platform(card, dai_link) < 0) {
+				dev_err(card->dev, "init platform error");
+				continue;
+			}
+			dai_link->platform->name = component->name;
 
 			/* convert non BE into BE */
 			dai_link->no_pcm = 1;
-- 
2.7.4

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

* [PATCH 10/15][RFC] ASoC: simple-card-util: support snd_soc_dai_link_component style for platform
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2018-08-20  5:13 ` [PATCH 09/15][RFC] ASoC: soc-core: use snd_soc_dai_link_component for platform Kuninori Morimoto
@ 2018-08-20  5:13 ` Kuninori Morimoto
  2018-08-20  5:13 ` [PATCH 11/15][RFC] ASoC: simple-card: " Kuninori Morimoto
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card-util for platform.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index e7057be..644cd62 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -376,10 +376,15 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
 int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
 {
 	/* Assumes platform == cpu */
-	if (!dai_link->platform_of_node)
-		dai_link->platform_of_node = dai_link->cpu_of_node;
-
+	if (dai_link->platform) {
+		if (!dai_link->platform->of_node)
+			dai_link->platform->of_node = dai_link->cpu_of_node;
+	} else {
+		if (!dai_link->platform_of_node)
+			dai_link->platform_of_node = dai_link->cpu_of_node;
+	}
 	return 0;
+
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink);
 
-- 
2.7.4

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

* [PATCH 11/15][RFC] ASoC: simple-card: support snd_soc_dai_link_component style for platform
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2018-08-20  5:13 ` [PATCH 10/15][RFC] ASoC: simple-card-util: support snd_soc_dai_link_component style " Kuninori Morimoto
@ 2018-08-20  5:13 ` Kuninori Morimoto
  2018-08-20  5:14 ` [PATCH 12/15][RFC] ASoC: simple-scu-card: " Kuninori Morimoto
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card for platform.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index dd67516..06ece54 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -21,6 +21,7 @@ struct simple_card_data {
 		struct asoc_simple_dai cpu_dai;
 		struct asoc_simple_dai codec_dai;
 		struct snd_soc_dai_link_component codecs; /* single codec */
+		struct snd_soc_dai_link_component platform;
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
@@ -391,6 +392,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	for (i = 0; i < num; i++) {
 		dai_link[i].codecs	= &dai_props[i].codecs;
 		dai_link[i].num_codecs	= 1;
+		dai_link[i].platform	= &dai_props[i].platform;
 	}
 
 	priv->dai_props			= dai_props;
@@ -416,6 +418,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	} else {
 		struct asoc_simple_card_info *cinfo;
 		struct snd_soc_dai_link_component *codecs;
+		struct snd_soc_dai_link_component *platform;
 
 		cinfo = dev->platform_data;
 		if (!cinfo) {
@@ -436,10 +439,12 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 		codecs->name		= cinfo->codec;
 		codecs->dai_name	= cinfo->codec_dai.name;
 
+		platform		= &dai_props->platform;
+		platform->name		= cinfo->platform;
+
 		card->name		= (cinfo->card) ? cinfo->card : cinfo->name;
 		dai_link->name		= cinfo->name;
 		dai_link->stream_name	= cinfo->name;
-		dai_link->platform_name	= cinfo->platform;
 		dai_link->cpu_dai_name	= cinfo->cpu_dai.name;
 		dai_link->dai_fmt	= cinfo->daifmt;
 		dai_link->init		= asoc_simple_card_dai_init;
-- 
2.7.4

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

* [PATCH 12/15][RFC] ASoC: simple-scu-card: support snd_soc_dai_link_component style for platform
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2018-08-20  5:13 ` [PATCH 11/15][RFC] ASoC: simple-card: " Kuninori Morimoto
@ 2018-08-20  5:14 ` Kuninori Morimoto
  2018-08-20  5:14 ` [PATCH 13/15][RFC] ASoC: audio-graph-card: " Kuninori Morimoto
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-scu-card for platform.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 1ba014c..5a52337 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -25,6 +25,7 @@ struct simple_card_data {
 	struct simple_dai_props {
 		struct asoc_simple_dai dai;
 		struct snd_soc_dai_link_component codecs;
+		struct snd_soc_dai_link_component platform;
 	} *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_card_data adata;
@@ -262,6 +263,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	for (i = 0; i < num; i++) {
 		dai_link[i].codecs	= &dai_props[i].codecs;
 		dai_link[i].num_codecs	= 1;
+		dai_link[i].platform	= &dai_props[i].platform;
 	}
 
 	priv->dai_props				= dai_props;
-- 
2.7.4

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

* [PATCH 13/15][RFC] ASoC: audio-graph-card: support snd_soc_dai_link_component style for platform
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2018-08-20  5:14 ` [PATCH 12/15][RFC] ASoC: simple-scu-card: " Kuninori Morimoto
@ 2018-08-20  5:14 ` Kuninori Morimoto
  2018-08-20  5:14 ` [PATCH 14/15][RFC] ASoC: audio-graph-scu-card: " Kuninori Morimoto
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-card for platform.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 5b2ecf8..fb6635f 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -26,6 +26,7 @@ struct graph_card_data {
 		struct asoc_simple_dai cpu_dai;
 		struct asoc_simple_dai codec_dai;
 		struct snd_soc_dai_link_component codecs; /* single codec */
+		struct snd_soc_dai_link_component platform;
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
@@ -325,6 +326,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	for (i = 0; i < num; i++) {
 		dai_link[i].codecs	= &dai_props[i].codecs;
 		dai_link[i].num_codecs	= 1;
+		dai_link[i].platform	= &dai_props[i].platform;
 	}
 
 	priv->pa_gpio = devm_gpiod_get_optional(dev, "pa", GPIOD_OUT_LOW);
-- 
2.7.4

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

* [PATCH 14/15][RFC] ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for platform
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (12 preceding siblings ...)
  2018-08-20  5:14 ` [PATCH 13/15][RFC] ASoC: audio-graph-card: " Kuninori Morimoto
@ 2018-08-20  5:14 ` Kuninori Morimoto
  2018-08-20  5:14 ` [PATCH 15/15][RFC] ASoC: simple-card-util: remove dai_link compatible code " Kuninori Morimoto
  2018-08-21  6:47 ` [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for audio-graph-scu-card for platform.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

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

diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index 8213d5f..995a155 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -28,6 +28,7 @@ struct graph_card_data {
 	struct graph_dai_props {
 		struct asoc_simple_dai dai;
 		struct snd_soc_dai_link_component codecs;
+		struct snd_soc_dai_link_component platform;
 	} *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_card_data adata;
@@ -365,6 +366,7 @@ static int asoc_graph_card_probe(struct platform_device *pdev)
 	for (i = 0; i < num; i++) {
 		dai_link[i].codecs	= &dai_props[i].codecs;
 		dai_link[i].num_codecs	= 1;
+		dai_link[i].platform	= &dai_props[i].platform;
 	}
 
 	priv->dai_props			= dai_props;
-- 
2.7.4

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

* [PATCH 15/15][RFC] ASoC: simple-card-util: remove dai_link compatible code for platform
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (13 preceding siblings ...)
  2018-08-20  5:14 ` [PATCH 14/15][RFC] ASoC: audio-graph-scu-card: " Kuninori Morimoto
@ 2018-08-20  5:14 ` Kuninori Morimoto
  2018-08-21  6:47 ` [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
  15 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-20  5:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA

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

Now no simple/audio cards are using legacy dai_link style for platform.
Let's remove compatible code.

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

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 644cd62..b400dbf1f 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -376,13 +376,9 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
 int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
 {
 	/* Assumes platform == cpu */
-	if (dai_link->platform) {
-		if (!dai_link->platform->of_node)
-			dai_link->platform->of_node = dai_link->cpu_of_node;
-	} else {
-		if (!dai_link->platform_of_node)
-			dai_link->platform_of_node = dai_link->cpu_of_node;
-	}
+	if (!dai_link->platform->of_node)
+		dai_link->platform->of_node = dai_link->cpu_of_node;
+
 	return 0;
 
 }
-- 
2.7.4

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

* Re: [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card
  2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
                   ` (14 preceding siblings ...)
  2018-08-20  5:14 ` [PATCH 15/15][RFC] ASoC: simple-card-util: remove dai_link compatible code " Kuninori Morimoto
@ 2018-08-21  6:47 ` Kuninori Morimoto
  2018-08-30 14:12   ` Mark Brown
  15 siblings, 1 reply; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-21  6:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


Hi Mark

I noticed that there are 1 small bug.
It is not a big deal, but I want to fixup.
Please let me know if v1 looks OK,
then, I will post v2 patch.
If v1 is not OK, then, I don't post v2.

> I think ALSA SoC framework needs more update for modern style
> As 1st step, codec/plaform are updated/converted to component style.
> I think 2nd step is DAI/dai_link matching.
> We want to use snd_soc_dai_link_component style instead of
> legacy style for dai_link matching for CPU/Codec/Platform.
> like this.
> 
> 	[current]
> 	struct snd_soc_dai_link {
> 		...
> 		*cpu_name;
> 		*cpu_of_node;
> 		*cpu_dai_name;
> 
> 		*codec_name;
> 		*codec_of_node;
> 		*codec_dai_name;
> 		*codecs;
> 		num_codecs;
> 
> 		*platform_name;
> 		*platform_of_node;
> 		...
> 	}
> 
> 	[we want]
> 	struct snd_soc_dai_link {
> 		...
> 		*cpus
> 		num_cpus;
> 
> 		*codecs;
> 		num_codecs;
> 
> 		*platform;
> 		...
> 	}
> 
> Above sample is still using CPU/Codec/Platform.
> We can merge it into same snd_soc_dai_link_component list
> if someone wants it. But anyway, CPU/Codec/Platform style
> is not so bad, so far.
> 
> It will be more useful/simple code if we can use
> snd_soc_dai_link_component for DAI instead of
> xxx_name / xxx_of_node / xxx_dai_name.
> 
> Currently, only Codec is supporting/using snd_soc_dai_link_component
> style. But we want to use it for CPU/Platform, too.
> I know Shreyas is posting multi CPU style, then, it can support
> snd_soc_dai_link_component style.
> 
> Using snd_soc_dai_link_component style for Platform is not difficult
> I think. [09/15] patch add it on soc-core.
> But, I can't test for all boards/platforms, thus,
> I added [RFC] for these patches.
> 
> Now, we are still missing CPU part, but can use it for Codec/Platform.
> These patches use it on simple/audio cards for Codec/Platform.
> If these are OK, and if we could have CPU support in the future,
> we can convert current legacy style to snd_soc_dai_link_component style
> for all sound cards.
> 
>  1) -  8) use snd_soc_dai_link_component for Codec    on simple/audio card
>  9) - 15) use snd_soc_dai_link_component for Platform on simple/audio card
> 
> Kuninori Morimoto (15):
>    1) ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec
>    2) ASoC: simple-card: support snd_soc_dai_link_component style for codec
>    3) ASoC: simple-scu-card: use simple_dai_props
>    4) ASoC: simple-scu-card: support snd_soc_dai_link_component style for codec
>    5) ASoC: audio-graph-card: support snd_soc_dai_link_component style for codec
>    6) ASoC: audio-graph-scu-card: use simple_dai_props
>    7) ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec
>    8) ASoC: simple-card-util: remove dai_link compatible code for codec
>    9) ASoC: soc-core: use snd_soc_dai_link_component for platform
>   10) ASoC: simple-card-util: support snd_soc_dai_link_component style for platform
>   11) ASoC: simple-card: support snd_soc_dai_link_component style for platform
>   12) ASoC: simple-scu-card: support snd_soc_dai_link_component style for platform
>   13) ASoC: audio-graph-card: support snd_soc_dai_link_component style for platform
>   14) ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for platform
>   15) ASoC: simple-card-util: remove dai_link compatible code for platform
> 
>  include/sound/simple_card_utils.h        | 27 ++++++++++------
>  include/sound/soc.h                      |  2 ++
>  sound/soc/generic/audio-graph-card.c     | 18 +++++++++--
>  sound/soc/generic/audio-graph-scu-card.c | 55 +++++++++++++++++++++-----------
>  sound/soc/generic/simple-card-utils.c    | 47 ++++++++++++++++++++++++---
>  sound/soc/generic/simple-card.c          | 30 ++++++++++++++---
>  sound/soc/generic/simple-scu-card.c      | 54 ++++++++++++++++++++-----------
>  sound/soc/soc-core.c                     | 48 ++++++++++++++++++++++++----
>  8 files changed, 217 insertions(+), 64 deletions(-)
> 
> --
> 2.7.4
> 

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

* Re: [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card
  2018-08-21  6:47 ` [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
@ 2018-08-30 14:12   ` Mark Brown
  2018-08-31  0:22     ` Kuninori Morimoto
  0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2018-08-30 14:12 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA


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

On Tue, Aug 21, 2018 at 06:47:48AM +0000, Kuninori Morimoto wrote:

> Please let me know if v1 looks OK,
> then, I will post v2 patch.

This looks like it moves everything in a more consistent direction so I
think it should be fine.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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



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

* Re: [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card
  2018-08-30 14:12   ` Mark Brown
@ 2018-08-31  0:22     ` Kuninori Morimoto
  0 siblings, 0 replies; 19+ messages in thread
From: Kuninori Morimoto @ 2018-08-31  0:22 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA


Hi Mark

> > Please let me know if v1 looks OK,
> > then, I will post v2 patch.
> 
> This looks like it moves everything in a more consistent direction so I
> think it should be fine.

Thanks
I will post v2 patch

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

end of thread, other threads:[~2018-08-31  0:22 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20  5:09 [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
2018-08-20  5:11 ` [PATCH 01/15][RFC] ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec Kuninori Morimoto
2018-08-20  5:11 ` [PATCH 02/15][RFC] ASoC: simple-card: " Kuninori Morimoto
2018-08-20  5:11 ` [PATCH 03/15][RFC] ASoC: simple-scu-card: use simple_dai_props Kuninori Morimoto
2018-08-20  5:12 ` [PATCH 04/15][RFC] ASoC: simple-scu-card: support snd_soc_dai_link_component style for codec Kuninori Morimoto
2018-08-20  5:12 ` [PATCH 05/15][RFC] ASoC: audio-graph-card: " Kuninori Morimoto
2018-08-20  5:12 ` [PATCH 06/15][RFC] ASoC: audio-graph-scu-card: use simple_dai_props Kuninori Morimoto
2018-08-20  5:13 ` [PATCH 07/15][RFC] ASoC: audio-graph-scu-card: support snd_soc_dai_link_component style for codec Kuninori Morimoto
2018-08-20  5:13 ` [PATCH 08/15][RFC] ASoC: simple-card-util: remove dai_link compatible code " Kuninori Morimoto
2018-08-20  5:13 ` [PATCH 09/15][RFC] ASoC: soc-core: use snd_soc_dai_link_component for platform Kuninori Morimoto
2018-08-20  5:13 ` [PATCH 10/15][RFC] ASoC: simple-card-util: support snd_soc_dai_link_component style " Kuninori Morimoto
2018-08-20  5:13 ` [PATCH 11/15][RFC] ASoC: simple-card: " Kuninori Morimoto
2018-08-20  5:14 ` [PATCH 12/15][RFC] ASoC: simple-scu-card: " Kuninori Morimoto
2018-08-20  5:14 ` [PATCH 13/15][RFC] ASoC: audio-graph-card: " Kuninori Morimoto
2018-08-20  5:14 ` [PATCH 14/15][RFC] ASoC: audio-graph-scu-card: " Kuninori Morimoto
2018-08-20  5:14 ` [PATCH 15/15][RFC] ASoC: simple-card-util: remove dai_link compatible code " Kuninori Morimoto
2018-08-21  6:47 ` [PATCH 00/15][RFC] ASoC: use snd_soc_dai_link_component style for simple card Kuninori Morimoto
2018-08-30 14:12   ` Mark Brown
2018-08-31  0:22     ` Kuninori Morimoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.