ASoC: soc-dai: add snd_soc_dai_compr_trigger()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 23 Apr 2020 23:15:32 +0000 (08:15 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 29 Apr 2020 12:27:44 +0000 (13:27 +0100)
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_trigger().

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/87mu71ssiz.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 abf4ad2..ae04575 100644 (file)
@@ -174,6 +174,8 @@ int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
                              struct snd_compr_stream *cstream);
 void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
                                struct snd_compr_stream *cstream);
+int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
+                             struct snd_compr_stream *cstream, int cmd);
 
 struct snd_soc_dai_ops {
        /*
index af74fb7..b05305a 100644 (file)
@@ -338,8 +338,9 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
        if (ret < 0)
                goto out;
 
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger)
-               cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai);
+       ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd);
+       if (ret < 0)
+               goto out;
 
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
@@ -372,11 +373,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
 
        mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
 
-       if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger) {
-               ret = cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai);
-               if (ret < 0)
-                       goto out;
-       }
+       ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd);
+       if (ret < 0)
+               goto out;
 
        ret = soc_compr_components_trigger(cstream, cmd);
        if (ret < 0)
index d5cb8b0..844b525 100644 (file)
@@ -526,3 +526,16 @@ void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
                dai->driver->cops->shutdown(cstream, dai);
 }
 EXPORT_SYMBOL_GPL(snd_soc_dai_compr_shutdown);
+
+int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
+                             struct snd_compr_stream *cstream, int cmd)
+{
+       int ret = 0;
+
+       if (dai->driver->cops &&
+           dai->driver->cops->trigger)
+               ret = dai->driver->cops->trigger(cstream, cmd, dai);
+
+       return soc_dai_ret(dai, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_compr_trigger);