lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241225072400.912445-6-Vijendar.Mukunda@amd.com>
Date: Wed, 25 Dec 2024 12:54:00 +0530
From: Vijendar Mukunda <Vijendar.Mukunda@....com>
To: <vkoul@...nel.org>
CC: <yung-chuan.liao@...ux.intel.com>, <pierre-louis.bossart@...ux.dev>,
	<sanyog.r.kale@...el.com>, <Basavaraj.Hiregoudar@....com>,
	<Sunil-kumar.Dommati@....com>, <venkataprasad.potturu@....com>,
	<Mario.Limonciello@....com>, <linux-sound@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <alsa-devel@...a-project.org>, "Vijendar
 Mukunda" <Vijendar.Mukunda@....com>
Subject: [PATCH 5/5] soundwire: amd: clear soundwire pme wake status

Clear the SoundWire PME wake status during resume sequence for
ACP7.0 & ACP7.1 platforms.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@....com>
---
 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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