All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc
@ 2023-05-08 23:49 Kuninori Morimoto
  2023-05-08 23:50 ` [RESEND][PATCH v2 01/13] ASoC: soc-utils.c: add asoc_dummy_dlc Kuninori Morimoto
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:49 UTC (permalink / raw)
  To: Amadeusz, Alexandre Belloni, Banajit Goswami, Bard Liao,
	Brent Lu, Cezary Rojewski, Claudiu Beznea, Daniel Baluta,
	Jarkko Nikula, Jaroslav Kysela, Jerome Brunet, Kai Vehmanen,
	Kevin Hilman, Liam Girdwood, Mark Brown, Neil Armstrong,
	Nicolas Ferre, Peter Ujfalusi, Pierre-Louis Bossart,
	Ranjani Sridharan, Richard Fitzgerald, Sascha Hauer, Shawn Guo,
	Shengji u Wang, Srinivas Kandagatla, Stephan Gerhold,
	Takashi Iwai, Xiubo Li
  Cc: Fabio Estevam, Martin Blumenstingl, Nicolin Chen, Shengjiu Wang,
	alsa-devel


Hi Mark

These are v2 patch-set of asoc_dummy_dlc.

Many ASoC drivers are using dummy DAI.
I have 2 concern about it. 1st one is there is no guarantee that local
strings ("snd-soc-dummy-dai",  "snd-soc-dummy") are kept until the card
was binded if it was added at subfunction.
2nd one is we can use common snd_soc_dai_link_component for it.
This patch-set adds common asoc_dummy_dlc, and use it.

resend
	- rebased on latest asoc/for-6.4 branch

v1 -> v2
	- Separate intel patch into 3
	- Topology codec doesn't use asoc_dummy_dlc

Link: https://lore.kernel.org/r/874jpe3uqh.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87bkje0zzf.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (13):
  ASoC: soc-utils.c: add asoc_dummy_dlc
  ASoC: ti: use asoc_dummy_dlc
  ASoC: sof: use asoc_dummy_dlc
  ASoC: amd: use asoc_dummy_dlc
  ASoC: fsl: use asoc_dummy_dlc
  ASoC: qcom: use asoc_dummy_dlc
  ASoC: atmel: use asoc_dummy_dlc
  ASoC: meson: use asoc_dummy_dlc
  ASoC: intel: avs: use asoc_dummy_dlc
  ASoC: intel: sof: use asoc_dummy_dlc
  ASoC: intel: skylake: use asoc_dummy_dlc
  ASoC: simple_card_utils.c: use asoc_dummy_dlc
  ASoC: soc-topology.c: add comment for Platform/Codec

 include/sound/simple_card_utils.h            |  1 -
 include/sound/soc.h                          |  1 +
 sound/soc/amd/acp/acp-mach-common.c          | 43 ++++++++------------
 sound/soc/atmel/atmel-classd.c               |  8 ++--
 sound/soc/atmel/atmel-pdmic.c                |  8 ++--
 sound/soc/fsl/imx-audmix.c                   | 14 +++----
 sound/soc/fsl/imx-card.c                     | 11 +----
 sound/soc/fsl/imx-rpmsg.c                    |  3 +-
 sound/soc/fsl/imx-spdif.c                    |  8 ++--
 sound/soc/generic/simple-card-utils.c        |  9 +---
 sound/soc/intel/avs/boards/i2s_test.c        |  6 +--
 sound/soc/intel/boards/ehl_rt5660.c          |  8 +---
 sound/soc/intel/boards/skl_hda_dsp_generic.c |  8 +---
 sound/soc/intel/boards/sof_cs42l42.c         | 11 +----
 sound/soc/intel/boards/sof_es8336.c          | 11 +----
 sound/soc/intel/boards/sof_nau8825.c         | 11 +----
 sound/soc/intel/boards/sof_pcm512x.c         |  3 +-
 sound/soc/intel/boards/sof_rt5682.c          | 14 ++-----
 sound/soc/intel/boards/sof_sdw.c             | 13 +-----
 sound/soc/intel/boards/sof_ssp_amp.c         | 18 +++-----
 sound/soc/meson/axg-card.c                   |  8 ++--
 sound/soc/meson/meson-card-utils.c           | 10 +----
 sound/soc/qcom/common.c                      | 11 +----
 sound/soc/soc-topology.c                     | 22 +++++-----
 sound/soc/soc-utils.c                        |  7 ++++
 sound/soc/sof/nocodec.c                      |  8 ++--
 sound/soc/ti/omap-hdmi.c                     |  8 ++--
 27 files changed, 89 insertions(+), 194 deletions(-)

-- 
2.25.1


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

* [RESEND][PATCH v2 01/13] ASoC: soc-utils.c: add asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
@ 2023-05-08 23:50 ` Kuninori Morimoto
  2023-05-08 23:50 ` [RESEND][PATCH v2 02/13] ASoC: ti: use asoc_dummy_dlc Kuninori Morimoto
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:50 UTC (permalink / raw)
  To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Richard Fitzgerald,
	Takashi Iwai
  Cc: alsa-devel

ASoC uses dummy Component, sharing snd_soc_dai_link_component
for it is better idea. This patch adds it.

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

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 05004c048dd5..533e553a343f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -878,6 +878,7 @@ asoc_link_to_platform(struct snd_soc_dai_link *link, int n) {
 #define COMP_DUMMY()			{ .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
 
 extern struct snd_soc_dai_link_component null_dailink_component[0];
+extern struct snd_soc_dai_link_component asoc_dummy_dlc;
 
 
 struct snd_soc_codec_conf {
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index a4dba0b751e7..11607c5f5d5a 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -224,6 +224,13 @@ int snd_soc_component_is_dummy(struct snd_soc_component *component)
 		(component->driver == &dummy_codec));
 }
 
+struct snd_soc_dai_link_component asoc_dummy_dlc = {
+	.of_node	= NULL,
+	.dai_name	= "snd-soc-dummy-dai",
+	.name		= "snd-soc-dummy",
+};
+EXPORT_SYMBOL_GPL(asoc_dummy_dlc);
+
 static int snd_soc_dummy_probe(struct platform_device *pdev)
 {
 	int ret;
-- 
2.25.1


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

* [RESEND][PATCH v2 02/13] ASoC: ti: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
  2023-05-08 23:50 ` [RESEND][PATCH v2 01/13] ASoC: soc-utils.c: add asoc_dummy_dlc Kuninori Morimoto
