]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: soc-dai: add snd_soc_dai_compr_start()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 23 Apr 2020 23:15:24 +0000 (08:15 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 29 Apr 2020 12:27:42 +0000 (13:27 +0100)
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_start().

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/87pnbxssj7.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dai.h
sound/soc/soc-compress.c
sound/soc/soc-dai.c

index cf7d09f210bce24cbb04218347f6ab25a5934ff6..deb99b1469b46c8c1dd174c09410c3692c156c9b 100644 (file)
@@ -170,6 +170,9 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd);
 int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
                                    int cmd);
 
+int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
+                             struct snd_compr_stream *cstream);
+
 struct snd_soc_dai_ops {
        /*
         * DAI clocking configuration, all optional.
index 8431ff72be63f7ffd93bff94ccb9e80272592b72..7960270f5e6776b190c6ca3fe9aebe3f926c4a37 100644 (file)
@@ -87,15 +87,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
 
        mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
 
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) {
-               ret = cpu_dai->driver->cops->startup(cstream, cpu_dai);
-               if (ret < 0) {
-                       dev_err(cpu_dai->dev,
-                               "Compress ASoC: can't open interface %s: %d\n",
-                               cpu_dai->name, ret);
-                       goto out;
-               }
-       }
+       ret = snd_soc_dai_compr_startup(cpu_dai, cstream);
+       if (ret < 0)
+               goto out;
 
        ret = soc_compr_components_open(cstream, &component);
        if (ret < 0)
@@ -178,15 +172,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
                goto out;
        }
 
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) {
-               ret = cpu_dai->driver->cops->startup(cstream, cpu_dai);
-               if (ret < 0) {
-                       dev_err(cpu_dai->dev,
-                               "Compress ASoC: can't open interface %s: %d\n",
-                               cpu_dai->name, ret);
-                       goto out;
-               }
-       }
+       ret = snd_soc_dai_compr_startup(cpu_dai, cstream);
+       if (ret < 0)
+               goto out;
 
        ret = soc_compr_components_open(cstream, &component);
        if (ret < 0)
index 2bc452fe02ffc29f2de7939b5ef237bb99e8b8aa..5c88f80b781d8a04c2c403413f74ec781488619d 100644 (file)
@@ -504,3 +504,16 @@ int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
 
        return 0;
 }
+
+int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
+                             struct snd_compr_stream *cstream)
+{
+       int ret = 0;
+
+       if (dai->driver->cops &&
+           dai->driver->cops->startup)
+               ret = dai->driver->cops->startup(cstream, dai);
+
+       return soc_dai_ret(dai, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_compr_startup);