Clear the SoundWire PME wake status during resume sequence for
ACP7.0 & ACP7.1 platforms.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@xxxxxxx>
---
drivers/soundwire/amd_manager.c | 33 ++++++++++++++++++++++++++++++++-
drivers/soundwire/amd_manager.h | 2 ++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
index 6f9d9f765a20..8b1cb07e8aac 100644
--- a/drivers/soundwire/amd_manager.c
+++ b/drivers/soundwire/amd_manager.c
@@ -1132,6 +1132,28 @@ static int amd_sdw_clock_stop_exit(struct amd_sdw_manager *amd_manager)
return 0;
}
+static int amd_sdw_clear_pme_wake_status(struct amd_sdw_manager *amd_manager)
+{
+ u32 pme_stat, val;
+
+ switch (amd_manager->instance) {
+ case ACP_SDW0:
+ pme_stat = AMD_SDW0_PME_STAT;
+ break;
+ case ACP_SDW1:
+ pme_stat = AMD_SDW1_PME_STAT;
+ break;
+ default:
+ return -EINVAL;
+ }
+ val = readl(amd_manager->acp_mmio + ACP_EXTERNAL_INTR_STAT(ACP_SDW1));
+ if (val & pme_stat)
+ writel(pme_stat, amd_manager->acp_mmio + ACP_EXTERNAL_INTR_STAT(ACP_SDW1));
+ val = readl(amd_manager->acp_mmio + ACP_EXTERNAL_INTR_STAT(ACP_SDW1));
+ dev_dbg(amd_manager->dev, "ACP_EXTERNAL_INTR_STAT1 : 0x%x\n", val);
+ return 0;
+}
+
static int amd_resume_child_device(struct device *dev, void *data)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
@@ -1257,11 +1279,20 @@ static int __maybe_unused amd_resume_runtime(struct device *dev)
}
if (amd_manager->power_mode_mask & AMD_SDW_CLK_STOP_MODE) {
+ if (amd_manager->acp_rev >= ACP70_PCI_REV_ID) {
+ ret = amd_sdw_clear_pme_wake_status(amd_manager);
+ if (ret)
+ return ret;
+ }
return amd_sdw_clock_stop_exit(amd_manager);
} else if (amd_manager->power_mode_mask & AMD_SDW_POWER_OFF_MODE) {
writel(0x00, amd_manager->acp_mmio + ACP_SW_WAKE_EN(amd_manager->instance));
- if (amd_manager->acp_rev >= ACP70_PCI_REV_ID)
+ if (amd_manager->acp_rev >= ACP70_PCI_REV_ID) {
amd_sdw_host_wake_enable(amd_manager, false);
+ ret = amd_sdw_clear_pme_wake_status(amd_manager);
+ if (ret)
+ return ret;
+ }
val = readl(amd_manager->mmio + ACP_SW_CLK_RESUME_CTRL);
if (val) {
val |= AMD_SDW_CLK_RESUME_REQ;
diff --git a/drivers/soundwire/amd_manager.h b/drivers/soundwire/amd_manager.h
index 18faef593865..4f7e236b2e34 100644
--- a/drivers/soundwire/amd_manager.h
+++ b/drivers/soundwire/amd_manager.h
@@ -201,6 +201,8 @@
#define AMD_SDW1_DEVICE_STATE_MASK 0xc
#define AMD_SDW_DEVICE_STATE_D0 0
#define AMD_SDW_DEVICE_STATE_D3 3
+#define AMD_SDW0_PME_STAT BIT(26)
+#define AMD_SDW1_PME_STAT BIT(27)
static u32 amd_sdw_freq_tbl[AMD_SDW_MAX_FREQ_NUM] = {
AMD_SDW_DEFAULT_CLK_FREQ,
--
2.34.1
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]