[RFC][PATCH 0/4] ASoC: fsl: cleanup platform
Hi Mark Cc Shengjiu
The driver which is using soc-generic-dmaengine-pcm is a little bit difficult to notice about it, because it prepares own Component, but shares same component->dev with CPU Component.
Some fsl driver is using soc-generic-dmaengine-pcm as Platform Component.
When binding CPU/Codec, it finds relevant Component, and checks target DAI. If it it was target DAI, ASoC binds its Component to Card. In Platform case, it finds relevant Component and bind it. It doesn't check DAI. This means, we can share CPU dlc with Platform in this case. It is more reasonable / understandable / intuitive.
This patch-set share CPU dlc with Platform, and adds such comment.
Because I can't test this patch-set, thus I added [RFC] on Subject. Please test these. This patch-set requests Tested-by.
Link: https://lore.kernel.org/r/87o7ojjd06.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/1681900158-17428-1-git-send-email-shengjiu.wang@nx...
Kuninori Morimoto (4): ASoC: fsl: imx-es8328: cleanup platform which is using Generic DMA ASoC: fsl: imx-spdif: cleanup platform which is using Generic DMA ASoC: fsl: imx-audmix: cleanup platform which is using Generic DMA ASoC: fsl: imx-audmix: remove dummy dai_link->platform
sound/soc/fsl/imx-audmix.c | 22 +++++++++++----------- sound/soc/fsl/imx-es8328.c | 11 +++++++---- sound/soc/fsl/imx-spdif.c | 11 +++++++---- 3 files changed, 25 insertions(+), 19 deletions(-)
If CPU is using soc-generic-dmaengine-pcm, Platform Component will be same as CPU Component. In this case, we can use CPU dlc for Platform dlc. This patch shares CPU dlc with Platform, and add comment.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/fsl/imx-es8328.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/sound/soc/fsl/imx-es8328.c b/sound/soc/fsl/imx-es8328.c index b80c57362fb8..85bd36fb68a2 100644 --- a/sound/soc/fsl/imx-es8328.c +++ b/sound/soc/fsl/imx-es8328.c @@ -149,7 +149,7 @@ static int imx_es8328_probe(struct platform_device *pdev) goto put_device; }
- comp = devm_kzalloc(dev, 3 * sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); if (!comp) { ret = -ENOMEM; goto put_device; @@ -159,9 +159,13 @@ static int imx_es8328_probe(struct platform_device *pdev)
data->jack_gpio = of_get_named_gpio(pdev->dev.of_node, "jack-gpio", 0);
- data->dai.cpus = &comp[0]; + /* + * CPU == Platform + * platform is using soc-generic-dmaengine-pcm + */ + data->dai.cpus = + data->dai.platforms = &comp[0]; data->dai.codecs = &comp[1]; - data->dai.platforms = &comp[2];
data->dai.num_cpus = 1; data->dai.num_codecs = 1; @@ -172,7 +176,6 @@ static int imx_es8328_probe(struct platform_device *pdev) data->dai.codecs->dai_name = "es8328-hifi-analog"; data->dai.codecs->of_node = codec_np; data->dai.cpus->of_node = ssi_np; - data->dai.platforms->of_node = ssi_np; data->dai.init = &imx_es8328_dai_init; data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP;
If CPU is using soc-generic-dmaengine-pcm, Platform Component will be same as CPU Component. In this case, we can use CPU dlc for Platform dlc. This patch shares CPU dlc with Platform, and add comment.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/fsl/imx-spdif.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c index 4446fba755b9..ab978431ac98 100644 --- a/sound/soc/fsl/imx-spdif.c +++ b/sound/soc/fsl/imx-spdif.c @@ -26,15 +26,19 @@ static int imx_spdif_audio_probe(struct platform_device *pdev) }
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); - comp = devm_kzalloc(&pdev->dev, 3 * sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc(&pdev->dev, 2 * sizeof(*comp), GFP_KERNEL); if (!data || !comp) { ret = -ENOMEM; goto end; }
- data->dai.cpus = &comp[0]; + /* + * CPU == Platform + * platform is using soc-generic-dmaengine-pcm + */ + data->dai.cpus = + data->dai.platforms = &comp[0]; data->dai.codecs = &comp[1]; - data->dai.platforms = &comp[2];
data->dai.num_cpus = 1; data->dai.num_codecs = 1; @@ -45,7 +49,6 @@ static int imx_spdif_audio_probe(struct platform_device *pdev) 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.platforms->of_node = spdif_np; data->dai.playback_only = true; data->dai.capture_only = true;
If CPU is using soc-generic-dmaengine-pcm, Platform Component will be same as CPU Component. In this case, we can use CPU dlc for Platform dlc. This patch shares CPU dlc with Platform, and add comment.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/fsl/imx-audmix.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c index 1292a845c424..cabef0de3891 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/Platform x 2 */ - dlc = devm_kcalloc(&pdev->dev, 6, sizeof(*dlc), GFP_KERNEL); + /* for CPU/Codec x 2 + Platform */ + dlc = devm_kcalloc(&pdev->dev, 5, sizeof(*dlc), GFP_KERNEL); if (!dlc) return -ENOMEM;
@@ -238,9 +238,13 @@ static int imx_audmix_probe(struct platform_device *pdev) dai_name, "CPU-Capture"); }
- priv->dai[i].cpus = &dlc[0]; - priv->dai[i].codecs = &dlc[1]; - priv->dai[i].platforms = &dlc[2]; + /* + * CPU == Platform + * platform is using soc-generic-dmaengine-pcm + */ + priv->dai[i].cpus = + priv->dai[i].platforms = &dlc[0]; + priv->dai[i].codecs = &dlc[1];
priv->dai[i].num_cpus = 1; priv->dai[i].num_codecs = 1; @@ -252,7 +256,6 @@ static int imx_audmix_probe(struct platform_device *pdev) 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].platforms->of_node = args.np; priv->dai[i].dynamic = 1; priv->dai[i].dpcm_playback = 1; priv->dai[i].dpcm_capture = (i == 0 ? 1 : 0); @@ -267,9 +270,9 @@ 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[3]; - priv->dai[num_dai + i].codecs = &dlc[4]; - priv->dai[num_dai + i].platforms = &dlc[5]; + priv->dai[num_dai + i].cpus = &dlc[2]; + priv->dai[num_dai + i].codecs = &dlc[3]; + priv->dai[num_dai + i].platforms = &dlc[4];
priv->dai[num_dai + i].num_cpus = 1; priv->dai[num_dai + i].num_codecs = 1;
Dummy dai_link->platform is not needed.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/fsl/imx-audmix.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c index cabef0de3891..b2c5aca92c6b 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 + Platform */ - dlc = devm_kcalloc(&pdev->dev, 5, sizeof(*dlc), GFP_KERNEL); + /* for CPU/Codec x 2 */ + dlc = devm_kcalloc(&pdev->dev, 4, sizeof(*dlc), GFP_KERNEL); if (!dlc) return -ENOMEM;
@@ -272,18 +272,15 @@ static int imx_audmix_probe(struct platform_device *pdev)
priv->dai[num_dai + i].cpus = &dlc[2]; priv->dai[num_dai + i].codecs = &dlc[3]; - priv->dai[num_dai + i].platforms = &dlc[4];
priv->dai[num_dai + i].num_cpus = 1; priv->dai[num_dai + i].num_codecs = 1; - priv->dai[num_dai + i].num_platforms = 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].platforms->name = "snd-soc-dummy"; priv->dai[num_dai + i].no_pcm = 1; priv->dai[num_dai + i].dpcm_playback = 1; priv->dai[num_dai + i].dpcm_capture = 1;
On Fri, Apr 21, 2023 at 8:10 AM Kuninori Morimoto < kuninori.morimoto.gx@renesas.com> wrote:
Hi Mark Cc Shengjiu
The driver which is using soc-generic-dmaengine-pcm is a little bit difficult to notice about it, because it prepares own Component, but shares same component->dev with CPU Component.
Some fsl driver is using soc-generic-dmaengine-pcm as Platform Component.
When binding CPU/Codec, it finds relevant Component, and checks target DAI. If it it was target DAI, ASoC binds its Component to Card. In Platform case, it finds relevant Component and bind it. It doesn't check DAI. This means, we can share CPU dlc with Platform in this case. It is more reasonable / understandable / intuitive.
This patch-set share CPU dlc with Platform, and adds such comment.
Because I can't test this patch-set, thus I added [RFC] on Subject. Please test these. This patch-set requests Tested-by.
Link: https://lore.kernel.org/r/87o7ojjd06.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/1681900158-17428-1-git-send-email-shengjiu.wang@nx...
Acked-by: Shengjiu Wang shengjiu.wang@gmail.com Tested-by: Shengjiu Wang shengjiu.wang@gmail.com
Best regards Wang shengjiu
Kuninori Morimoto (4):
ASoC: fsl: imx-es8328: cleanup platform which is using Generic DMA ASoC: fsl: imx-spdif: cleanup platform which is using Generic DMA ASoC: fsl: imx-audmix: cleanup platform which is using Generic DMA ASoC: fsl: imx-audmix: remove dummy dai_link->platform
sound/soc/fsl/imx-audmix.c | 22 +++++++++++----------- sound/soc/fsl/imx-es8328.c | 11 +++++++---- sound/soc/fsl/imx-spdif.c | 11 +++++++---- 3 files changed, 25 insertions(+), 19 deletions(-)
-- 2.25.1
On Fri, 21 Apr 2023 00:10:32 +0000, Kuninori Morimoto wrote:
Cc Shengjiu
The driver which is using soc-generic-dmaengine-pcm is a little bit difficult to notice about it, because it prepares own Component, but shares same component->dev with CPU Component.
Some fsl driver is using soc-generic-dmaengine-pcm as Platform Component.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: fsl: imx-es8328: cleanup platform which is using Generic DMA commit: d6e28695dcb6f653c7f2adf38021a5e934a6f416 [2/4] ASoC: fsl: imx-spdif: cleanup platform which is using Generic DMA commit: 2324bc107b0b3d2de351f35032dc5093cbb61493 [3/4] ASoC: fsl: imx-audmix: cleanup platform which is using Generic DMA commit: 3ce08f85133fc93278801aba3efb4548d3ef3ca0 [4/4] ASoC: fsl: imx-audmix: remove dummy dai_link->platform commit: dc801ea8ae37d54706e6f1cef140731ac5981c9c
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Kuninori Morimoto
-
Mark Brown
-
Shengjiu Wang