[PATCH] ASoC: codecs: wcd934x: drop the MCLK on every disable
From: Ivan Verbovoy via B4 Relay
Date: Mon Nov 09 2026 - 17:33:32 EST
From: Ivan Verbovoy <ivanverbovoy@xxxxxxxxx>
__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@xxxxxxxxx>
---
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@xxxxxxxxx>