mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: wcd934x: drop the MCLK on every disable
@ 2026-11-09 22:33 Ivan Verbovoy via B4 Relay
  2026-11-19 14:07 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Verbovoy via B4 Relay @ 2026-11-09 22:33 UTC (permalink / raw)
  To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Pierre-Louis Bossart
  Cc: linux-sound, linux-arm-msm, linux-kernel, Ivan Verbovoy

From: Ivan Verbovoy <ivanverbovoy@gmail.com>

__wcd934x_cdc_mclk_enable() takes a reference on every enable: it
prepares and enables the external clock and counts a user of the
analog bias and system clock (sysclk_users). On disable it returns
early while the SoundWire controller's clock is enabled, so neither is
dropped. Each DAPM MCLK power-down or MBHC micbias release during
SoundWire activity therefore leaks one reference, and the MCLK stays on
for good.

The early return is not needed: wcd934x_swrm_clock() takes its own
reference before it enables the SoundWire clock and clears that clock
before it drops the reference, and sysclk_users keeps the bias and the
system clock on while any user remains. Drop the check.

On a Surface Duo (SM8150, WCD9340) the codec's external clock,
ln_bb_clk2 (an RPMh XO buffer vote), was found prepared five times at
suspend, which kept the SoC's XO on. With the check dropped, its enable
and prepare counts are back to zero once playback stops.

Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec")
Signed-off-by: Ivan Verbovoy <ivanverbovoy@gmail.com>
---
 sound/soc/codecs/wcd934x.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 5cd30a5ed69c..043061558225 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -1355,15 +1355,6 @@ static int __wcd934x_cdc_mclk_enable(struct wcd934x_codec *wcd, bool enable)
 		}
 		ret = wcd934x_enable_ana_bias_and_sysclk(wcd);
 	} else {
-		int val;
-
-		regmap_read(wcd->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL,
-			    &val);
-
-		/* Don't disable clock if soundwire using it.*/
-		if (val & WCD934X_CDC_SWR_CLK_EN_MASK)
-			return 0;
-
 		wcd934x_disable_ana_bias_and_syclk(wcd);
 		clk_disable_unprepare(wcd->extclk);
 	}

---
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
change-id: 20261109-wcd934x-mclk-2121fa04731a

Best regards,
--  
Ivan Verbovoy <ivanverbovoy@gmail.com>



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

end of thread, other threads:[~2026-11-19 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 22:33 [PATCH] ASoC: codecs: wcd934x: drop the MCLK on every disable Ivan Verbovoy via B4 Relay
2026-11-19 14:07 ` Mark Brown
2026-11-19 14:51   ` Ivan Verbovoy

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

all inboxes | Powered by JetHome®