@ 2023-05-08 23:50 ` Kuninori Morimoto
  2023-05-08 23:50 ` [RESEND][PATCH v2 03/13] ASoC: sof: " Kuninori Morimoto
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:50 UTC (permalink / raw)
  To: Jarkko Nikula, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Peter Ujfalusi, Takashi Iwai
  Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/ti/omap-hdmi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/ti/omap-hdmi.c b/sound/soc/ti/omap-hdmi.c
index 96c3569d7643..a3663ab065ac 100644
--- a/sound/soc/ti/omap-hdmi.c
+++ b/sound/soc/ti/omap-hdmi.c
@@ -365,19 +365,17 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
 	if (!card->dai_link)
 		return -ENOMEM;
 
-	compnent = devm_kzalloc(dev, 2 * sizeof(*compnent), GFP_KERNEL);
+	compnent = devm_kzalloc(dev, sizeof(*compnent), GFP_KERNEL);
 	if (!compnent)
 		return -ENOMEM;
-	card->dai_link->cpus		= &compnent[0];
+	card->dai_link->cpus		= compnent;
 	card->dai_link->num_cpus	= 1;
-	card->dai_link->codecs		= &compnent[1];
+	card->dai_link->codecs		= &asoc_dummy_dlc;
 	card->dai_link->num_codecs	= 1;
 
 	card->dai_link->name = card->name;
 	card->dai_link->stream_name = card->name;
 	card->dai_link->cpus->dai_name = dev_name(ad->dssdev);
-	card->dai_link->codecs->name = "snd-soc-dummy";
-	card->dai_link->codecs->dai_name = "snd-soc-dummy-dai";
 	card->num_links = 1;
 	card->dev = dev;
 
-- 
2.25.1


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

* [RESEND][PATCH v2 03/13] ASoC: sof: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
  2023-05-08 23:50 ` [RESEND][PATCH v2 01/13] ASoC: soc-utils.c: add asoc_dummy_dlc Kuninori Morimoto
  2023-05-08 23:50 ` [RESEND][PATCH v2 02/13] ASoC: ti: use asoc_dummy_dlc Kuninori Morimoto
@ 2023-05-08 23:50 ` Kuninori Morimoto
  2023-05-08 23:51 ` [RESEND][PATCH v2 04/13] ASoC: amd: " Kuninori Morimoto
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:50 UTC (permalink / raw)
  To: Bard Liao, Daniel Baluta, Jaroslav Kysela, Liam Girdwood,
	Mark Brown, Peter Ujfalusi, Pierre-Louis Bossart,
	Ranjani Sridharan, Takashi Iwai
  Cc: Kai Vehmanen, alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

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

diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c
index b13bfdeb2b70..7c5bb9badb6c 100644
--- a/sound/soc/sof/nocodec.c
+++ b/sound/soc/sof/nocodec.c
@@ -32,7 +32,7 @@ static int sof_nocodec_bes_setup(struct device *dev,
 
 	/* set up BE dai_links */
 	for (i = 0; i < link_num; i++) {
-		dlc = devm_kcalloc(dev, 3, sizeof(*dlc), GFP_KERNEL);
+		dlc = devm_kcalloc(dev, 2, sizeof(*dlc), GFP_KERNEL);
 		if (!dlc)
 			return -ENOMEM;
 
@@ -44,8 +44,8 @@ static int sof_nocodec_bes_setup(struct device *dev,
 		links[i].stream_name = links[i].name;
 
 		links[i].cpus = &dlc[0];
-		links[i].codecs = &dlc[1];
-		links[i].platforms = &dlc[2];
+		links[i].codecs = &asoc_dummy_dlc;
+		links[i].platforms = &dlc[1];
 
 		links[i].num_cpus = 1;
 		links[i].num_codecs = 1;
@@ -55,8 +55,6 @@ static int sof_nocodec_bes_setup(struct device *dev,
 		links[i].no_pcm = 1;
 		links[i].cpus->dai_name = drv[i].name;
 		links[i].platforms->name = dev_name(dev->parent);
-		links[i].codecs->dai_name = "snd-soc-dummy-dai";
-		links[i].codecs->name = "snd-soc-dummy";
 		if (drv[i].playback.channels_min)
 			links[i].dpcm_playback = 1;
 		if (drv[i].capture.channels_min)
-- 
2.25.1


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

* [RESEND][PATCH v2 04/13] ASoC: amd: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2023-05-08 23:50 ` [RESEND][PATCH v2 03/13] ASoC: sof: " Kuninori Morimoto
@ 2023-05-08 23:51 ` Kuninori Morimoto
  2023-05-08 23:51 ` [RESEND][PATCH v2 05/13] ASoC: fsl: " Kuninori Morimoto
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:51 UTC (permalink / raw)
  To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai; +Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/amd/acp/acp-mach-common.c | 43 ++++++++++++-----------------
 1 file changed, 18 insertions(+), 25 deletions(-)

diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c
index b4dcce4fbae9..6da17140beea 100644
--- a/sound/soc/amd/acp/acp-mach-common.c
+++ b/sound/soc/amd/acp/acp-mach-common.c
@@ -795,13 +795,6 @@ SND_SOC_DAILINK_DEF(dmic_codec,
 		DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi")));
 
 /* Declare ACP CPU components */
-static struct snd_soc_dai_link_component dummy_codec[] = {
-	{
-		.name = "snd-soc-dummy",
-		.dai_name = "snd-soc-dummy-dai",
-	}
-};
-
 static struct snd_soc_dai_link_component platform_component[] = {
 	{
 		 .name = "acp_asoc_renoir.0",
@@ -912,8 +905,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		links[i].no_pcm = 1;
 		if (!drv_data->hs_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->hs_codec_id == RT5682) {
 			links[i].codecs = rt5682;
@@ -943,8 +936,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		links[i].no_pcm = 1;
 		if (!drv_data->hs_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->hs_codec_id == NAU8825) {
 			links[i].codecs = nau8825;
@@ -973,8 +966,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		links[i].no_pcm = 1;
 		if (!drv_data->amp_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->amp_codec_id == RT1019) {
 			links[i].codecs = rt1019;
@@ -1005,8 +998,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card)
 		links[i].no_pcm = 1;
 		if (!drv_data->amp_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->amp_codec_id == MAX98360A) {
 			links[i].codecs = max98360a;
@@ -1076,8 +1069,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
 		links[i].dpcm_capture = 1;
 		if (!drv_data->hs_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->hs_codec_id == RT5682) {
 			links[i].codecs = rt5682;
@@ -1110,8 +1103,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
 		links[i].dpcm_capture = 1;
 		if (!drv_data->hs_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->hs_codec_id == NAU8825) {
 			links[i].codecs = nau8825;
@@ -1138,8 +1131,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
 		links[i].dpcm_playback = 1;
 		if (!drv_data->amp_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->amp_codec_id == RT1019) {
 			links[i].codecs = rt1019;
@@ -1173,8 +1166,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
 		links[i].dpcm_playback = 1;
 		if (!drv_data->amp_codec_id) {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		if (drv_data->amp_codec_id == MAX98360A) {
 			links[i].codecs = max98360a;
@@ -1201,8 +1194,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
 			links[i].num_codecs = ARRAY_SIZE(dmic_codec);
 		} else {
 			/* Use dummy codec if codec id not specified */
-			links[i].codecs = dummy_codec;
-			links[i].num_codecs = ARRAY_SIZE(dummy_codec);
+			links[i].codecs = &asoc_dummy_dlc;
+			links[i].num_codecs = 1;
 		}
 		links[i].cpus = pdm_dmic;
 		links[i].num_cpus = ARRAY_SIZE(pdm_dmic);
-- 
2.25.1


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

* [RESEND][PATCH v2 05/13] ASoC: fsl: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2023-05-08 23:51 ` [RESEND][PATCH v2 04/13] ASoC: amd: " Kuninori Morimoto
@ 2023-05-08 23:51 ` Kuninori Morimoto
  2023-05-08 23:51 ` [RESEND][PATCH v2 06/13] ASoC: qcom: " Kuninori Morimoto
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:51 UTC (permalink / raw)
  To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Sascha Hauer,
	Shawn Guo, Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: Fabio Estevam, Nicolin Chen, Shengjiu Wang, alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/fsl/imx-audmix.c | 14 +++++---------
 sound/soc/fsl/imx-card.c   | 11 +----------
 sound/soc/fsl/imx-rpmsg.c  |  3 +--
 sound/soc/fsl/imx-spdif.c  |  8 +++-----
 4 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
index b2c5aca92c6b..efbcd4a65ca8 100644
--- a/sound/soc/fsl/imx-audmix.c
+++ b/sound/soc/fsl/imx-audmix.c
@@ -207,8 +207,8 @@ static int imx_audmix_probe(struct platform_device *pdev)
 	for (i = 0; i < num_dai; i++) {
 		struct snd_soc_dai_link_component *dlc;
 
-		/* for CPU/Codec x 2 */
-		dlc = devm_kcalloc(&pdev->dev, 4, sizeof(*dlc), GFP_KERNEL);
+		/* for CPU x 2 */
+		dlc = devm_kcalloc(&pdev->dev, 2, sizeof(*dlc), GFP_KERNEL);
 		if (!dlc)
 			return -ENOMEM;
 
@@ -244,7 +244,7 @@ static int imx_audmix_probe(struct platform_device *pdev)
 		 */
 		priv->dai[i].cpus	=
 		priv->dai[i].platforms	= &dlc[0];
-		priv->dai[i].codecs	= &dlc[1];
+		priv->dai[i].codecs	= &asoc_dummy_dlc;
 
 		priv->dai[i].num_cpus = 1;
 		priv->dai[i].num_codecs = 1;
@@ -252,8 +252,6 @@ static int imx_audmix_probe(struct platform_device *pdev)
 
 		priv->dai[i].name = dai_name;
 		priv->dai[i].stream_name = "HiFi-AUDMIX-FE";
-		priv->dai[i].codecs->dai_name = "snd-soc-dummy-dai";
-		priv->dai[i].codecs->name = "snd-soc-dummy";
 		priv->dai[i].cpus->of_node = args.np;
 		priv->dai[i].cpus->dai_name = dev_name(&cpu_pdev->dev);
 		priv->dai[i].dynamic = 1;
@@ -270,15 +268,13 @@ static int imx_audmix_probe(struct platform_device *pdev)
 		be_cp = devm_kasprintf(&pdev->dev, GFP_KERNEL,
 				       "AUDMIX-Capture-%d", i);
 
-		priv->dai[num_dai + i].cpus	= &dlc[2];
-		priv->dai[num_dai + i].codecs	= &dlc[3];
+		priv->dai[num_dai + i].cpus	= &dlc[1];
+		priv->dai[num_dai + i].codecs	= &asoc_dummy_dlc;
 
 		priv->dai[num_dai + i].num_cpus = 1;
 		priv->dai[num_dai + i].num_codecs = 1;
 
 		priv->dai[num_dai + i].name = be_name;
-		priv->dai[num_dai + i].codecs->dai_name = "snd-soc-dummy-dai";
-		priv->dai[num_dai + i].codecs->name = "snd-soc-dummy";
 		priv->dai[num_dai + i].cpus->of_node = audmix_np;
 		priv->dai[num_dai + i].cpus->dai_name = be_name;
 		priv->dai[num_dai + i].no_pcm = 1;
diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
index 64a4d7e9db60..78e2e3932ba5 100644
--- a/sound/soc/fsl/imx-card.c
+++ b/sound/soc/fsl/imx-card.c
@@ -615,17 +615,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
 				plat_data->type = CODEC_AK5552;
 
 		} else {
-			dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
-			if (!dlc) {
-				ret = -ENOMEM;
-				goto err;
-			}
-
-			link->codecs	 = dlc;
+			link->codecs	 = &asoc_dummy_dlc;
 			link->num_codecs = 1;
-
-			link->codecs->dai_name = "snd-soc-dummy-dai";
-			link->codecs->name = "snd-soc-dummy";
 		}
 
 		if (!strncmp(link->name, "HiFi-ASRC-FE", 12)) {
diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c
index 89178106fe2c..93fc976e98dc 100644
--- a/sound/soc/fsl/imx-rpmsg.c
+++ b/sound/soc/fsl/imx-rpmsg.c
@@ -92,8 +92,7 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
 	/* Optional codec node */
 	ret = of_parse_phandle_with_fixed_args(np, "audio-codec", 0, 0, &args);
 	if (ret) {
-		data->dai.codecs->dai_name = "snd-soc-dummy-dai";
-		data->dai.codecs->name = "snd-soc-dummy";
+		*data->dai.codecs = asoc_dummy_dlc;
 	} else {
 		struct clk *clk;
 
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c
index ab978431ac98..44463f92e522 100644
--- a/sound/soc/fsl/imx-spdif.c
+++ b/sound/soc/fsl/imx-spdif.c
@@ -26,7 +26,7 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
 	}
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
-	comp = devm_kzalloc(&pdev->dev, 2 * sizeof(*comp), GFP_KERNEL);
+	comp = devm_kzalloc(&pdev->dev, sizeof(*comp), GFP_KERNEL);
 	if (!data || !comp) {
 		ret = -ENOMEM;
 		goto end;
@@ -37,8 +37,8 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
 	 * platform is using soc-generic-dmaengine-pcm
 	 */
 	data->dai.cpus		=
-	data->dai.platforms	= &comp[0];
-	data->dai.codecs	= &comp[1];
+	data->dai.platforms	= comp;
+	data->dai.codecs	= &asoc_dummy_dlc;
 
 	data->dai.num_cpus	= 1;
 	data->dai.num_codecs	= 1;
@@ -46,8 +46,6 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
 
 	data->dai.name = "S/PDIF PCM";
 	data->dai.stream_name = "S/PDIF PCM";
-	data->dai.codecs->dai_name = "snd-soc-dummy-dai";
-	data->dai.codecs->name = "snd-soc-dummy";
 	data->dai.cpus->of_node = spdif_np;
 	data->dai.playback_only = true;
 	data->dai.capture_only = true;
-- 
2.25.1


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

* [RESEND][PATCH v2 06/13] ASoC: qcom: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2023-05-08 23:51 ` [RESEND][PATCH v2 05/13] ASoC: fsl: " Kuninori Morimoto
@ 2023-05-08 23:51 ` Kuninori Morimoto
  2023-05-08 23:51 ` [RESEND][PATCH v2 07/13] ASoC: atmel: " Kuninori Morimoto
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:51 UTC (permalink / raw)
  To: Banajit Goswami, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Srinivas Kandagatla, Stephan Gerhold, Takashi Iwai
  Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/qcom/common.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index c1f24af17506..cab5a7937a57 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -140,17 +140,8 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
 			}
 		} else {
 			/* DPCM frontend */
-			dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
-			if (!dlc) {
-				ret = -ENOMEM;
-				goto err;
-			}
-
-			link->codecs	 = dlc;
+			link->codecs	 = &asoc_dummy_dlc;
 			link->num_codecs = 1;
-
-			link->codecs->dai_name = "snd-soc-dummy-dai";
-			link->codecs->name = "snd-soc-dummy";
 			link->dynamic = 1;
 		}
 
-- 
2.25.1


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

* [RESEND][PATCH v2 07/13] ASoC: atmel: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2023-05-08 23:51 ` [RESEND][PATCH v2 06/13] ASoC: qcom: " Kuninori Morimoto
@ 2023-05-08 23:51 ` Kuninori Morimoto
  2023-05-08 23:52 ` [RESEND][PATCH v2 08/13] ASoC: meson: " Kuninori Morimoto
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:51 UTC (permalink / raw)
  To: Alexandre Belloni, Claudiu Beznea, Jaroslav Kysela,
	Liam Girdwood, Mark Brown, Nicolas Ferre, Takashi Iwai
  Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/atmel/atmel-classd.c | 8 +++-----
 sound/soc/atmel/atmel-pdmic.c  | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index 007ab746973d..4c1985711218 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -473,21 +473,19 @@ static int atmel_classd_asoc_card_init(struct device *dev,
 	if (!dai_link)
 		return -ENOMEM;
 
-	comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL);
+	comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
 	if (!comp)
 		return -ENOMEM;
 
-	dai_link->cpus		= &comp[0];
-	dai_link->codecs	= &comp[1];
+	dai_link->cpus		= comp;
+	dai_link->codecs	= &asoc_dummy_dlc;
 
 	dai_link->num_cpus	= 1;
 	dai_link->num_codecs	= 1;
 
 	dai_link->name			= "CLASSD";
 	dai_link->stream_name		= "CLASSD PCM";
-	dai_link->codecs->dai_name	= "snd-soc-dummy-dai";
 	dai_link->cpus->dai_name	= dev_name(dev);
-	dai_link->codecs->name		= "snd-soc-dummy";
 
 	card->dai_link	= dai_link;
 	card->num_links	= 1;
diff --git a/sound/soc/atmel/atmel-pdmic.c b/sound/soc/atmel/atmel-pdmic.c
index 00c7b3a34ef5..efcbdd1a629f 100644
--- a/sound/soc/atmel/atmel-pdmic.c
+++ b/sound/soc/atmel/atmel-pdmic.c
@@ -496,21 +496,19 @@ static int atmel_pdmic_asoc_card_init(struct device *dev,
 	if (!dai_link)
 		return -ENOMEM;
 
-	comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL);
+	comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
 	if (!comp)
 		return -ENOMEM;
 
-	dai_link->cpus		= &comp[0];
-	dai_link->codecs	= &comp[1];
+	dai_link->cpus		= comp;
+	dai_link->codecs	= &asoc_dummy_dlc;
 
 	dai_link->num_cpus	= 1;
 	dai_link->num_codecs	= 1;
 
 	dai_link->name			= "PDMIC";
 	dai_link->stream_name		= "PDMIC PCM";
-	dai_link->codecs->dai_name	= "snd-soc-dummy-dai";
 	dai_link->cpus->dai_name	= dev_name(dev);
-	dai_link->codecs->name		= "snd-soc-dummy";
 
 	card->dai_link	= dai_link;
 	card->num_links	= 1;
-- 
2.25.1


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

* [RESEND][PATCH v2 08/13] ASoC: meson: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2023-05-08 23:51 ` [RESEND][PATCH v2 07/13] ASoC: atmel: " Kuninori Morimoto
@ 2023-05-08 23:52 ` Kuninori Morimoto
  2023-05-08 23:52 ` [RESEND][PATCH v2 09/13] ASoC: intel: avs: " Kuninori Morimoto
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:52 UTC (permalink / raw)
  To: Jaroslav Kysela, Jerome Brunet, Kevin Hilman, Liam Girdwood,
	Mark Brown, Neil Armstrong, Takashi Iwai
  Cc: Martin Blumenstingl, alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/meson/axg-card.c         |  8 +++-----
 sound/soc/meson/meson-card-utils.c | 10 +---------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c
index a25c397c66c5..74e7cf0ef8d5 100644
--- a/sound/soc/meson/axg-card.c
+++ b/sound/soc/meson/axg-card.c
@@ -120,20 +120,18 @@ static int axg_card_add_tdm_loopback(struct snd_soc_card *card,
 	if (!lb->name)
 		return -ENOMEM;
 
-	dlc = devm_kzalloc(card->dev, 2 * sizeof(*dlc), GFP_KERNEL);
+	dlc = devm_kzalloc(card->dev, sizeof(*dlc), GFP_KERNEL);
 	if (!dlc)
 		return -ENOMEM;
 
-	lb->cpus = &dlc[0];
-	lb->codecs = &dlc[1];
+	lb->cpus = dlc;
+	lb->codecs = &asoc_dummy_dlc;
 	lb->num_cpus = 1;
 	lb->num_codecs = 1;
 
 	lb->stream_name = lb->name;
 	lb->cpus->of_node = pad->cpus->of_node;
 	lb->cpus->dai_name = "TDM Loopback";
-	lb->codecs->name = "snd-soc-dummy";
-	lb->codecs->dai_name = "snd-soc-dummy-dai";
 	lb->dpcm_capture = 1;
 	lb->no_pcm = 1;
 	lb->ops = &axg_card_tdm_be_ops;
diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c
index 2d8d5717fd8b..ffc5111f9e3c 100644
--- a/sound/soc/meson/meson-card-utils.c
+++ b/sound/soc/meson/meson-card-utils.c
@@ -183,21 +183,13 @@ int meson_card_set_fe_link(struct snd_soc_card *card,
 			   struct device_node *node,
 			   bool is_playback)
 {
-	struct snd_soc_dai_link_component *codec;
-
-	codec = devm_kzalloc(card->dev, sizeof(*codec), GFP_KERNEL);
-	if (!codec)
-		return -ENOMEM;
-
-	link->codecs = codec;
+	link->codecs = &asoc_dummy_dlc;
 	link->num_codecs = 1;
 
 	link->dynamic = 1;
 	link->dpcm_merged_format = 1;
 	link->dpcm_merged_chan = 1;
 	link->dpcm_merged_rate = 1;
-	link->codecs->dai_name = "snd-soc-dummy-dai";
-	link->codecs->name = "snd-soc-dummy";
 
 	if (is_playback)
 		link->dpcm_playback = 1;
-- 
2.25.1


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

* [RESEND][PATCH v2 09/13] ASoC: intel: avs: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2023-05-08 23:52 ` [RESEND][PATCH v2 08/13] ASoC: meson: " Kuninori Morimoto
@ 2023-05-08 23:52 ` Kuninori Morimoto
  2023-05-08 23:52 ` [RESEND][PATCH v2 10/13] ASoC: intel: sof: " Kuninori Morimoto
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:52 UTC (permalink / raw)
  To: Bard Liao, Cezary Rojewski, Jaroslav Kysela, Kai Vehmanen,
	Liam Girdwood, Mark Brown, Peter Ujfalusi, Pierre-Louis Bossart,
	Ranjani Sridharan, Takashi Iwai
  Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/intel/avs/boards/i2s_test.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/avs/boards/i2s_test.c b/sound/soc/intel/avs/boards/i2s_test.c
index 8f0fd87bc866..bc3065c6ceda 100644
--- a/sound/soc/intel/avs/boards/i2s_test.c
+++ b/sound/soc/intel/avs/boards/i2s_test.c
@@ -28,13 +28,11 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
 
 	dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port);
 	dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL);
-	dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL);
-	if (!dl->name || !dl->cpus || !dl->codecs)
+	if (!dl->name || !dl->cpus)
 		return -ENOMEM;
 
 	dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port);
-	dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "snd-soc-dummy");
-	dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "snd-soc-dummy-dai");
+	dl->codecs = &asoc_dummy_dlc;
 	if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name)
 		return -ENOMEM;
 
-- 
2.25.1


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

* [RESEND][PATCH v2 10/13] ASoC: intel: sof: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2023-05-08 23:52 ` [RESEND][PATCH v2 09/13] ASoC: intel: avs: " Kuninori Morimoto
@ 2023-05-08 23:52 ` Kuninori Morimoto
  2023-05-08 23:52 ` [RESEND][PATCH v2 11/13] ASoC: intel: skylake: " Kuninori Morimoto
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:52 UTC (permalink / raw)
  To: Bard Liao, Brent Lu, Cezary Rojewski, Jaroslav Kysela,
	Kai Vehmanen, Liam Girdwood, Mark Brown, Peter Ujfalusi,
	Pierre-Louis Bossart, Ranjani Sridharan, Takashi Iwai
  Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/intel/boards/ehl_rt5660.c  |  8 ++------
 sound/soc/intel/boards/sof_cs42l42.c | 11 ++---------
 sound/soc/intel/boards/sof_es8336.c  | 11 ++---------
 sound/soc/intel/boards/sof_nau8825.c | 11 ++---------
 sound/soc/intel/boards/sof_pcm512x.c |  3 +--
 sound/soc/intel/boards/sof_rt5682.c  | 14 +++-----------
 sound/soc/intel/boards/sof_sdw.c     | 13 ++-----------
 sound/soc/intel/boards/sof_ssp_amp.c | 18 +++++-------------
 8 files changed, 19 insertions(+), 70 deletions(-)

diff --git a/sound/soc/intel/boards/ehl_rt5660.c b/sound/soc/intel/boards/ehl_rt5660.c
index d5235c294c4c..fee80638cba2 100644
--- a/sound/soc/intel/boards/ehl_rt5660.c
+++ b/sound/soc/intel/boards/ehl_rt5660.c
@@ -254,7 +254,6 @@ static void hdmi_link_init(struct snd_soc_card *card,
 			   struct sof_card_private *ctx,
 			   struct snd_soc_acpi_mach *mach)
 {
-	struct snd_soc_dai_link *link;
 	int i;
 
 	if (mach->mach_params.common_hdmi_codec_drv &&
@@ -267,11 +266,8 @@ static void hdmi_link_init(struct snd_soc_card *card,
 	 * if HDMI is not enabled in kernel config, or
 	 * hdmi codec is not supported
 	 */
-	for (i = HDMI_LINK_START; i <= HDMI_LINE_END; i++) {
-		link = &card->dai_link[i];
-		link->codecs[0].name = "snd-soc-dummy";
-		link->codecs[0].dai_name = "snd-soc-dummy-dai";
-	}
+	for (i = HDMI_LINK_START; i <= HDMI_LINE_END; i++)
+		card->dai_link[i].codecs[0] = asoc_dummy_dlc;
 }
 
 static int snd_ehl_rt5660_probe(struct platform_device *pdev)
diff --git a/sound/soc/intel/boards/sof_cs42l42.c b/sound/soc/intel/boards/sof_cs42l42.c
index e9d190cb13b0..e6695e77d594 100644
--- a/sound/soc/intel/boards/sof_cs42l42.c
+++ b/sound/soc/intel/boards/sof_cs42l42.c
@@ -296,13 +296,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
 	}
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-	{
-		.name = "snd-soc-dummy",
-		.dai_name = "snd-soc-dummy-dai",
-	}
-};
-
 static int create_spk_amp_dai_links(struct device *dev,
 				    struct snd_soc_dai_link *links,
 				    struct snd_soc_dai_link_component *cpus,
@@ -510,8 +503,8 @@ static int create_bt_offload_dai_links(struct device *dev,
 		goto devm_err;
 
 	links[*id].id = *id;
-	links[*id].codecs = dummy_component;
-	links[*id].num_codecs = ARRAY_SIZE(dummy_component);
+	links[*id].codecs = &asoc_dummy_dlc;
+	links[*id].num_codecs = 1;
 	links[*id].platforms = platform_component;
 	links[*id].num_platforms = ARRAY_SIZE(platform_component);
 
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index adf5852b2c9a..d6c38d8ea2ff 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -393,13 +393,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
 	}
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-	{
-		.name = "snd-soc-dummy",
-		.dai_name = "snd-soc-dummy-dai",
-	}
-};
-
 static int sof_es8336_late_probe(struct snd_soc_card *card)
 {
 	struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card);
@@ -572,8 +565,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 			if (!links[id].name)
 				return NULL;
 			links[id].id = id + hdmi_id_offset;
-			links[id].codecs = dummy_component;
-			links[id].num_codecs = ARRAY_SIZE(dummy_component);
+			links[id].codecs = &asoc_dummy_dlc;
+			links[id].num_codecs = 1;
 			links[id].platforms = platform_component;
 			links[id].num_platforms = ARRAY_SIZE(platform_component);
 			links[id].dpcm_capture = 1;
diff --git a/sound/soc/intel/boards/sof_nau8825.c b/sound/soc/intel/boards/sof_nau8825.c
index 6794a0249a9a..30e798431e1f 100644
--- a/sound/soc/intel/boards/sof_nau8825.c
+++ b/sound/soc/intel/boards/sof_nau8825.c
@@ -346,13 +346,6 @@ static struct snd_soc_dai_link_component nau8318_components[] = {
 	}
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-	{
-		.name = "snd-soc-dummy",
-		.dai_name = "snd-soc-dummy-dai",
-	}
-};
-
 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 							  int ssp_codec,
 							  int ssp_amp,
@@ -532,8 +525,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 		links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
 		if (!links[id].name)
 			goto devm_err;
-		links[id].codecs = dummy_component;
-		links[id].num_codecs = ARRAY_SIZE(dummy_component);
+		links[id].codecs = &asoc_dummy_dlc;
+		links[id].num_codecs = 1;
 		links[id].platforms = platform_component;
 		links[id].num_platforms = ARRAY_SIZE(platform_component);
 		links[id].dpcm_playback = 1;
diff --git a/sound/soc/intel/boards/sof_pcm512x.c b/sound/soc/intel/boards/sof_pcm512x.c
index 5192e02b3cee..9f673ccf81b5 100644
--- a/sound/soc/intel/boards/sof_pcm512x.c
+++ b/sound/soc/intel/boards/sof_pcm512x.c
@@ -331,8 +331,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 				devm_kasprintf(dev, GFP_KERNEL,
 					       "intel-hdmi-hifi%d", i);
 		} else {
-			idisp_components[i - 1].name = "snd-soc-dummy";
-			idisp_components[i - 1].dai_name = "snd-soc-dummy-dai";
+			idisp_components[i - 1] = asoc_dummy_dlc;
 		}
 		if (!idisp_components[i - 1].dai_name)
 			goto devm_err;
diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index 791a59c5f00d..7f4783592668 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -607,13 +607,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
 	}
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-	{
-		.name = "snd-soc-dummy",
-		.dai_name = "snd-soc-dummy-dai",
-	}
-};
-
 #define IDISP_CODEC_MASK	0x4
 
 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
@@ -745,8 +738,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 			if (!idisp_components[i - 1].dai_name)
 				goto devm_err;
 		} else {
-			idisp_components[i - 1].name = "snd-soc-dummy";
-			idisp_components[i - 1].dai_name = "snd-soc-dummy-dai";
+			idisp_components[i - 1] = asoc_dummy_dlc;
 		}
 
 		links[id].codecs = &idisp_components[i - 1];
@@ -841,8 +833,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 		links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
 		if (!links[id].name)
 			goto devm_err;
-		links[id].codecs = dummy_component;
-		links[id].num_codecs = ARRAY_SIZE(dummy_component);
+		links[id].codecs = &asoc_dummy_dlc;
+		links[id].num_codecs = 1;
 		links[id].platforms = platform_component;
 		links[id].num_platforms = ARRAY_SIZE(platform_component);
 		links[id].dpcm_playback = 1;
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 6faf4a43eaf5..c845a5cf7f4d 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -1488,8 +1488,7 @@ static int sof_card_dai_links_create(struct device *dev,
 			if (!idisp_components[i].dai_name)
 				return -ENOMEM;
 		} else {
-			idisp_components[i].name = "snd-soc-dummy";
-			idisp_components[i].dai_name = "snd-soc-dummy-dai";
+			idisp_components[i] = asoc_dummy_dlc;
 		}
 
 		cpu_name = devm_kasprintf(dev, GFP_KERNEL,
@@ -1514,21 +1513,13 @@ static int sof_card_dai_links_create(struct device *dev,
 		if (!name)
 			return -ENOMEM;
 
-		ssp_components = devm_kzalloc(dev, sizeof(*ssp_components),
-						GFP_KERNEL);
-		if (!ssp_components)
-			return -ENOMEM;
-
-		ssp_components->name = "snd-soc-dummy";
-		ssp_components->dai_name = "snd-soc-dummy-dai";
-
 		cpu_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port);
 		if (!cpu_name)
 			return -ENOMEM;
 
 		cpus[cpu_id].dai_name = cpu_name;
 		init_dai_link(dev, links + link_index, be_id, name, 1, 1,
-				cpus + cpu_id, 1, ssp_components, 1, NULL, NULL);
+				cpus + cpu_id, 1, &asoc_dummy_dlc, 1, NULL, NULL);
 	}
 
 	card->dai_link = links;
diff --git a/sound/soc/intel/boards/sof_ssp_amp.c b/sound/soc/intel/boards/sof_ssp_amp.c
index ffd9c583dab1..b33f720b3e6d 100644
--- a/sound/soc/intel/boards/sof_ssp_amp.c
+++ b/sound/soc/intel/boards/sof_ssp_amp.c
@@ -167,13 +167,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
 	}
 };
 
-static struct snd_soc_dai_link_component dummy_component[] = {
-	{
-		.name = "snd-soc-dummy",
-		.dai_name = "snd-soc-dummy-dai",
-	}
-};
-
 static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
@@ -233,8 +226,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 			if (!links[id].name)
 				return NULL;
 			links[id].id = id;
-			links[id].codecs = dummy_component;
-			links[id].num_codecs = ARRAY_SIZE(dummy_component);
+			links[id].codecs = &asoc_dummy_dlc;
+			links[id].num_codecs = 1;
 			links[id].platforms = platform_component;
 			links[id].num_platforms = ARRAY_SIZE(platform_component);
 			links[id].dpcm_capture = 1;
@@ -331,8 +324,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 				if (!idisp_components[i - 1].dai_name)
 					goto devm_err;
 			} else {
-				idisp_components[i - 1].name = "snd-soc-dummy";
-				idisp_components[i - 1].dai_name = "snd-soc-dummy-dai";
+				idisp_components[i - 1] = asoc_dummy_dlc;
 			}
 
 			links[id].codecs = &idisp_components[i - 1];
@@ -360,8 +352,8 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 		links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
 		if (!links[id].name)
 			goto devm_err;
-		links[id].codecs = dummy_component;
-		links[id].num_codecs = ARRAY_SIZE(dummy_component);
+		links[id].codecs = &asoc_dummy_dlc;
+		links[id].num_codecs = 1;
 		links[id].platforms = platform_component;
 		links[id].num_platforms = ARRAY_SIZE(platform_component);
 		links[id].dpcm_playback = 1;
-- 
2.25.1


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

* [RESEND][PATCH v2 11/13] ASoC: intel: skylake: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2023-05-08 23:52 ` [RESEND][PATCH v2 10/13] ASoC: intel: sof: " Kuninori Morimoto
@ 2023-05-08 23:52 ` Kuninori Morimoto
  2023-05-08 23:52 ` [RESEND][PATCH v2 12/13] ASoC: simple_card_utils.c: " Kuninori Morimoto
  2023-05-08 23:52 ` [RESEND][PATCH v2 13/13] ASoC: soc-topology.c: add comment for Platform/Codec Kuninori Morimoto
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:52 UTC (permalink / raw)
  To: Bard Liao, Cezary Rojewski, Jaroslav Kysela, Kai Vehmanen,
	Liam Girdwood, Mark Brown, Peter Ujfalusi, Pierre-Louis Bossart,
	Ranjani Sridharan, Takashi Iwai
  Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/intel/boards/skl_hda_dsp_generic.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c
index 879ebba52832..a06e05154ae1 100644
--- a/sound/soc/intel/boards/skl_hda_dsp_generic.c
+++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c
@@ -61,9 +61,6 @@ static const struct snd_soc_dapm_route skl_hda_map[] = {
 	{ "Alt Analog CPU Capture", NULL, "Alt Analog Codec Capture" },
 };
 
-SND_SOC_DAILINK_DEF(dummy_codec,
-	DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")));
-
 static int skl_hda_card_late_probe(struct snd_soc_card *card)
 {
 	return skl_hda_hdmi_jack_init(card);
@@ -158,9 +155,8 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
 		card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
 		if (!ctx->idisp_codec) {
 			for (i = 0; i < IDISP_DAI_COUNT; i++) {
-				skl_hda_be_dai_links[i].codecs = dummy_codec;
-				skl_hda_be_dai_links[i].num_codecs =
-					ARRAY_SIZE(dummy_codec);
+				skl_hda_be_dai_links[i].codecs = &asoc_dummy_dlc;
+				skl_hda_be_dai_links[i].num_codecs = 1;
 			}
 		}
 	}
-- 
2.25.1


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

* [RESEND][PATCH v2 12/13] ASoC: simple_card_utils.c: use asoc_dummy_dlc
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2023-05-08 23:52 ` [RESEND][PATCH v2 11/13] ASoC: intel: skylake: " Kuninori Morimoto
@ 2023-05-08 23:52 ` Kuninori Morimoto
  2023-05-08 23:52 ` [RESEND][PATCH v2 13/13] ASoC: soc-topology.c: add comment for Platform/Codec Kuninori Morimoto
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:52 UTC (permalink / raw)
  To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai; +Cc: alsa-devel

Now we can share asoc_dummy_dlc. This patch use it.

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

diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index a3f3f3aa9e6e..0e46f985eeda 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -73,7 +73,6 @@ struct asoc_simple_priv {
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dais;
 	struct snd_soc_dai_link_component *dlcs;
-	struct snd_soc_dai_link_component dummy;
 	struct snd_soc_codec_conf *codec_conf;
 	struct gpio_desc *pa_gpio;
 	const struct snd_soc_ops *ops;
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 467edd96eae5..b5ac0f0d5e8e 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -889,11 +889,6 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
 	dev_dbg(dev, "link %d, dais %d, ccnf %d\n",
 		li->link, dai_num, cnf_num);
 
-	/* dummy CPU/Codec */
-	priv->dummy.of_node	= NULL;
-	priv->dummy.dai_name	= "snd-soc-dummy-dai";
-	priv->dummy.name	= "snd-soc-dummy";
-
 	priv->dai_props		= dai_props;
 	priv->dai_link		= dai_link;
 	priv->dais		= dais;
@@ -919,7 +914,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
 		} else {
 			/* DPCM Be's CPU = dummy */
 			dai_props[i].cpus	=
-			dai_link[i].cpus	= &priv->dummy;
+			dai_link[i].cpus	= &asoc_dummy_dlc;
 			dai_props[i].num.cpus	=
 			dai_link[i].num_cpus	= 1;
 		}
@@ -943,7 +938,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
 		} else {
 			/* DPCM Fe's Codec = dummy */
 			dai_props[i].codecs	=
-			dai_link[i].codecs	= &priv->dummy;
+			dai_link[i].codecs	= &asoc_dummy_dlc;
 			dai_props[i].num.codecs	=
 			dai_link[i].num_codecs	= 1;
 		}
-- 
2.25.1


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

* [RESEND][PATCH v2 13/13] ASoC: soc-topology.c: add comment for Platform/Codec
  2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2023-05-08 23:52 ` [RESEND][PATCH v2 12/13] ASoC: simple_card_utils.c: " Kuninori Morimoto
@ 2023-05-08 23:52 ` Kuninori Morimoto
  12 siblings, 0 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2023-05-08 23:52 UTC (permalink / raw)
  To: Amadeusz, Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai
  Cc: alsa-devel

Not only Platform but Codec also might be overwritten on Topology.
This patch adds comment about it not to use asoc_dummy_dlc here.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-topology.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index d0aca6b9058b..47ab5cf99497 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1693,10 +1693,7 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
 	dlc = (struct snd_soc_dai_link_component *)(link + 1);
 
 	link->cpus	= &dlc[0];
-	link->codecs	= &dlc[1];
-
 	link->num_cpus	 = 1;
-	link->num_codecs = 1;
 
 	link->dobj.index = tplg->index;
 	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
@@ -1721,16 +1718,19 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
 		}
 	}
 
-	link->codecs->name = "snd-soc-dummy";
-	link->codecs->dai_name = "snd-soc-dummy-dai";
-
 	/*
-	 * Many topology is assuming link has Platform.
-	 * This might be overwritten at soc_tplg_dai_link_load().
+	 * Many topology are assuming link has Codec / Platform, and
+	 * these might be overwritten at soc_tplg_dai_link_load().
+	 * Don't use &asoc_dummy_dlc here.
 	 */
-	link->platforms	= &dlc[2];
-	link->platforms->name = "snd-soc-dummy";
-	link->num_platforms = 1;
+	link->codecs		= &dlc[1];	/* Don't use &asoc_dummy_dlc here */
+	link->codecs->name	= "snd-soc-dummy";
+	link->codecs->dai_name	= "snd-soc-dummy-dai";
+	link->num_codecs	= 1;
+
+	link->platforms		= &dlc[2];	/* Don't use &asoc_dummy_dlc here */
+	link->platforms->name	= "snd-soc-dummy";
+	link->num_platforms	= 1;
 
 	/* enable DPCM */
 	link->dynamic = 1;
-- 
2.25.1


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

