From patchwork Thu Aug 8 16:57:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 13757960 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2078.outbound.protection.outlook.com [40.107.243.78]) (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 6906B191F93; Thu, 8 Aug 2024 16:58:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723136319; cv=fail; b=AyqX3W+ngNZDH102LaKj3pzUPMvE6r1bL93XfVpfxgVNwfvZSB6IiZuytpjKiyu9M8BhHvhBVybV3I8D4h9WGpzanSaJdKOXxO8O9I+wxvxkrIdnzcw4Dx5VCvt6imu5BXXit6sZ9bVuQkUdppoQyDX3CDwE7mZL1x3u2qR9m68= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723136319; c=relaxed/simple; bh=IbvEYfxUpu8uJp6sM8KoJiMvrQ3grjF0UH/yg6pUjIk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AycQm2GVoM6xfrVYxTdgJbRmlgo2nkbynuYenOARc/642fkPxaUMaL3W+rLtQHaq4FJ2M7Nk4vDwVbJaPoq/LjYOnDAiHWC+kYg15tx8JCFz/T78gIDHbdq98pza636VPZLqssxoLIxuNc/KKOy+Sf3aue2JJesUfTYWE012YKQ= 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=SJH3VywQ; arc=fail smtp.client-ip=40.107.243.78 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="SJH3VywQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eRrPUQR0CbI4GgfP0MM1XaCbNPcv1KlkVZ7gdAJu4rbq/1zMMIdHf61zDjPVoBdlMmUev3E2cXfLW2SQYRMN72gK6H2H4s7mzjc7fjk8BTgGZV3M+gOZZ/X1wp6b7jB7SXAWG7c8JOdkT6ZDivLm+6yOw574S8WMWMMvFAvRoqhPmKfV7moqGMY9K1UDME9I0L/HWKFhDsOnQzvO2/xnspAyI7HfIPSWV1Y5dVT+lqMw+it5534zKeUd1pVOnCDv4/0nHPF4/BfQ1cvrWrKrUogRz7xQvAUGVTuEYVb2ENqi4lt7kfLaYMC7vQy0Aq5NH/TXFoPzfjgZ3KRRNh+zIA== 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=RTVy/S40reH6dPiVHmQp8KHQmxDvKLVFHwzi2x1SwAE=; b=A+sFhjNvKCf9tz6zVuEIAGaOWl87g8zHKgxwmQhYpVnEaOQM/YbePiWRgOnZGhYZ0Uqx82dtbUD87k6bJIEHOIQ61e2EoEoB0vSxmszandJsAHRAPHJM80jhGn61MQlvAOS81fHrTOgIO0CYdH0NG8Pfdi4pIBfFhsnWSr+KHkfojdgbVZS6AS6BTnmDjS38paHqeM3TsWDKNMVbHj/61lqNwNNRLHJ1Su3FKqT9h8eBtDMWfaX6A7vjSRR4eqNqd0o4TFQ06V+EpqjKTp72PD4lEPYpYtiT11WN3f1Xq/K6wAvtzKQ48JaLUwxb0QhCTtxivBlRwd8yETVUakhBlA== 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=RTVy/S40reH6dPiVHmQp8KHQmxDvKLVFHwzi2x1SwAE=; b=SJH3VywQIbFvUEcciYjs0NHyzlw62A51X1XAuwv890dSf7MKJuvQa6ReCh1gzLq7e00jgOOgxye4XrBBwM0faJQleE3o5VMD6C1cDk7RQKDAJIYrmZ81mtiIeK11mHHivb7uPXKSE5b26VSKxPC6jWnSrHrrYzI913JoVIIjmE4= Received: from BLAP220CA0002.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::7) by MW4PR12MB5601.namprd12.prod.outlook.com (2603:10b6:303:168::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.21; Thu, 8 Aug 2024 16:58:33 +0000 Received: from BL6PEPF0001AB52.namprd02.prod.outlook.com (2603:10b6:208:32c:cafe::f) by BLAP220CA0002.outlook.office365.com (2603:10b6:208:32c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.15 via Frontend Transport; Thu, 8 Aug 2024 16:58:32 +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 BL6PEPF0001AB52.mail.protection.outlook.com (10.167.241.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7849.8 via Frontend Transport; Thu, 8 Aug 2024 16:58:32 +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; Thu, 8 Aug 2024 11:58:27 -0500 From: Vijendar Mukunda To: CC: , , , , , , , , , , , , , , , , Vijendar Mukunda Subject: [PATCH RESEND 4/8] ASoC: SOF: amd: fix for acp init sequence Date: Thu, 8 Aug 2024 22:27:49 +0530 Message-ID: <20240808165753.3414464-5-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240808165753.3414464-1-Vijendar.Mukunda@amd.com> References: <20240808165753.3414464-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB52:EE_|MW4PR12MB5601:EE_ X-MS-Office365-Filtering-Correlation-Id: 6232405f-2c7b-4a34-33f8-08dcb7cb55f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: biatN/QS/OMH8rrO7augVO1rfvhrYjxju2VDSW4rj1xWnpeq3SrBrgI6A2VPKhn540yiJqU2zX1n2a6R/xjlFHTk42+hOHz2YRllf6to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EuZyaQRAErsKH3pbKHbiSRUb7/Q2h4V/PA/IfAHBAgOCrojHfOomZ9Wij1A6eIXMxWBKPYj1dw55yAYEdKgX0ukO2FE4BWAMd9w4K1RP/YjJEE0bLJaPAOWIEsfZqIlDzrtHWslfvwjcGqxrMQkQ12NLNaiDeWjJLt4tCW7hIpH11ZS1BYxQFzV9OR2ATdMd82rh7dVMDe783KzhbQ7aW1HjW8aKQ3tCPJXs+rCkCJDGJdW9Ec0vN4qULCuKA4jffUyeB6xPv6Y2zMf31Z9wzrB1xtysgOk 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)(7416014)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2024 16:58:32.7429 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6232405f-2c7b-4a34-33f8-08dcb7cb55f6 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: BL6PEPF0001AB52.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5601 When ACP is not powered on by default, acp power on sequence explicitly invoked by programming pgfsm control mask. Update ACP pgfsm control mask and status mask based on ACP variant. Fixes: 846aef1d7cc0 ("ASoC: SOF: amd: Add Renoir ACP HW support") Signed-off-by: Vijendar Mukunda Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/amd/acp.c | 21 +++++++++++++++++++-- sound/soc/sof/amd/acp.h | 7 +++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index d0ba641ba28c..a9f32983b3af 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -430,8 +430,10 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id) static int acp_power_on(struct snd_sof_dev *sdev) { const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); + struct acp_dev_data *adata = sdev->pdata->hw_pdata; unsigned int base = desc->pgfsm_base; unsigned int val; + unsigned int acp_pgfsm_status_mask, acp_pgfsm_cntl_mask; int ret; val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET); @@ -439,9 +441,24 @@ static int acp_power_on(struct snd_sof_dev *sdev) if (val == ACP_POWERED_ON) return 0; - if (val & ACP_PGFSM_STATUS_MASK) + switch (adata->pci_rev) { + case ACP_RN_PCI_ID: + case ACP_VANGOGH_PCI_ID: + acp_pgfsm_status_mask = ACP3X_PGFSM_STATUS_MASK; + acp_pgfsm_cntl_mask = ACP3X_PGFSM_CNTL_POWER_ON_MASK; + break; + case ACP_RMB_PCI_ID: + case ACP63_PCI_ID: + acp_pgfsm_status_mask = ACP6X_PGFSM_STATUS_MASK; + acp_pgfsm_cntl_mask = ACP6X_PGFSM_CNTL_POWER_ON_MASK; + break; + default: + return -EINVAL; + } + + if (val & acp_pgfsm_status_mask) snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + PGFSM_CONTROL_OFFSET, - ACP_PGFSM_CNTL_POWER_ON_MASK); + acp_pgfsm_cntl_mask); ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET, val, !val, ACP_REG_POLL_INTERVAL, ACP_REG_POLL_TIMEOUT_US); diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index f6f0fcfeb691..321c40cc6d50 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -25,8 +25,11 @@ #define ACP_REG_POLL_TIMEOUT_US 2000 #define ACP_DMA_COMPLETE_TIMEOUT_US 5000 -#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 -#define ACP_PGFSM_STATUS_MASK 0x03 +#define ACP3X_PGFSM_CNTL_POWER_ON_MASK 0x01 +#define ACP3X_PGFSM_STATUS_MASK 0x03 +#define ACP6X_PGFSM_CNTL_POWER_ON_MASK 0x07 +#define ACP6X_PGFSM_STATUS_MASK 0x0F + #define ACP_POWERED_ON 0x00 #define ACP_ASSERT_RESET 0x01 #define ACP_RELEASE_RESET 0x00