[RFC PATCH] soundwire: qcom: fail runtime resume on enumeration timeout

From: Pengpeng Hou

Date: Tue Jun 23 2026 - 02:17:33 EST


swrm_runtime_resume() reinitializes the controller and waits for
hardware enumeration when clock stop is not supported, but ignores
wait_for_completion_timeout(). It then reads and reports slave status
even if enumeration never completed.

Return -ETIMEDOUT when the enumeration wait expires and undo the hclk
and wake IRQ state changed earlier in the resume path before returning
the error.

Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
drivers/soundwire/qcom.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 3d8f5a81eff1..acac77a1093d 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1704,6 +1704,7 @@ static void qcom_swrm_remove(struct platform_device *pdev)
static int __maybe_unused swrm_runtime_resume(struct device *dev)
{
struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev);
+ unsigned long time_left;
int ret;

if (ctrl->wake_irq > 0) {
@@ -1725,8 +1726,15 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
dev_err(ctrl->dev, "link failed to connect\n");

/* wait for hw enumeration to complete */
- wait_for_completion_timeout(&ctrl->enumeration,
- msecs_to_jiffies(TIMEOUT_MS));
+ time_left = wait_for_completion_timeout(&ctrl->enumeration,
+ msecs_to_jiffies(TIMEOUT_MS));
+ if (!time_left) {
+ clk_disable_unprepare(ctrl->hclk);
+ if (ctrl->wake_irq > 0 &&
+ irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq)))
+ enable_irq(ctrl->wake_irq);
+ return -ETIMEDOUT;
+ }
qcom_swrm_get_device_status(ctrl);
sdw_handle_slave_status(&ctrl->bus, ctrl->status);
} else {
--
2.50.1 (Apple Git-155)