[PATCH v2 05/13] ASoC: fsl: use asoc_dummy_dlc

2023-04-23 Thread Kuninori Morimoto
Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto 
---
 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(>dev, 4, sizeof(*dlc), GFP_KERNEL);
+   /* for CPU x 2 */
+   dlc = devm_kcalloc(>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  = [0];
-   priv->dai[i].codecs = [1];
+   priv->dai[i].codecs = _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(_pdev->dev);
priv->dai[i].dynamic = 1;
@@ -270,15 +268,13 @@ static int imx_audmix_probe(struct platform_device *pdev)
be_cp = devm_kasprintf(>dev, GFP_KERNEL,
   "AUDMIX-Capture-%d", i);
 
-   priv->dai[num_dai + i].cpus = [2];
-   priv->dai[num_dai + i].codecs   = [3];
+   priv->dai[num_dai + i].cpus = [1];
+   priv->dai[num_dai + i].codecs   = _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 = _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, );
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(>dev, sizeof(*data), GFP_KERNEL);
-   comp = devm_kzalloc(>dev, 2 * sizeof(*comp), GFP_KERNEL);
+   comp = devm_kzalloc(>dev, 

[PATCH v2 00/13] ASoC: add and use asoc_dummy_dlc

2023-04-23 Thread Kuninori Morimoto


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.

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...@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



Re: [PATCH] Revert "ASoC: fsl: remove unnecessary dai_link->platform"

2023-04-19 Thread Kuninori Morimoto


Hi Shengjiu
Cc Mark

Thank you for the patch

> This reverts commit 33683cbf49b5412061cb1e4c876063fdef86def4.
> 
> dai_link->platform is needed. The platform component is
> "snd_dmaengine_pcm", which is registered from cpu driver,
> 
> If dai_link->platform is not assigned, then platform
> component will not be probed, then there will be issue:
> 
> aplay: main:831: audio open error: Invalid argument
> 
> Signed-off-by: Shengjiu Wang 
> ---

And sorry to my noise patch. I understood the issue.

Can I ask 2 things ?

My original patch removed 3 platforms.
Then, I understood that 2 of them are used as
soc-generic-dmaengine-pcm (= 1st, 3rd platform).

I think we want to have comment here that
why dummy component is needed. Can you agree ?

I wonder how about 2nd platform ? Is it same ?
I'm asking because it doesn't have of_node which other 2 platforms have.

Thank you for your help !!

Best regards
---
Kuninori Morimoto


[PATCH 06/11] ASoC: fsl: use asoc_dummy_dlc

2023-04-17 Thread Kuninori Morimoto
Now we can share asoc_dummy_dlc. This patch use it.

Signed-off-by: Kuninori Morimoto 
---
 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  |  6 ++
 4 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
index 2c57fe9d2d08..8287b366eea1 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(>dev, 4, sizeof(*dlc), GFP_KERNEL);
+   /* for CPU x 2 */
+   dlc = devm_kcalloc(>dev, 2, sizeof(*dlc), GFP_KERNEL);
if (!dlc)
return -ENOMEM;
 
@@ -239,15 +239,13 @@ static int imx_audmix_probe(struct platform_device *pdev)
}
 
priv->dai[i].cpus = [0];
-   priv->dai[i].codecs = [1];
+   priv->dai[i].codecs = _dummy_dlc;
 
priv->dai[i].num_cpus = 1;
priv->dai[i].num_codecs = 1;
 
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(_pdev->dev);
priv->dai[i].dynamic = 1;
@@ -264,15 +262,13 @@ static int imx_audmix_probe(struct platform_device *pdev)
be_cp = devm_kasprintf(>dev, GFP_KERNEL,
   "AUDMIX-Capture-%d", i);
 
-   priv->dai[num_dai + i].cpus = [2];
-   priv->dai[num_dai + i].codecs = [3];
+   priv->dai[num_dai + i].cpus = [1];
+   priv->dai[num_dai + i].codecs = _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 = _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, );
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 114b49660193..547be9438333 100644
--- a/sound/soc/fsl/imx-spdif.c
+++ b/sound/soc/fsl/imx-spdif.c
@@ -26,22 +26,20 @@ static int imx_spdif_audio_probe(struct platform_device 
*pdev)
}
 
data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
-   comp = devm_kzalloc(>dev, 2 * sizeof(*comp), GFP_KERNEL);
+   comp = devm_kzalloc(>dev, sizeof(*comp), GFP_KERNEL);
if (!data || !comp) {
ret = -ENOMEM;
goto end;
}
 
data->dai.cpus

Re: [alsa-devel] [PATCH] ASoC: Use of_node_name_eq for node name comparisons

2018-12-05 Thread Kuninori Morimoto


Hi Rob

> Convert string compares of DT node names to use of_node_name_eq helper
> instead. This removes direct access to the node name pointer.
> 
> For the FSL ASoC card, the full node names appear to be "ssi", "esai",
> and "sai", so there's not any reason to use strstr and of_node_name_eq
> can be used instead.

I guess this patch is for FSL ?

> ---
>  sound/soc/fsl/fsl-asoc-card.c   | 6 +++---
>  sound/soc/generic/simple-scu-card.c | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)

But, this patch is including simple-scu-card.
Is this miss ?


Best regards
---
Kuninori Morimoto