From c7a128313e4ef9efca856da0271c669ba46fca4e Mon Sep 17 00:00:00 2001 From: Jiajian Wu Date: Thu, 28 Nov 2024 16:13:41 +0800 Subject: [PATCH] ASoC: codecs: rk3506: Check substream direction in hw_params and shutdown Change-Id: I55f5b14123c443d83577807ccbd38660616bf744 Signed-off-by: Jiajian Wu --- sound/soc/codecs/rk3506_codec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/codecs/rk3506_codec.c b/sound/soc/codecs/rk3506_codec.c index 02172c6dbd86..44bbb7c89906 100644 --- a/sound/soc/codecs/rk3506_codec.c +++ b/sound/soc/codecs/rk3506_codec.c @@ -211,6 +211,9 @@ static int rk3506_hw_params(struct snd_pcm_substream *substream, unsigned int width, rate; int ratio; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + return 0; + if ((params_rate(params) % 12000) == 0) { clk_set_rate(rk3506->mclk, MCLK_REFERENCE_12000); ratio = MCLK_REFERENCE_12000 / MCLK_I2S_REFERENCE_DIV / @@ -283,6 +286,9 @@ static void rk3506_pcm_shutdown(struct snd_pcm_substream *substream, struct snd_soc_component *component = dai->component; struct rk3506_codec_priv *rk3506 = snd_soc_component_get_drvdata(component); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + return; + rk3506_codec_capture_off(component); regcache_cache_only(rk3506->regmap, false); regcache_sync(rk3506->regmap);