Re: [PATCH v4] ASoC: wm8962: Stop IRQ from requeuing mic_work on remove
From: Mark Brown
Date: Mon Oct 26 2026 - 15:24:27 EST
> The WM8962 IRQ remains registered to the I2C device when an ASoC card is
> unbound. wm8962_remove() cancels mic_work, but a MICD or MICSCD interrupt
> can queue it again before the component is destroyed. The work then
> accesses the component and reports to the old jack.
> @@ -3230,22 +3230,30 @@ int wm8962_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *
> {
> + snd_soc_component_update_bits(component, WM8962_ADDITIONAL_CONTROL_4,
> + WM8962_MICDET_ENA, 0);
This register is (sadly) volatile so we can't write to it while the
CODEC is runtime suspended.
> static void wm8962_remove(struct snd_soc_component *component)
> {
> - struct wm8962_priv *wm8962 = snd_soc_component_get_drvdata(component);
> -
> - cancel_delayed_work_sync(&wm8962->mic_work);
> + wm8962_mic_detect(component, NULL);
This means that if we didn't enable mic detection and the CODEC has
runtime suspended on remove this will now fail to write to the device
and generate warnings. Making the cleanup conditional on having
enabed mic detection would avoid that.
--
Mark Brown <broonie@xxxxxxxxxx>