]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ASoC: soc-component: add snd_soc_pcm_component_prepare()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 4 Jun 2020 08:06:58 +0000 (17:06 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 15 Jun 2020 17:21:22 +0000 (18:21 +0100)
We have 2 type of component functions
snd_soc_component_xxx()     is focusing to component itself,
snd_soc_pcm_component_xxx() is focusing to rtd related component.

Now we can update snd_soc_component_prepare() to
snd_soc_pcm_component_prepare(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87o8pzw8yl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-component.h
sound/soc/soc-component.c
sound/soc/soc-pcm.c

index cb0d34fa77c6135469ce7bdad921470a457f9a23..fc287e910240a611981b3349ab926e2dd2e19891 100644 (file)
@@ -426,8 +426,6 @@ int snd_soc_component_open(struct snd_soc_component *component,
                           struct snd_pcm_substream *substream);
 int snd_soc_component_close(struct snd_soc_component *component,
                            struct snd_pcm_substream *substream);
-int snd_soc_component_prepare(struct snd_soc_component *component,
-                             struct snd_pcm_substream *substream);
 int snd_soc_component_hw_params(struct snd_soc_component *component,
                                struct snd_pcm_substream *substream,
                                struct snd_pcm_hw_params *params);
@@ -460,5 +458,6 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
                               struct vm_area_struct *vma);
 int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd);
 void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd);
+int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream);
 
 #endif /* __SOC_COMPONENT_H */
index 6d29c2de3b24f9ecc82126facb28f927a7b427fc..1bc155bc8e5eea30ea7519e5aca0e7e6e8221e9c 100644 (file)
@@ -275,17 +275,6 @@ int snd_soc_component_close(struct snd_soc_component *component,
        return soc_component_ret(component, ret);
 }
 
-int snd_soc_component_prepare(struct snd_soc_component *component,
-                             struct snd_pcm_substream *substream)
-{
-       int ret = 0;
-
-       if (component->driver->prepare)
-               ret = component->driver->prepare(component, substream);
-
-       return soc_component_ret(component, ret);
-}
-
 int snd_soc_component_hw_params(struct snd_soc_component *component,
                                struct snd_pcm_substream *substream,
                                struct snd_pcm_hw_params *params)
@@ -569,3 +558,20 @@ void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd)
                if (component->driver->pcm_destruct)
                        component->driver->pcm_destruct(component, rtd->pcm);
 }
+
+int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream)
+{
+       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_component *component;
+       int i, ret;
+
+       for_each_rtd_components(rtd, i, component) {
+               if (component->driver->prepare) {
+                       ret = component->driver->prepare(component, substream);
+                       if (ret < 0)
+                               return soc_component_ret(component, ret);
+               }
+       }
+
+       return 0;
+}
index c517064f5391b20d9e912e91025d35623b2b3067..8ba0f14a2f2f970c7e07b2a03ddaedc0e9121ddc 100644 (file)
@@ -850,7 +850,6 @@ static void codec2codec_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
 static int soc_pcm_prepare(struct snd_pcm_substream *substream)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_component *component;
        struct snd_soc_dai *dai;
        int i, ret = 0;
 
@@ -860,14 +859,9 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
        if (ret < 0)
                goto out;
 
-       for_each_rtd_components(rtd, i, component) {
-               ret = snd_soc_component_prepare(component, substream);
-               if (ret < 0) {
-                       dev_err(component->dev,
-                               "ASoC: platform prepare error: %d\n", ret);
-                       goto out;
-               }
-       }
+       ret = snd_soc_pcm_component_prepare(substream);
+       if (ret < 0)
+               goto out;
 
        ret = snd_soc_pcm_dai_prepare(substream);
        if (ret < 0) {