Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] soundwire: qcom: handle interface clock failure on runtime resume
@ 2026-11-29 19:25 Jiawen Liu
  2026-11-29 19:43 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-11-29 19:25 UTC (permalink / raw)
  To: Srinivas Kandagatla, Vinod Koul, Bard Liao
  Cc: Pierre-Louis Bossart, linux-arm-msm, linux-sound

After runtime suspend releases the interface clock, PCM startup can
request a runtime resume. On SDM845 with WCD9340, an RPMh active vote
for the parent clock can time out during clk_prepare_enable().
swrm_runtime_resume() ignores the error, enables the main IRQ and
accesses controller registers. Runtime PM then marks the controller
active, so callers can proceed with I/O without the interface clock.

Return the clock error before enabling the main IRQ or accessing the
controller. Keep masking the optional wake IRQ before the clock call
to prevent an asserted level-triggered wake IRQ from retriggering on
failure. Unbind can proceed after a failed resume, so disable runtime
PM during remove and release the clock only if the controller is
still active.

Verification covered source review,
arm64 builds of qcom.o with CONFIG_PM enabled and disabled, and
git diff --check and checkpatch.pl. Runtime and hardware reproduction
were not performed.

Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
---
 drivers/soundwire/qcom.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index a4cb62897192e..0274957d1e48a 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1787,7 +1787,9 @@ static void qcom_swrm_remove(struct platform_device *pdev)
 	struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
 
 	sdw_bus_master_delete(&ctrl->bus);
-	clk_disable_unprepare(ctrl->hclk);
+	pm_runtime_disable(ctrl->dev);
+	if (!pm_runtime_status_suspended(ctrl->dev))
+		clk_disable_unprepare(ctrl->hclk);
 }
 
 static int __maybe_unused swrm_runtime_resume(struct device *dev)
@@ -1800,7 +1802,10 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
 			disable_irq_nosync(ctrl->wake_irq);
 	}
 
-	clk_prepare_enable(ctrl->hclk);
+	ret = clk_prepare_enable(ctrl->hclk);
+	if (ret)
+		return ret;
+
 	enable_irq(ctrl->irq);
 
 	if (ctrl->clock_stop_not_supported) {
-- 
2.34.1

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

end of thread, other threads:[~2026-11-29 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 19:25 [PATCH] soundwire: qcom: handle interface clock failure on runtime resume Jiawen Liu
2026-11-29 19:43 ` sashiko-bot

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