[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251231-nau8821-cleanup-v1-3-6b0b76cbbb64@collabora.com>
Date: Wed, 31 Dec 2025 22:04:17 +0200
From: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
To: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Seven Lee <wtli@...oton.com>
Cc: kernel@...labora.com, linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/7] ASoC: nau8821: Cancel pending work before suspend
A jack detection work that is unscheduled or in progress while executing
the suspend handler could trigger a race condition.
Ensure state consistency by cancelling any pending work or wait for its
execution to complete before processing the suspend. Since driver
(re)enables both insert and eject interrupts on resume, there is no risk
to miss the related jack events. Therefore, flush_delayed_work() is not
required here.
Fixes: aab1ad11d69f ("ASoC: nau8821: new driver")
Fixes: ee70bacef1c6 ("ASoC: nau8821: Avoid unnecessary blocking in IRQ handler")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
---
sound/soc/codecs/nau8821.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c
index 2e2714b47501..58d2d5e77c8f 100644
--- a/sound/soc/codecs/nau8821.c
+++ b/sound/soc/codecs/nau8821.c
@@ -1605,6 +1605,10 @@ static int __maybe_unused nau8821_suspend(struct snd_soc_component *component)
if (nau8821->irq)
disable_irq(nau8821->irq);
+
+ if (nau8821->jdet_active)
+ cancel_delayed_work_sync(&nau8821->jdet_work);
+
snd_soc_dapm_force_bias_level(nau8821->dapm, SND_SOC_BIAS_OFF);
/* Power down codec power; don't support button wakeup */
snd_soc_dapm_disable_pin(nau8821->dapm, "MICBIAS");
--
2.52.0
Powered by blists - more mailing lists