From patchwork Wed Dec 25 07:24:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 13920645 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2076.outbound.protection.outlook.com [40.107.95.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 157C018C03E; Wed, 25 Dec 2024 07:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735111484; cv=fail; b=R3VDLbglBKuniSUpIArwkqJRpaLyUJ/fep0S8FO0NZIUb4kY2Popqcw025fNWb8zg54WJFY98XVZrDyw3LRU1/BRqy8V+z1bjdMO/329LjJ+ZY4H4DrtPsjSccF9YcKcbO9fRuTyWY280OyS+0WgtISTC5pi0wPYHt5y9e4Sivc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735111484; c=relaxed/simple; bh=OOdXyhMkqgScgDpHVSpCwuWzGddqnAvvJL/f7v8aA2M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PwSPvG/Ht5qzvq9Y9WMGlZi09DIub5RpmW4m2e7cmCaeqCfzqRQZxm3p65wjEKuSkW0mstxVwyHW9UbUDgoijL++vfkmFnPV34ZrhiIbMFeXTGeQWVamFdsZbAfr9KNFZ7+etkMIw/7zAH0Ey/MpE2xDGtLS+R9Pj2W8NilhenY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=L0uSTFap; arc=fail smtp.client-ip=40.107.95.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="L0uSTFap" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q939F3LQascPqgVlI6gyW5KsOCAWMiVW1zKnleB7kEHlqimFsYLA79jp3CQsx4vxWdUBb/asN9PtHFywLEIn/2f3xifG/qKZ4PGv0fuLzvYi4N+sYPMY0ehzwHe/fjffoQU6MAsNAbFP4H+9SaK83NOMZmDI14YEoX6T/nT/hTD8dIadfWxvWavtM55RIHddKoXTMJnrmvstQ2BMjX9zXMRHLyi2S3U16tRTRLXD1faxrN1kA5ADw5rY4ysxzWYo75Mfqcey85Halm20THL/l7ZWlb+OGFrLn0IUN31npwiMaGt553HHALH3kUgywt3+Vmxn+awftJpYpGh6C60vvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=waGrjmuNGIXeE5ThG6mUrYD42PwNTenpevEuZb6f5fo=; b=q7xq1jv/A/gp9b5SNFBrlPCtZHB0wlUj5T53O6hIX/RX7Hse7MlL8A5Lo2rThco3RexzLgbNtLrA8VQacRFas3K5Fri+36ZzAROcSgvT5Yj0B5AXROTEej3QDA/J3wBUM9tdpWXjV+JNEuRKjF0oKiKvNHvcSd/ksCduv+Dfw2tjOVBbAK6uKMpNj0EhBgBN20yu9HQgVKAEsSamLcOZtZ0XiLXo89ygj8AfyguDFdUu3hMKf6UrqylJpyDW7FWvBJYgNe8opPGvs5jV1azyYBXN6YYAYurL/UODp3dXyirxktup2sBxFwp6EDJR6cYP/Je89U8r34cGtVG8HCsP1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=waGrjmuNGIXeE5ThG6mUrYD42PwNTenpevEuZb6f5fo=; b=L0uSTFap/YC7y356XgiGfMBXL1K7q88ZRUCujo+803IoN4c/DCneLcLH2F7Jq5cQWNPOT14Y1X1VwNgreP8xkk/HbwlQB3dYpn1Fbs159pXkvnZveZ90OuCKhsJOtsf7vmeAseaS9l6clFOOOiVW5qyY3o2XF7upYmpXW0970iU= Received: from PH7PR17CA0022.namprd17.prod.outlook.com (2603:10b6:510:324::7) by SJ1PR12MB6268.namprd12.prod.outlook.com (2603:10b6:a03:455::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.21; Wed, 25 Dec 2024 07:24:34 +0000 Received: from MWH0EPF000A672F.namprd04.prod.outlook.com (2603:10b6:510:324:cafe::40) by PH7PR17CA0022.outlook.office365.com (2603:10b6:510:324::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.13 via Frontend Transport; Wed, 25 Dec 2024 07:24:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000A672F.mail.protection.outlook.com (10.167.249.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8293.12 via Frontend Transport; Wed, 25 Dec 2024 07:24:33 +0000 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Dec 2024 01:24:29 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , "Vijendar Mukunda" Subject: [PATCH 5/5] soundwire: amd: clear soundwire pme wake status Date: Wed, 25 Dec 2024 12:54:00 +0530 Message-ID: <20241225072400.912445-6-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241225072400.912445-1-Vijendar.Mukunda@amd.com> References: <20241225072400.912445-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A672F:EE_|SJ1PR12MB6268:EE_ X-MS-Office365-Filtering-Correlation-Id: 908fcd25-cfed-4025-4c23-08dd24b52e3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: XqVexGUYHvca/ADAQKtZSA3hxK7/MGeTP4Bru54y7gnzdFjMAfgd8FgFPVSIxFV0Gjrm6y5gPVRQncvC3oVLHAEU0zCv7S8b5LFrU/8ZiQ2aCiEpXu87GZyQQPXp8hQNzFUEJ60b6oj9LKW/266WTNA4HtHXUug4bMUvgFX3qwOP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m+KMbHCKRGYQ5eh9qv9M/pBuKqupJFifag9aLgSQiUaz+taohFDfO+4pQomG4Fw/RaenLr1EbXBlSXxpVoMoxVWPyUFc0y+xs1PFV6mgN+DJocTi2fA9hoE+fEjFpLHfIzMp08TvXaO8XGcmPebdlrBaOaWGAUq2vT20JxxiFu/kPgrts4eBOAAMKidFAkyV4T5L9dkCUM8UtpbUu3JrDrMQieDEzDaeB0L6MokmGSNZ2sjJVisPw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Dec 2024 07:24:33.8168 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 908fcd25-cfed-4025-4c23-08dd24b52e3a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000A672F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6268 Clear the SoundWire PME wake status during resume sequence for ACP7.0 & ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- 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,