[PATCH v5 04/25] soundwire: amd: track full pad teardown across suspend/resume
From: Vijendar Mukunda
Date: Sat Nov 07 2026 - 11:14:17 EST
amd_sdw_pad_ctrl() performs a full pad teardown (keeper, pulldown, schmen
and OE) for system suspend, while amd_sdw_oe_ctrl() disables only OE for
wake-armed runtime suspend. amd_resume_runtime() must distinguish between
these two cases to restore pads correctly: a full teardown requires
amd_sdw_pad_ctrl(true) on resume; a wake-armed runtime suspend requires
only amd_sdw_oe_ctrl(true).
Introduce pad_fully_torn_down flag to track when a full pad teardown was
performed. Set the flag after amd_sdw_pad_ctrl(false) in amd_suspend()
using amd_sdw_pad_ctrl_supported() to gate the assignment to revisions
that support pad control. Clear it after the full restore in
amd_resume_runtime(). On resume, restore all pads if the flag is set,
otherwise restore OE only; both paths delegate revision gating to the
respective helpers.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@xxxxxxx>
---
drivers/soundwire/amd_manager.c | 12 ++++++++++--
include/linux/soundwire/sdw_amd.h | 7 +++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
index b21691652490..28f5dbe131dc 100644
--- a/drivers/soundwire/amd_manager.c
+++ b/drivers/soundwire/amd_manager.c
@@ -1418,7 +1418,10 @@ static int __maybe_unused amd_suspend(struct device *dev)
if (ret)
return ret;
/* System suspend: tear down all pads */
- amd_sdw_pad_ctrl(amd_manager, false);
+ if (amd_sdw_pad_ctrl_supported(amd_manager)) {
+ amd_sdw_pad_ctrl(amd_manager, false);
+ amd_manager->pad_fully_torn_down = true;
+ }
}
if (amd_manager->acp_rev >= ACP70_PCI_REV_ID) {
ret = amd_sdw_set_device_state(amd_manager, AMD_SDW_DEVICE_STATE_D3);
@@ -1510,7 +1513,12 @@ static int __maybe_unused amd_resume_runtime(struct device *dev)
return ret;
}
} else if (amd_manager->power_mode_mask & AMD_SDW_POWER_OFF_MODE) {
- amd_sdw_pad_ctrl(amd_manager, true);
+ if (amd_manager->pad_fully_torn_down) {
+ amd_sdw_pad_ctrl(amd_manager, true);
+ amd_manager->pad_fully_torn_down = false;
+ } else {
+ amd_sdw_oe_ctrl(amd_manager, true);
+ }
writel(0x00, amd_manager->acp_mmio + ACP_SW_WAKE_EN(amd_manager->instance));
if (amd_manager->acp_rev >= ACP70_PCI_REV_ID) {
ret = amd_sdw_host_wake_enable(amd_manager, false);
diff --git a/include/linux/soundwire/sdw_amd.h b/include/linux/soundwire/sdw_amd.h
index 470360a2723c..c959d0fe2a39 100644
--- a/include/linux/soundwire/sdw_amd.h
+++ b/include/linux/soundwire/sdw_amd.h
@@ -75,6 +75,12 @@ struct sdw_amd_dai_runtime {
* @wake_en_mask: wake enable mask per SoundWire manager
* @acp_rev: acp pci device revision id
* @clk_stopped: flag set to true when clock is stopped
+ * @pad_fully_torn_down: true when system suspend performed a full pad
+ * teardown (keeper, schmen and OE cleared, pulldown asserted). Cleared after
+ * all pads are restored in amd_resume_runtime(). False on initial probe
+ * (zero-initialized) and after a wake-armed runtime suspend in which
+ * only OE was disabled; in the latter case amd_resume_runtime() restores
+ * OE only, leaving keeper and schmen untouched.
* @power_mode_mask: flag interprets amd SoundWire manager power mode
* @dai_runtime_array: dai runtime array
*/
@@ -106,6 +112,7 @@ struct amd_sdw_manager {
u32 power_mode_mask;
u32 acp_rev;
bool clk_stopped;
+ bool pad_fully_torn_down;
struct sdw_amd_dai_runtime **dai_runtime_array;
};
--
2.53.0