summaryrefslogtreecommitdiff
path: root/sound/soc/generic/simple-card-utils.c
diff options
context:
space:
mode:
authorSameer Pujar <spujar@nvidia.com>2022-03-10 16:46:39 +0530
committerMark Brown <broonie@kernel.org>2022-03-11 13:42:29 +0000
commit5bbe2918acccfa60de1c1a2139de9cc5441d5796 (patch)
treef3926831b85a15d156bce2d34553e289254eca35 /sound/soc/generic/simple-card-utils.c
parent886e09c77d2b48559d26928a5705a20ef3ac117d (diff)
ASoC: simple-card-utils: Don't reset clock of active DAI
Playback or capture errors are seen when clock is reset during an active stage of DAI. Presently this scenario happens when DAI has both playback and capture sessions running and one of these finishes first which will be followed by clock rate reset. The remaining active session will be affected in such case. Address this problem by allowing clock rate reset to happen only when the DAI is no more active. Signed-off-by: Sameer Pujar <spujar@nvidia.com> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/1646910999-2501-1-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic/simple-card-utils.c')
-rw-r--r--sound/soc/generic/simple-card-utils.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 14c8b3a74c2d..8e037835bc58 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -318,15 +318,19 @@ void asoc_simple_shutdown(struct snd_pcm_substream *substream)
int i;
for_each_prop_dai_cpu(props, i, dai) {
- if (props->mclk_fs && !dai->clk_fixed)
- snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, i),
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, i);
+
+ if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(cpu_dai))
+ snd_soc_dai_set_sysclk(cpu_dai,
0, 0, SND_SOC_CLOCK_IN);
asoc_simple_clk_disable(dai);
}
for_each_prop_dai_codec(props, i, dai) {
- if (props->mclk_fs && !dai->clk_fixed)
- snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, i),
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, i);
+
+ if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(codec_dai))
+ snd_soc_dai_set_sysclk(codec_dai,
0, 0, SND_SOC_CLOCK_IN);
asoc_simple_clk_disable(dai);