OSDN Git Service

ASoC: soc-link: add snd_soc_link_compr_startup()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 25 May 2020 00:57:41 +0000 (09:57 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 25 May 2020 13:22:12 +0000 (14:22 +0100)
dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_compr_startup().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87v9kk3k6y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-link.h
sound/soc/soc-compress.c
sound/soc/soc-link.c

index aae72f6..20fe46f 100644 (file)
@@ -20,4 +20,6 @@ int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
 void snd_soc_link_hw_free(struct snd_pcm_substream *substream);
 int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd);
 
+int snd_soc_link_compr_startup(struct snd_compr_stream *cstream);
+
 #endif /* __SOC_LINK_H */
index 62ece72..ddc6c6f 100644 (file)
@@ -19,6 +19,7 @@
 #include <sound/soc.h>
 #include <sound/initval.h>
 #include <sound/soc-dpcm.h>
+#include <sound/soc-link.h>
 #include <linux/pm_runtime.h>
 
 static int soc_compr_components_open(struct snd_compr_stream *cstream,
@@ -95,15 +96,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
        if (ret < 0)
                goto machine_err;
 
-       if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->startup) {
-               ret = rtd->dai_link->compr_ops->startup(cstream);
-               if (ret < 0) {
-                       dev_err(rtd->dev,
-                               "Compress ASoC: %s startup failed: %d\n",
-                               rtd->dai_link->name, ret);
-                       goto machine_err;
-               }
-       }
+       ret = snd_soc_link_compr_startup(cstream);
+       if (ret < 0)
+               goto machine_err;
 
        snd_soc_runtime_activate(rtd, cstream->direction);
 
@@ -179,14 +174,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
        if (ret < 0)
                goto open_err;
 
-       if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->startup) {
-               ret = fe->dai_link->compr_ops->startup(cstream);
-               if (ret < 0) {
-                       pr_err("Compress ASoC: %s startup failed: %d\n",
-                              fe->dai_link->name, ret);
-                       goto machine_err;
-               }
-       }
+       ret = snd_soc_link_compr_startup(cstream);
+       if (ret < 0)
+               goto machine_err;
 
        dpcm_clear_pending_state(fe, stream);
        dpcm_path_put(&list);
index 113a4d1..7f0fb53 100644 (file)
@@ -113,3 +113,16 @@ int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd)
 
        return soc_link_ret(rtd, ret);
 }
+
+int snd_soc_link_compr_startup(struct snd_compr_stream *cstream)
+{
+       struct snd_soc_pcm_runtime *rtd = cstream->private_data;
+       int ret = 0;
+
+       if (rtd->dai_link->compr_ops &&
+           rtd->dai_link->compr_ops->startup)
+               ret = rtd->dai_link->compr_ops->startup(cstream);
+
+       return soc_link_ret(rtd, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_link_compr_startup);