Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] soundwire: qcom: re-arm the controller interrupt after gating the clock
@ 2026-11-28  7:44 Gopi Chandra Sekhar Reddy Kanala
  2026-11-28  8:09 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Gopi Chandra Sekhar Reddy Kanala @ 2026-11-28  7:44 UTC (permalink / raw)
  To: Srinivas Kandagatla, Vinod Koul, Bard Liao, Pierre-Louis Bossart,
	Oleg Keri, Dmitry Baryshkov
  Cc: linux-arm-msm, linux-sound, linux-kernel,
	Gopi Chandra Sekhar Reddy Kanala

Commit 6c067677192f ("soundwire: qcom: disable the interrupt before
gating the clock") correctly stopped the interrupt thread from racing
with clk_disable_unprepare() in swrm_runtime_suspend(), but it also
leaves the controller interrupt masked for the whole duration of clock
stop, which breaks peripheral-initiated wake.

The driver is otherwise set up to service peripheral alerts while the
clock is stopped.  swrm_runtime_suspend() masks only MASTER_CLASH_DET
out of ctrl->intr_mask before writing INTERRUPT_CPU_EN, deliberately
leaving SLAVE_PEND_IRQ enabled, and qcom_swrm_irq_handler() brackets
itself with clk_prepare_enable()/clk_disable_unprepare() so that it can
run while the controller is runtime suspended.  From there
sdw_handle_slave_alerts() takes a pm_runtime reference on the
peripheral, which resumes the controller and restarts the bus clock
before any register is read over the bus.

With the interrupt masked at the interrupt controller for the whole
idle window that chain never starts.  On glymur an SDCA jack insert or
removal while the bus is idle is not reported at all: the alert stays
latched in the codec until something else resumes the bus, such as the
start of playback.  Platforms that do not describe a usable wake
interrupt have nothing to fall back on.

disable_irq() is the synchronous variant, so by the time it returns any
in-flight handler has been flushed.  That is all the race needed: once
the clock is gated, re-arming is safe because the handler enables the
clock itself.  Re-arm at the end of swrm_runtime_suspend() and drop the
now unbalanced enable_irq() from swrm_runtime_resume().

Fixes: 6c067677192f ("soundwire: qcom: disable the interrupt before gating the clock")
Signed-off-by: Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>
---
The commit this fixes is currently only in linux-next and has not
appeared in a release, so there is no stable backport to do.
---
 drivers/soundwire/qcom.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index a4cb62897192..05ef7bb2c5f7 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1801,7 +1801,6 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
 	}
 
 	clk_prepare_enable(ctrl->hclk);
-	enable_irq(ctrl->irq);
 
 	if (ctrl->clock_stop_not_supported) {
 		reinit_completion(&ctrl->enumeration);
@@ -1893,6 +1892,8 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev)
 
 	usleep_range(300, 305);
 
+	enable_irq(ctrl->irq);
+
 	if (ctrl->wake_irq > 0) {
 		if (irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
 			enable_irq(ctrl->wake_irq);

---
base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
change-id: 20261128-sdw-qcom-irq-207ea053d898

Best regards,
--  
Gopi Chandra Sekhar Reddy Kanala <gopi.kanala@oss.qualcomm.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-28  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28  7:44 [PATCH] soundwire: qcom: re-arm the controller interrupt after gating the clock Gopi Chandra Sekhar Reddy Kanala
2026-11-28  8:09 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox