ASoC: cs42l43: Shut down jack detection on component remove
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Fri, 2 Feb 2024 14:06:19 +0000 (14:06 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 5 Feb 2024 14:32:26 +0000 (14:32 +0000)
Disable the jack detection and sync in any currently running work when
the component is removed.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240202140619.1068560-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs42l43.c

index c84d5952cdb503b04b1b7cc84912d16b49f0307a..256767ef4c03d4b19c2d27c45796c07923457100 100644 (file)
@@ -2115,6 +2115,13 @@ static void cs42l43_component_remove(struct snd_soc_component *component)
 {
        struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
 
+       cs42l43_set_jack(priv->component, NULL, NULL);
+
+       cancel_delayed_work_sync(&priv->bias_sense_timeout);
+       cancel_delayed_work_sync(&priv->tip_sense_work);
+       cancel_delayed_work_sync(&priv->button_press_work);
+       cancel_work_sync(&priv->button_release_work);
+
        cancel_work_sync(&priv->hp_ilimit_work);
        cancel_delayed_work_sync(&priv->hp_ilimit_clear_work);