Re: [PATCH] ASoC: codecs: wcd934x: drop the MCLK on every disable
From: Ivan Verbovoy
Date: Thu Nov 19 2026 - 09:54:59 EST
On Thu, Nov 19, 2026 at 02:07:26PM +0000, Mark Brown wrote:
> 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?
No, and you are right to point there: the jack detection does not
balance its calls.
wcd_mbhc_adc_detect_plug_type() requests the micbias once per insertion,
and wcd934x_mbhc_request_micbias() takes an MCLK reference with it. The
releases are more: wcd_correct_swch_plug() releases at its exit, once
more for a headphone or when the work is stopped, and
wcd_mbhc_report_plug_removal() releases again on every removal. micb_ref
is clamped at zero, but the MCLK reference next to it is dropped every
time.
So with this patch alone, a removal while SoundWire is running would
drop a reference the jack detection does not hold. The early return is
what hides that today.
I will send a v2 that first makes the jack detection drop only the
references it took, and then removes the check. The board I test on has
no jack, so that part will be build-tested only; I will say so there.