[PATCH 0/6] ASoC: remove unnecessary dai_link->platform
Hi Mark
Current ASoC will ignore already connected component when binding Card. This will happen mainly "CPU Component" is handled as "Platform Component", which was needed before.
static int snd_soc_rtd_add_component(...) { ... for_each_rtd_components(rtd, i, comp) { /* already connected */ if (comp == component) return 0; } ... }
Some drivers are still using CPU or Dummy Component as Platform Component, but these are no meaning or ignored. This patch-set remove these.
Kuninori Morimoto (6): ASoC: fsl: remove unnecessary dai_link->platform ASoC: atmel: remove unnecessary dai_link->platform ASoC: ti: remove unnecessary dai_link->platform ASoC: soc-topology.c: remove unnecessary dai_link->platform ASoC: simple-card-utils.c: remove unnecessary dai_link->platform ASoC: simple-card.c: add missing of_node_put()
include/sound/simple_card_utils.h | 2 -- sound/soc/atmel/atmel-classd.c | 5 +--- sound/soc/atmel/atmel-pdmic.c | 5 +--- sound/soc/fsl/imx-audmix.c | 14 +++------ sound/soc/fsl/imx-spdif.c | 5 +--- sound/soc/generic/audio-graph-card.c | 6 ---- sound/soc/generic/audio-graph-card2.c | 9 ++---- sound/soc/generic/simple-card-utils.c | 9 ------ sound/soc/generic/simple-card.c | 41 ++++++++++++++++----------- sound/soc/soc-topology.c | 8 ++---- sound/soc/ti/omap-hdmi.c | 5 +--- 11 files changed, 36 insertions(+), 73 deletions(-)
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform. Dummy Platform is also not necessary.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/fsl/imx-audmix.c | 14 ++++---------- sound/soc/fsl/imx-spdif.c | 5 +---- 2 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c index 1292a845c424..2c57fe9d2d08 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 */ + dlc = devm_kcalloc(&pdev->dev, 4, sizeof(*dlc), GFP_KERNEL); if (!dlc) return -ENOMEM;
@@ -240,11 +240,9 @@ static int imx_audmix_probe(struct platform_device *pdev)
priv->dai[i].cpus = &dlc[0]; priv->dai[i].codecs = &dlc[1]; - priv->dai[i].platforms = &dlc[2];
priv->dai[i].num_cpus = 1; priv->dai[i].num_codecs = 1; - priv->dai[i].num_platforms = 1;
priv->dai[i].name = dai_name; priv->dai[i].stream_name = "HiFi-AUDMIX-FE"; @@ -252,7 +250,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,20 +264,17 @@ 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].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; diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c index 4446fba755b9..114b49660193 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, 3 * sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc(&pdev->dev, 2 * sizeof(*comp), GFP_KERNEL); if (!data || !comp) { ret = -ENOMEM; goto end; @@ -34,18 +34,15 @@ static int imx_spdif_audio_probe(struct platform_device *pdev)
data->dai.cpus = &comp[0]; data->dai.codecs = &comp[1]; - data->dai.platforms = &comp[2];
data->dai.num_cpus = 1; data->dai.num_codecs = 1; - data->dai.num_platforms = 1;
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.platforms->of_node = spdif_np; data->dai.playback_only = true; data->dai.capture_only = true;
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/atmel/atmel-classd.c | 5 +---- sound/soc/atmel/atmel-pdmic.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c index 9883e6867fd1..007ab746973d 100644 --- a/sound/soc/atmel/atmel-classd.c +++ b/sound/soc/atmel/atmel-classd.c @@ -473,24 +473,21 @@ static int atmel_classd_asoc_card_init(struct device *dev, if (!dai_link) return -ENOMEM;
- comp = devm_kzalloc(dev, 3 * sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); if (!comp) return -ENOMEM;
dai_link->cpus = &comp[0]; dai_link->codecs = &comp[1]; - dai_link->platforms = &comp[2];
dai_link->num_cpus = 1; dai_link->num_codecs = 1; - dai_link->num_platforms = 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"; - dai_link->platforms->name = dev_name(dev);
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 12cd40b15644..00c7b3a34ef5 100644 --- a/sound/soc/atmel/atmel-pdmic.c +++ b/sound/soc/atmel/atmel-pdmic.c @@ -496,24 +496,21 @@ static int atmel_pdmic_asoc_card_init(struct device *dev, if (!dai_link) return -ENOMEM;
- comp = devm_kzalloc(dev, 3 * sizeof(*comp), GFP_KERNEL); + comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); if (!comp) return -ENOMEM;
dai_link->cpus = &comp[0]; dai_link->codecs = &comp[1]; - dai_link->platforms = &comp[2];
dai_link->num_cpus = 1; dai_link->num_codecs = 1; - dai_link->num_platforms = 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"; - dai_link->platforms->name = dev_name(dev);
card->dai_link = dai_link; card->num_links = 1;
On 15/03/2023 at 07:41, Kuninori Morimoto wrote:
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
It looks good to me: Acked-by: Nicolas Ferre nicolas.ferre@microchip.com
Thanks Kuninori for having taken care of these drivers. Best regards, Nicolas
sound/soc/atmel/atmel-classd.c | 5 +---- sound/soc/atmel/atmel-pdmic.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c index 9883e6867fd1..007ab746973d 100644 --- a/sound/soc/atmel/atmel-classd.c +++ b/sound/soc/atmel/atmel-classd.c @@ -473,24 +473,21 @@ static int atmel_classd_asoc_card_init(struct device *dev, if (!dai_link) return -ENOMEM;
comp = devm_kzalloc(dev, 3 * sizeof(*comp), GFP_KERNEL);
comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); if (!comp) return -ENOMEM; dai_link->cpus = &comp[0]; dai_link->codecs = &comp[1];
dai_link->platforms = &comp[2]; dai_link->num_cpus = 1; dai_link->num_codecs = 1;
dai_link->num_platforms = 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";
dai_link->platforms->name = dev_name(dev); 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 12cd40b15644..00c7b3a34ef5 100644 --- a/sound/soc/atmel/atmel-pdmic.c +++ b/sound/soc/atmel/atmel-pdmic.c @@ -496,24 +496,21 @@ static int atmel_pdmic_asoc_card_init(struct device *dev, if (!dai_link) return -ENOMEM;
comp = devm_kzalloc(dev, 3 * sizeof(*comp), GFP_KERNEL);
comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); if (!comp) return -ENOMEM; dai_link->cpus = &comp[0]; dai_link->codecs = &comp[1];
dai_link->platforms = &comp[2]; dai_link->num_cpus = 1; dai_link->num_codecs = 1;
dai_link->num_platforms = 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";
dai_link->platforms->name = dev_name(dev); card->dai_link = dai_link; card->num_links = 1;
-- 2.25.1
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/ti/omap-hdmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/sound/soc/ti/omap-hdmi.c b/sound/soc/ti/omap-hdmi.c index 0dc0475670ff..7d270092e6ec 100644 --- a/sound/soc/ti/omap-hdmi.c +++ b/sound/soc/ti/omap-hdmi.c @@ -365,20 +365,17 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev) if (!card->dai_link) return -ENOMEM;
- compnent = devm_kzalloc(dev, 3 * sizeof(*compnent), GFP_KERNEL); + compnent = devm_kzalloc(dev, 2 * sizeof(*compnent), GFP_KERNEL); if (!compnent) return -ENOMEM; card->dai_link->cpus = &compnent[0]; card->dai_link->num_cpus = 1; card->dai_link->codecs = &compnent[1]; card->dai_link->num_codecs = 1; - card->dai_link->platforms = &compnent[2]; - card->dai_link->num_platforms = 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->platforms->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;
On Wed, Mar 15, 2023 at 06:42:10AM +0000, Kuninori Morimoto wrote:
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
I've not poked at things to try to figure out if it's this specific patch yet but this series is breaking BeagleBone Black in my CI, none of the sample rates covered by pcm-test are supported:
https://lava.sirena.org.uk/scheduler/job/195516#L1430
some should be skipped due to being unsupported but we should see 48kHz playback covered:
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-topology.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 07421f5d4ebd..7f6424fa59ab 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1685,8 +1685,8 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, struct snd_soc_dai_link_component *dlc; int ret;
- /* link + cpu + codec + platform */ - link = devm_kzalloc(tplg->dev, sizeof(*link) + (3 * sizeof(*dlc)), GFP_KERNEL); + /* link + cpu + codec */ + link = devm_kzalloc(tplg->dev, sizeof(*link) + (2 * sizeof(*dlc)), GFP_KERNEL); if (link == NULL) return -ENOMEM;
@@ -1694,11 +1694,9 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
link->cpus = &dlc[0]; link->codecs = &dlc[1]; - link->platforms = &dlc[2];
link->num_cpus = 1; link->num_codecs = 1; - link->num_platforms = 1;
link->dobj.index = tplg->index; link->dobj.type = SND_SOC_DOBJ_DAI_LINK; @@ -1726,8 +1724,6 @@ 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";
- link->platforms->name = "snd-soc-dummy"; - /* enable DPCM */ link->dynamic = 1; link->ignore_pmdown_time = 1;
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
Simple-Card (Normal) is supporting platform, but Simple-Cadd (DPCM), Audio-Graph-Card/Card2 (Normal/DPCM) are not for now.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/simple_card_utils.h | 2 -- sound/soc/generic/audio-graph-card.c | 6 ---- sound/soc/generic/audio-graph-card2.c | 9 ++---- sound/soc/generic/simple-card-utils.c | 9 ------ sound/soc/generic/simple-card.c | 40 +++++++++++++++------------ 5 files changed, 25 insertions(+), 41 deletions(-)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index a3f3f3aa9e6e..aeb5ceba4019 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -167,8 +167,6 @@ int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, &(dai)->slots, \ &(dai)->slot_width);
-void asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms, - struct snd_soc_dai_link_component *cpus); void asoc_simple_canonicalize_cpu(struct snd_soc_dai_link_component *cpus, int is_single_links);
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 5daa824a4ffc..c709fc4a39ed 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -287,7 +287,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, if (li->cpu) { struct snd_soc_card *card = simple_priv_to_card(priv); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); int is_single_links = 0;
/* Codec is dummy */ @@ -318,7 +317,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, }
asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus); } else { struct snd_soc_codec_conf *cconf = simple_props_to_codec_conf(dai_props, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); @@ -372,7 +370,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); char dai_name[64]; int ret, is_single_links = 0;
@@ -390,7 +387,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, "%s-%s", cpus->dai_name, codecs->dai_name);
asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus);
ret = graph_link_init(priv, cpu_ep, codec_ep, li, dai_name); if (ret < 0) @@ -615,7 +611,6 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
li->num[li->link].cpus = 1; li->num[li->link].codecs = 1; - li->num[li->link].platforms = 1;
li->link += 1; /* 1xCPU-Codec */
@@ -638,7 +633,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
if (li->cpu) { li->num[li->link].cpus = 1; - li->num[li->link].platforms = 1;
li->link++; /* 1xCPU-dummy */ } else { diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 06609a526b78..9f154fc1bbb4 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -590,10 +590,8 @@ static int __graph_parse_node(struct asoc_simple_priv *priv,
if (is_cpu) { struct snd_soc_dai_link_component *cpus = dlc; - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, idx);
asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus); }
return 0; @@ -1046,8 +1044,7 @@ static int graph_count_normal(struct asoc_simple_priv *priv, * => lnk: port { endpoint { .. }; }; * }; */ - li->num[li->link].cpus = - li->num[li->link].platforms = graph_counter(cpu_port); + li->num[li->link].cpus = graph_counter(cpu_port); li->num[li->link].codecs = graph_counter(codec_port);
of_node_put(cpu_ep); @@ -1080,7 +1077,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
if (asoc_graph_is_ports0(lnk)) { li->num[li->link].cpus = graph_counter(rport); /* FE */ - li->num[li->link].platforms = graph_counter(rport); } else { li->num[li->link].codecs = graph_counter(rport); /* BE */ } @@ -1113,8 +1109,7 @@ static int graph_count_c2c(struct asoc_simple_priv *priv, * }; * }; */ - li->num[li->link].cpus = - li->num[li->link].platforms = graph_counter(codec0); + li->num[li->link].cpus = graph_counter(codec0); li->num[li->link].codecs = graph_counter(codec1);
of_node_put(ports); diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 56552a616f21..f1c228743d98 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -635,15 +635,6 @@ int asoc_simple_dai_init(struct snd_soc_pcm_runtime *rtd) } EXPORT_SYMBOL_GPL(asoc_simple_dai_init);
-void asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms, - struct snd_soc_dai_link_component *cpus) -{ - /* Assumes platform == cpu */ - if (!platforms->of_node) - platforms->of_node = cpus->of_node; -} -EXPORT_SYMBOL_GPL(asoc_simple_canonicalize_platform); - void asoc_simple_canonicalize_cpu(struct snd_soc_dai_link_component *cpus, int is_single_links) { diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index e98932c16754..b78d9db6ca5a 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -197,6 +197,7 @@ static int simple_link_init(struct asoc_simple_priv *priv, static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { @@ -217,7 +218,6 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
if (li->cpu) { struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); int is_single_links = 0;
/* Codec is dummy */ @@ -233,7 +233,6 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, snprintf(dai_name, sizeof(dai_name), "fe.%s", cpus->dai_name);
asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus); } else { struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); struct snd_soc_codec_conf *cconf; @@ -277,6 +276,7 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, static int simple_dai_link_of(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { @@ -284,12 +284,9 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); struct device_node *cpu = NULL; struct device_node *node = NULL; - struct device_node *plat = NULL; char dai_name[64]; - char prop[128]; char *prefix = ""; int ret, single_cpu = 0;
@@ -302,9 +299,6 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, if (is_top) prefix = PREFIX;
- snprintf(prop, sizeof(prop), "%splat", prefix); - plat = of_get_child_by_name(node, prop); - ret = simple_parse_node(priv, cpu, li, prefix, &single_cpu); if (ret < 0) goto dai_link_of_err; @@ -313,20 +307,22 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, if (ret < 0) goto dai_link_of_err;
- ret = asoc_simple_parse_platform(plat, platforms); - if (ret < 0) - goto dai_link_of_err; + if (platform) { + struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); + + ret = asoc_simple_parse_platform(platform, platforms); + if (ret < 0) + goto dai_link_of_err; + }
snprintf(dai_name, sizeof(dai_name), "%s-%s", cpus->dai_name, codecs->dai_name);
asoc_simple_canonicalize_cpu(cpus, single_cpu); - asoc_simple_canonicalize_platform(platforms, cpus);
ret = simple_link_init(priv, node, codec, li, prefix, dai_name);
dai_link_of_err: - of_node_put(plat); of_node_put(node);
li->link++; @@ -339,10 +335,12 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv, int (*func_noml)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top), int (*func_dpcm)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top)) { struct device *dev = simple_priv_to_dev(priv); @@ -401,7 +399,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv, * Codec |return|Pass */ if (li->cpu != (np == codec)) - ret = func_dpcm(priv, np, codec, li, is_top); + ret = func_dpcm(priv, np, codec, plat, li, is_top); /* else normal sound */ } else { /* @@ -411,7 +409,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv, * Codec |return|return */ if (li->cpu && (np != codec)) - ret = func_noml(priv, np, codec, li, is_top); + ret = func_noml(priv, np, codec, plat, li, is_top); }
if (ret < 0) { @@ -435,10 +433,12 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, int (*func_noml)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top), int (*func_dpcm)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top)) { int ret; @@ -500,6 +500,7 @@ static int simple_parse_of(struct asoc_simple_priv *priv, struct link_info *li) static int simple_count_noml(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { if (li->link >= SNDRV_MAX_LINKS) { @@ -511,7 +512,9 @@ static int simple_count_noml(struct asoc_simple_priv *priv,
li->num[li->link].cpus = 1; li->num[li->link].codecs = 1; - li->num[li->link].platforms = 1; + + if (platform) + li->num[li->link].platforms = 1;
li->link += 1;
@@ -521,6 +524,7 @@ static int simple_count_noml(struct asoc_simple_priv *priv, static int simple_count_dpcm(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { if (li->link >= SNDRV_MAX_LINKS) { @@ -531,8 +535,10 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv, }
if (li->cpu) { + if (platform) + li->num[li->link].platforms = 1; + li->num[li->link].cpus = 1; - li->num[li->link].platforms = 1;
li->link++; /* CPU-dummy */ } else {
On Wed, Mar 15, 2023 at 06:42:44AM +0000, Kuninori Morimoto wrote:
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
Simple-Card (Normal) is supporting platform, but Simple-Cadd (DPCM), Audio-Graph-Card/Card2 (Normal/DPCM) are not for now.
A bisect tells me that this patch rather than the TI one is responsible for the issues I'm seeing on BeagleBone Black.
Hi Mark
Thank you for your test
dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform.
Simple-Card (Normal) is supporting platform, but Simple-Cadd (DPCM), Audio-Graph-Card/Card2 (Normal/DPCM) are not for now.
A bisect tells me that this patch rather than the TI one is responsible for the issues I'm seeing on BeagleBone Black.
I see. I don't have BeagleBone thus this is my guess. I think BeagleBone is using soc-generic-dmaengine-pcm.c. This means, CPU and Platform are different Component, but are using same dev (= component->dev).
In this case, this patch assumes BeagleBone need to have "plat = <&xxx>" on DT (but it doesn't). And Simple Card have been covered it automatically (It assumes Platform == CPU if no Platform was selected).
Hmm... I recalled similar things happen before. OK, please drop this patch. We want to keep existing DT as-is.
But instead, I want to post other patch which add comment to Simple-Card that indicates Simple-Card is caring soc-generic-dmaengine-pcm automatically. Otherwise I will forget it again, and will repost same/similar patch again :)
Thank you for your help !!
Best regards --- Kuninori Morimoto
It is missing of_node_put() for platform. This patch fixup it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-card.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index b78d9db6ca5a..75176b89693d 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -420,6 +420,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv, }
of_node_put(codec); + of_node_put(plat); node = of_get_next_child(top, node); } while (!is_top && node);
On Wed, 15 Mar 2023 06:40:39 +0000, Kuninori Morimoto wrote:
Current ASoC will ignore already connected component when binding Card. This will happen mainly "CPU Component" is handled as "Platform Component", which was needed before.
static int snd_soc_rtd_add_component(...) { ... for_each_rtd_components(rtd, i, comp) { /* already connected */ if (comp == component) return 0; } ... }
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: fsl: remove unnecessary dai_link->platform commit: 33683cbf49b5412061cb1e4c876063fdef86def4 [2/6] ASoC: atmel: remove unnecessary dai_link->platform commit: 2f650f87c03cab72e751fc739f42a1e257bdc6b9 [3/6] ASoC: ti: remove unnecessary dai_link->platform commit: 3b0db249cf8fe0027e2a4161d27a8566d82fcd80 [4/6] ASoC: soc-topology.c: remove unnecessary dai_link->platform commit: e7098ba9b3785d626326040d300f95fec79aa765 [5/6] ASoC: simple-card-utils.c: remove unnecessary dai_link->platform (no commit info) [6/6] ASoC: simple-card.c: add missing of_node_put() commit: 92405802a7d6aa1953915af869192296d1792d18
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
-
Nicolas Ferre