Skip to contentSkip to conversation

ASoC: fsl_esai: Disable reset work before suspending on remove

PATCH In review Myeonghun Pak 2 participants 2 messages Oct 16 – Nov 7

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: fsl_esai: Disable reset work before suspending on remove

XRUN recovery was introduced as deferred reset and later converted to a work item. The reset reads ESAI registers and can restart the transmit and receive paths. fsl_esai_remove() currently suspends the device before cancelling the work, so a running reset can overlap regcache and clock shutdown. The managed IRQ can also queue another reset after cancellation.

Disable and drain the work before runtime PM teardown. This lets an already running reset finish while the device is active and rejects later queue attempts until the managed IRQ is released. The IRQ handler's own register accesses during teardown are a separate issue.

This issue was identified as part of our ongoing research while reviewing kernel code.

Fixes 7ccafa2b3879 ("ASoC: fsl_esai: recover the channel swap after xrun")
Assisted-by LLM

---
Compile-tested with GCC, W=1 (arm64). No runtime testing.

Backports before the tasklet-to-work conversion need adaptation; check disable_work_sync() availability.

 sound/soc/fsl/fsl_esai.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl_esai.c +3 -2
index 4a530a6..83a9963 100644
@@ -10,6 +10,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
+#include <linux/workqueue.h>
 #include <sound/dmaengine_pcm.h>
 #include <sound/pcm_params.h>
 
@@ -1099,11 +1100,11 @@ static void fsl_esai_remove(struct platform_device *pdev)
 {
 	struct fsl_esai *esai_priv = platform_get_drvdata(pdev);
 
+	disable_work_sync(&esai_priv->work);
+
 	pm_runtime_disable(&pdev->dev);
 	if (!pm_runtime_status_suspended(&pdev->dev))
 		fsl_esai_runtime_suspend(&pdev->dev);
-
-	cancel_work_sync(&esai_priv->work);
 }
 
 static const struct of_device_id fsl_esai_dt_ids[] = {
maintainer
#1 lore raw
Quoted 1 line · Myeonghun Pak

ASoC: fsl_esai: Disable reset work before suspending on remove

Applied to

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

Thanks!

[1/1] ASoC: fsl_esai: Disable reset work before suspending on remove

      https://git.kernel.org/broonie/sound/c/b72f6bb43dec

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