Skip to content

Commit 5d5eceb

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-dai: add snd_soc_dai_mute_is_ctrled_at_trigger()
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>
1 parent 7a2ff05 commit 5d5eceb

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

include/sound/soc-dai.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ int snd_soc_dai_prepare(struct snd_soc_dai *dai,
193193
/* Digital Audio Interface mute */
194194
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
195195
int direction);
196-
196+
int snd_soc_dai_mute_is_ctrled_at_trigger(struct snd_soc_dai *dai);
197197

198198
int snd_soc_dai_get_channel_map(const struct snd_soc_dai *dai,
199199
unsigned int *tx_num, unsigned int *tx_slot,

sound/soc/soc-dai.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ int snd_soc_dai_prepare(struct snd_soc_dai *dai,
364364
}
365365
EXPORT_SYMBOL_GPL(snd_soc_dai_prepare);
366366

367+
int snd_soc_dai_mute_is_ctrled_at_trigger(struct snd_soc_dai *dai)
368+
{
369+
if (dai->driver->ops)
370+
return dai->driver->ops->mute_unmute_on_trigger;
371+
372+
return 0;
373+
}
374+
367375
/**
368376
* snd_soc_dai_digital_mute - configure DAI system or master clock.
369377
* @dai: DAI
@@ -620,7 +628,7 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
620628
if (ret < 0)
621629
break;
622630

623-
if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
631+
if (snd_soc_dai_mute_is_ctrled_at_trigger(dai))
624632
snd_soc_dai_digital_mute(dai, 0, substream->stream);
625633

626634
soc_dai_mark_push(dai, substream, trigger);
@@ -633,7 +641,7 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
633641
if (rollback && !soc_dai_mark_match(dai, substream, trigger))
634642
continue;
635643

636-
if (dai->driver->ops && dai->driver->ops->mute_unmute_on_trigger)
644+
if (snd_soc_dai_mute_is_ctrled_at_trigger(dai))
637645
snd_soc_dai_digital_mute(dai, 1, substream->stream);
638646

639647
r = soc_dai_trigger(dai, substream, cmd);

sound/soc/soc-pcm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd,
949949
SND_SOC_DAPM_STREAM_START);
950950

951951
for_each_rtd_dais(rtd, i, dai) {
952-
if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
952+
if (!snd_soc_dai_mute_is_ctrled_at_trigger(dai))
953953
snd_soc_dai_digital_mute(dai, 0, substream->stream);
954954
}
955955

@@ -1007,7 +1007,7 @@ static int soc_pcm_hw_clean(struct snd_soc_pcm_runtime *rtd,
10071007
soc_pcm_set_dai_params(dai, NULL);
10081008

10091009
if (snd_soc_dai_stream_active(dai, substream->stream) == 1) {
1010-
if (dai->driver->ops && !dai->driver->ops->mute_unmute_on_trigger)
1010+
if (!snd_soc_dai_mute_is_ctrled_at_trigger(dai))
10111011
snd_soc_dai_digital_mute(dai, 1, substream->stream);
10121012
}
10131013
}

0 commit comments

Comments
 (0)