[PATCH 04/12] ASoC: cs42l42: Don't reconfigure the PLL while it is running

From: Richard Fitzgerald
Date: Tue Aug 10 2021 - 11:40:32 EST


cs42l42_pcm_hw_params() must only configure the PLL if this is the first
stream to become active, otherwise it will be overwriting the registers
while the PLL is running.

Signed-off-by: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>
Fixes: 43fc357199f9 ("ASoC: cs42l42: Set clock source for both ways of stream")
---
sound/soc/codecs/cs42l42.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index 5dc3a30272a4..1893d3694570 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -884,7 +884,11 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
break;
}

- return cs42l42_pll_config(component);
+ /* Configure the PLL if this is the first active stream */
+ if (!cs42l42->stream_use)
+ return cs42l42_pll_config(component);
+ else
+ return 0;
}

static int cs42l42_set_sysclk(struct snd_soc_dai *dai,
--
2.11.0