Skip to contentSkip to conversation

soundwire: cadence_master: wait and cancel cdns->work before clock stop

PATCH Applied Bard Liao 3 participants 3 messages Sep 1 – Sep 8

Subsystems (2)
lore
Share & tools
lore

Bard Liao

author maintainer
#0 lore raw

PATCH 1/1 soundwire: cadence_master: wait and cancel cdns->work before clock stop

A peripheral event could happen during the clock stop process. We need to wait for the event be handled before stopping the bus clock. Otherwise, we will get the IO transfer timed out issue.

Fixes af4cc917826f ("soundwire: cadence: mask Slave interrupt before stopping clock")
---
 drivers/soundwire/cadence_master.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/soundwire/cadence_master.c +7 -0
index 6fa3739221ee..c41971f4f177 100644
@@ -1702,6 +1702,13 @@ int sdw_cdns_clock_stop(struct sdw_cdns *cdns, bool block_wake)
 		return 0;
 	}
 
+	/*
+	 * wait for any in-flight peripheral event handling to complete before stopping the clock.
+	 * No need to disable peripheral interrupts before canceling the work, as the peripheral
+	 * interrupts are already masked before the work is scheduled.
+	 */
+	cancel_work_sync(&cdns->work);
+
 	/*
 	 * Before entering clock stop we mask the Slave
 	 * interrupts. This helps avoid having to deal with e.g. a
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bard Liao

A peripheral event could happen during the clock stop process. We need to wait for the event be handled before stopping the bus clock. Otherwise, we will get the IO transfer timed out issue.

Fixes af4cc917826f ("soundwire: cadence: mask Slave interrupt before stopping clock")
Quoted 22 lines
---
 drivers/soundwire/cadence_master.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/soundwire/cadence_master.c +7 -0
index 6fa3739221ee..c41971f4f177 100644
@@ -1702,6 +1702,13 @@ int sdw_cdns_clock_stop(struct sdw_cdns *cdns, bool block_wake)
 		return 0;
 	}
 
+	/*
+	 * wait for any in-flight peripheral event handling to complete before stopping the clock.
+	 * No need to disable peripheral interrupts before canceling the work, as the peripheral
+	 * interrupts are already masked before the work is scheduled.
+	 */
+	cancel_work_sync(&cdns->work);
+
 	/*
 	 * Before entering clock stop we mask the Slave
 	 * interrupts. This helps avoid having to deal with e.g. a
maintainer Applied
#2 lore raw
In reply to Bard Liao
Quoted 5 lines · Bard Liao

A peripheral event could happen during the clock stop process. We need to wait for the event be handled before stopping the bus clock. Otherwise, we will get the IO transfer timed out issue.

Applied, thanks!

[1/1] soundwire: cadence_master: wait and cancel cdns->work before clock stop

      commit: aba7b41faeecb7692458095ce6fafc341fe0b80e

Best regards,

Signature · 1 line
~Vinod