From 8cfc53316641c6df99e9d19c241df99237d55685 Mon Sep 17 00:00:00 2001 From: Martin Blumenstingl Date: Wed, 23 Dec 2020 02:46:54 +0100 Subject: [PATCH 39/58] WIP: ASoC: meson: aiu: encoder-i2s: implement the .mute_stream callback Implement the .mute_stream callback based on the code from the vendor driver. Signed-off-by: Martin Blumenstingl --- sound/soc/meson/aiu-encoder-i2s.c | 15 +++++++++++++++ sound/soc/meson/aiu.h | 1 + 2 files changed, 16 insertions(+) diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c index 932224552146..d6aea7797641 100644 --- a/sound/soc/meson/aiu-encoder-i2s.c +++ b/sound/soc/meson/aiu-encoder-i2s.c @@ -28,6 +28,8 @@ #define AIU_CLK_CTRL_MORE_I2S_DIV GENMASK(5, 0) #define AIU_CODEC_DAC_LRCLK_CTRL_DIV GENMASK(11, 0) +#define AIU_I2S_MUTE_SWAP_MUTE GENMASK(15, 8) + static void aiu_encoder_i2s_divider_enable(struct snd_soc_component *component, bool enable) { @@ -352,6 +354,18 @@ static void aiu_encoder_i2s_shutdown(struct snd_pcm_substream *substream, clk_bulk_disable_unprepare(aiu->i2s.clk_num, aiu->i2s.clks); } +static int aiu_encoder_i2s_mute_stream(struct snd_soc_dai *dai, int mute, + int stream) +{ + struct snd_soc_component *component = dai->component; + + snd_soc_component_update_bits(component, AIU_I2S_MUTE_SWAP, + AIU_I2S_MUTE_SWAP_MUTE, + mute ? AIU_I2S_MUTE_SWAP_MUTE : 0); + + return 0; +} + const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = { .trigger = aiu_encoder_i2s_trigger, .hw_params = aiu_encoder_i2s_hw_params, @@ -360,5 +374,6 @@ const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = { .set_sysclk = aiu_encoder_i2s_set_sysclk, .startup = aiu_encoder_i2s_startup, .shutdown = aiu_encoder_i2s_shutdown, + .mute_stream = aiu_encoder_i2s_mute_stream, }; diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h index 393b6c2307e4..7884c50f244d 100644 --- a/sound/soc/meson/aiu.h +++ b/sound/soc/meson/aiu.h @@ -66,6 +66,7 @@ extern const struct snd_soc_dai_ops aiu_encoder_spdif_dai_ops; #define AIU_958_CHSTAT_L0 0x020 #define AIU_958_CHSTAT_L1 0x024 #define AIU_958_CTRL 0x028 +#define AIU_I2S_MUTE_SWAP 0x030 #define AIU_I2S_SOURCE_DESC 0x034 #define AIU_I2S_DAC_CFG 0x040 #define AIU_I2S_SYNC 0x044 -- 2.25.1