]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: soc-dai: add snd_soc_dai_mute_is_ctrled_at_trigger()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 6 Mar 2025 01:59:25 +0000 (01:59 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 6 Mar 2025 15:38:44 +0000 (15:38 +0000)
Adds snd_soc_dai_mute_is_ctrled_at_trigger() to judge
dai->driver->ops->mute_unmute_on_trigger flags

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/871pva6hs2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dai.h
sound/soc/soc-dai.c
sound/soc/soc-pcm.c

index c3a3ba4b0bb7ed454ec82d0bc9300a3d5ce662dd..d19ab5572d2baa05ad8a91b30eb88e29bb43e9f4 100644 (file)
@@ -193,7 +193,7 @@ int snd_soc_dai_prepare(struct snd_soc_dai *dai,
 /* Digital Audio Interface mute */
 int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
                             int direction);
-
+int snd_soc_dai_mute_is_ctrled_at_trigger(struct snd_soc_dai *dai);
 
 int snd_soc_dai_get_channel_map(const struct snd_soc_dai *dai,
                unsigned int *tx_num, unsigned int *tx_slot,
index 8f2b5b840bb08be8bbb38ac8b73bf63e069c1a4d..a210089747d0044b4e4b235ad0cde2b20ec5b323 100644 (file)
@@ -364,6 +364,14 @@ int snd_soc_dai_prepare(struct snd_soc_dai *dai,
 }
 EXPORT_SYMBOL_GPL(snd_soc_dai_prepare);
 
+int snd_soc_dai_mute_is_ctrled_at_trigger(struct snd_soc_dai *dai)
+{
+       if (dai->driver->ops)
+               return dai->driver->ops->mute_unmute_on_trigger;
+
+       return 0;
+}
+
 /**
  * snd_soc_dai_digital_mute - configure DAI system or master clock.
  * @dai: DAI
@@ -620,7 +628,7 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
                        if (ret < 0)
                                break;
 
-                       if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
+                       if (snd_soc_dai_mute_is_ctrled_at_trigger(dai))
                                snd_soc_dai_digital_mute(dai, 0, substream->stream);
 
                        soc_dai_mark_push(dai, substream, trigger);
@@ -633,7 +641,7 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
                        if (rollback && !soc_dai_mark_match(dai, substream, trigger))
                                continue;
 
-                       if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
+                       if (snd_soc_dai_mute_is_ctrled_at_trigger(dai))
                                snd_soc_dai_digital_mute(dai, 1, substream->stream);
 
                        r = soc_dai_trigger(dai, substream, cmd);
index 1b9ae03e83d0e4c6795434397a1dfc924ddbeb05..403edd2fd8cfc22be54bcf28d8406d5824120c39 100644 (file)
@@ -949,7 +949,7 @@ static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd,
                        SND_SOC_DAPM_STREAM_START);
 
        for_each_rtd_dais(rtd, i, dai) {
-               if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
+               if (!snd_soc_dai_mute_is_ctrled_at_trigger(dai))
                        snd_soc_dai_digital_mute(dai, 0, substream->stream);
        }
 
@@ -1007,7 +1007,7 @@ static int soc_pcm_hw_clean(struct snd_soc_pcm_runtime *rtd,
                        soc_pcm_set_dai_params(dai, NULL);
 
                if (snd_soc_dai_stream_active(dai, substream->stream) == 1) {
-                       if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
+                       if (!snd_soc_dai_mute_is_ctrled_at_trigger(dai))
                                snd_soc_dai_digital_mute(dai, 1, substream->stream);
                }
        }