end of thread, other threads:[~2023-05-08 23:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-08 23:49 [RESEND][PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc Kuninori Morimoto
2023-05-08 23:50 ` [RESEND][PATCH v2 01/13] ASoC: soc-utils.c: add asoc_dummy_dlc Kuninori Morimoto
2023-05-08 23:50 ` [RESEND][PATCH v2 02/13] ASoC: ti: use asoc_dummy_dlc Kuninori Morimoto
2023-05-08 23:50 ` [RESEND][PATCH v2 03/13] ASoC: sof: " Kuninori Morimoto
2023-05-08 23:51 ` [RESEND][PATCH v2 04/13] ASoC: amd: " Kuninori Morimoto
2023-05-08 23:51 ` [RESEND][PATCH v2 05/13] ASoC: fsl: " Kuninori Morimoto
2023-05-08 23:51 ` [RESEND][PATCH v2 06/13] ASoC: qcom: " Kuninori Morimoto
2023-05-08 23:51 ` [RESEND][PATCH v2 07/13] ASoC: atmel: " Kuninori Morimoto
2023-05-08 23:52 ` [RESEND][PATCH v2 08/13] ASoC: meson: " Kuninori Morimoto
2023-05-08 23:52 ` [RESEND][PATCH v2 09/13] ASoC: intel: avs: " Kuninori Morimoto
2023-05-08 23:52 ` [RESEND][PATCH v2 10/13] ASoC: intel: sof: " Kuninori Morimoto
2023-05-08 23:52 ` [RESEND][PATCH v2 11/13] ASoC: intel: skylake: " Kuninori Morimoto
2023-05-08 23:52 ` [RESEND][PATCH v2 12/13] ASoC: simple_card_utils.c: " Kuninori Morimoto
2023-05-08 23:52 ` [RESEND][PATCH v2 13/13] ASoC: soc-topology.c: add comment for Platform/Codec 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.