Re: [PATCH] ASoC: codecs: wcd934x: drop the MCLK on every disable
From: Mark Brown
Date: Thu Nov 19 2026 - 09:07:44 EST
> __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.
Are you absolutely sure there are no other paths that could do this, for
example take a look at wcd_mbhc_adc_detect_plug_type() and the rest of
the jack detection code?
--
Mark Brown <broonie@xxxxxxxxxx>