Skip to contentSkip to conversation

ASoC: rt5640: Fix Jack work after system suspend

PATCH In review Oder Chiou 2 participants 2 messages Nov 28, 2022

Subsystems (3)
lore
Share & tools
lore

Oder Chiou

author maintainer
#0 lore raw

PATCH 1/1 ASoC: rt5640: Fix Jack work after system suspend

We found an corner case in RT5640 codec driver which schedules jack work after system suspend as IRQ was enabled. Due to this, hitting the error as register access happening after suspend as jack worker thread getting scheduled in irq handler. The patch disables the irq during the suspend to prevent the corner case happening.

---
 sound/soc/codecs/rt5640.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/codecs/rt5640.c +8 -0
index 0f8e6dd214b..708e55b7431 100644
@@ -2792,6 +2792,11 @@ static int rt5640_suspend(struct snd_soc_component *component)
 {
 	struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
 
+	if (rt5640->irq) {
+		/* disable jack interrupts during system suspend */
+		disable_irq(rt5640->irq);
+	}
+
 	rt5640_cancel_work(rt5640);
 	snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
 	rt5640_reset(component);
@@ -2815,6 +2820,9 @@ static int rt5640_resume(struct snd_soc_component *component)
 	regcache_cache_only(rt5640->regmap, false);
 	regcache_sync(rt5640->regmap);
 
+	if (rt5640->irq)
+		enable_irq(rt5640->irq);
+
 	if (rt5640->jack) {
 		if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER) {
 			snd_soc_component_update_bits(component,
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 8 lines · Oder Chiou

We found an corner case in RT5640 codec driver which schedules jack work after system suspend as IRQ was enabled. Due to this, hitting the error as register access happening after suspend as jack worker thread getting scheduled in irq handler. The patch disables the irq during the suspend to prevent the corner case happening.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rt5640: Fix Jack work after system suspend

      commit: 5fabcc90e79b460d72df582b31854f6018695965

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark