]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: soc-component: re-add pcm_new()/pcm_free()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 16 Mar 2026 02:24:43 +0000 (02:24 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 16 Mar 2026 13:37:41 +0000 (13:37 +0000)
Because old pcm_new()/pcm_free() didn't care about parameter component,
to avoid name collisions, we have added pcm_construct()/pcm_destruct() by
commit c64bfc9066007 ("ASoC: soc-core: add new pcm_construct/pcm_destruct")

Because all driver switch to new pcm_construct()/pcm_destruct(), old
pcm_new()/pcm_free() were remoted by commit e9067bb502787 ("ASoC:
soc-component: remove snd_pcm_ops from component driver")

But naming of pcm_construct()/pcm_destruct() are not goot. re-add
pcm_new()/pcm_free(), and switch to use it, again.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87a4w8lde4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-component.h
sound/soc/generic/audio-graph-card.c
sound/soc/soc-component.c

index 2a2b74b24a6096d5dcdcd3a02d5e2f8e8a4596e3..0435ba376369adaa0d0136b13b77c0c26ce3f355 100644 (file)
@@ -90,6 +90,10 @@ struct snd_soc_component_driver {
                             struct snd_soc_pcm_runtime *rtd);
        void (*pcm_destruct)(struct snd_soc_component *component,
                             struct snd_pcm *pcm);
+       int (*pcm_new)(struct snd_soc_component *component,
+                      struct snd_soc_pcm_runtime *rtd);
+       void (*pcm_free)(struct snd_soc_component *component,
+                        struct snd_pcm *pcm);
 
        /* component wide operations */
        int (*set_sysclk)(struct snd_soc_component *component,
index 8a5f41704739739319e02d1027c53a72d5cab93f..74e8f2ab7ffc9d253efb3cca939596a1b768af29 100644 (file)
@@ -77,6 +77,7 @@ static bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc)
        struct snd_soc_dai *dai = snd_soc_find_dai_with_mutex(dlc);
 
        if (dai && (dai->component->driver->pcm_construct ||
+                   dai->component->driver->pcm_new ||
                    (dai->driver->ops && dai->driver->ops->pcm_new)))
                return true;
 
index 89f236ab303414ef3d37556d772dbe8133d291d8..77ad3338397445be9972943578a729d6f200bb74 100644 (file)
@@ -1042,6 +1042,11 @@ int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd)
                        if (ret < 0)
                                return soc_component_ret(component, ret);
                }
+               if (component->driver->pcm_new) {
+                       ret = component->driver->pcm_new(component, rtd);
+                       if (ret < 0)
+                               return soc_component_ret(component, ret);
+               }
        }
 
        return 0;
@@ -1055,9 +1060,12 @@ void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd)
        if (!rtd->pcm)
                return;
 
-       for_each_rtd_components(rtd, i, component)
+       for_each_rtd_components(rtd, i, component) {
                if (component->driver->pcm_destruct)
                        component->driver->pcm_destruct(component, rtd->pcm);
+               if (component->driver->pcm_free)
+                       component->driver->pcm_free(component, rtd->pcm);
+       }
 }
 
 int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream)