Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: codec: rt5640: Resolve failure to set DMIC clock after playback
@ 2023-01-14  0:30 Jarrah Gosbell
  2023-01-14 17:25 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Jarrah Gosbell @ 2023-01-14  0:30 UTC (permalink / raw)
  To: Oder Chiou, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, linux-kernel
  Cc: Jarrah Gosbell, phone-devel, Ondrej Jirman

From: Ondrej Jirman <megi@xff.cz>

rt5640_set_dai_sysclk is called with freq == 0 when playback stops. This
causes DMIC setup code to fail. I2S interface doesn't need to be active
for codec to work, so don't clear rt5640->sysclk after
rt5640_set_dai_sysclk is called with freq == 0.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Jarrah Gosbell <kernel@undef.tools>
---
 sound/soc/codecs/rt5640.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 18e01949f20e..054de41ceccb 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -1839,6 +1839,9 @@ static int rt5640_set_dai_sysclk(struct snd_soc_dai *dai,
 	unsigned int reg_val = 0;
 	unsigned int pll_bit = 0;
 
+	if (freq == 0)
+		return 0;
+
 	switch (clk_id) {
 	case RT5640_SCLK_S_MCLK:
 		reg_val |= RT5640_SCLK_SRC_MCLK;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: codec: rt5640: Resolve failure to set DMIC clock after playback
  2023-01-14  0:30 [PATCH] ASoC: codec: rt5640: Resolve failure to set DMIC clock after playback Jarrah Gosbell
@ 2023-01-14 17:25 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2023-01-14 17:25 UTC (permalink / raw)
  To: Jarrah Gosbell
  Cc: Oder Chiou, alsa-devel, phone-devel, Liam Girdwood, linux-kernel,
	Takashi Iwai, Ondrej Jirman

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

On Sat, Jan 14, 2023 at 12:30:54AM +0000, Jarrah Gosbell wrote:

> rt5640_set_dai_sysclk is called with freq == 0 when playback stops. This
> causes DMIC setup code to fail. I2S interface doesn't need to be active
> for codec to work, so don't clear rt5640->sysclk after
> rt5640_set_dai_sysclk is called with freq == 0.

The goal with set_sysclk() is to record the current clock
frequency, if the clock is stopped it should be set to zero.  If
a machine driver is setting the input clock to zero when it's
still being provided then it should be fixed.  If the device
doesn't need a clock for DMIC (which seems dubious) then whatever
is checking for a clock should be fixed.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-15  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-14  0:30 [PATCH] ASoC: codec: rt5640: Resolve failure to set DMIC clock after playback Jarrah Gosbell
2023-01-14 17:25 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox