* [PATCH] soundwire: qcom: wait for the interrupt thread before gating the clock
@ 2026-10-07 19:33 Oleg Keri
2026-10-09 8:26 ` [PATCH v2] soundwire: qcom: disable the interrupt " Oleg Keri
0 siblings, 1 reply; 3+ messages in thread
From: Oleg Keri @ 2026-10-07 19:33 UTC (permalink / raw)
To: Srinivas Kandagatla, Vinod Koul
Cc: Bard Liao, Pierre-Louis Bossart, linux-arm-msm, linux-sound,
linux-kernel, Oleg Keri
A broadcast write returns as soon as the interrupt thread signals
SPECIAL_CMD_ID_FINISHED, while the thread still has to clear and re-read
the interrupt status. swrm_runtime_suspend() gates hclk right after the
ClockStopNow broadcast, so those accesses race against the clock being
removed; on x1e80100 and glymur hclk is the SoundWire clock itself. The
next clock-stop exit then fails at random: bus clash, parity errors
reported by the peripherals or AUTO_ENUM_FAILED, each leaving one side of
the speakers detached until reboot.
Wait for the interrupt thread to finish before gating the clock.
Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
Signed-off-by: Oleg Keri <okerixx@gmail.com>
---
drivers/soundwire/qcom.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 6e0c5fb10efa..76f940f4eb31 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1887,6 +1887,7 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev)
}
}
+ synchronize_irq(ctrl->irq);
clk_disable_unprepare(ctrl->hclk);
usleep_range(300, 305);
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2] soundwire: qcom: disable the interrupt before gating the clock
2026-10-07 19:33 [PATCH] soundwire: qcom: wait for the interrupt thread before gating the clock Oleg Keri
@ 2026-10-09 8:26 ` Oleg Keri
2026-10-09 8:37 ` Dmitry Baryshkov
0 siblings, 1 reply; 3+ messages in thread
From: Oleg Keri @ 2026-10-09 8:26 UTC (permalink / raw)
To: Srinivas Kandagatla, Vinod Koul
Cc: Bard Liao, Pierre-Louis Bossart, linux-arm-msm, linux-sound,
linux-kernel, Oleg Keri
swrm_runtime_suspend() gates hclk straight after the ClockStopNow
broadcast, while the interrupt thread that completed it is still
clearing the status and CLK_STOP_FINISHED is about to fire. Both touch
registers with the clock going away; on x1e80100 and glymur hclk is the
SoundWire clock itself. The next clock-stop exit then fails at random
(bus clash, parity errors, AUTO_ENUM_FAILED) and one side of the
speakers stays detached until reboot.
Disable the interrupt before gating the clock and enable it again once
the clock is back.
Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
Signed-off-by: Oleg Keri <okerixx@gmail.com>
---
v2: disable_irq() instead of synchronize_irq(), which left a window for
CLK_STOP_FINISHED; about one boot in four still hit it.
drivers/soundwire/qcom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 6e0c5fb10efa..147e55b7a600 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1801,6 +1801,7 @@ 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);
@@ -1887,6 +1888,7 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev)
}
}
+ disable_irq(ctrl->irq);
clk_disable_unprepare(ctrl->hclk);
usleep_range(300, 305);
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] soundwire: qcom: disable the interrupt before gating the clock
2026-10-09 8:26 ` [PATCH v2] soundwire: qcom: disable the interrupt " Oleg Keri
@ 2026-10-09 8:37 ` Dmitry Baryshkov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2026-10-09 8:37 UTC (permalink / raw)
To: Oleg Keri
Cc: Srinivas Kandagatla, Vinod Koul, Bard Liao, Pierre-Louis Bossart,
linux-arm-msm, linux-sound, linux-kernel
On Fri, Oct 09, 2026 at 10:26:39AM +0200, Oleg Keri wrote:
> swrm_runtime_suspend() gates hclk straight after the ClockStopNow
> broadcast, while the interrupt thread that completed it is still
> clearing the status and CLK_STOP_FINISHED is about to fire. Both touch
> registers with the clock going away; on x1e80100 and glymur hclk is the
> SoundWire clock itself. The next clock-stop exit then fails at random
> (bus clash, parity errors, AUTO_ENUM_FAILED) and one side of the
> speakers stays detached until reboot.
>
> Disable the interrupt before gating the clock and enable it again once
> the clock is back.
>
> Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
> Signed-off-by: Oleg Keri <okerixx@gmail.com>
> ---
> v2: disable_irq() instead of synchronize_irq(), which left a window for
> CLK_STOP_FINISHED; about one boot in four still hit it.
>
> drivers/soundwire/qcom.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-09 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07 19:33 [PATCH] soundwire: qcom: wait for the interrupt thread before gating the clock Oleg Keri
2026-10-09 8:26 ` [PATCH v2] soundwire: qcom: disable the interrupt " Oleg Keri
2026-10-09 8:37 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox