From patchwork Thu Dec 19 05:48:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914484 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2064.outbound.protection.outlook.com [40.107.100.64]) (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 4993D21660F; Thu, 19 Dec 2024 05:49:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587369; cv=fail; b=qbuIJr9wZUqffxUSRCkxwszXaYyOgM+D5mBFtnTr5Xfh8gRaHvdFxx9eYQuUt9moA99ynMQ1oKlhRuIejZ1FkjaMAp3Pmzi1rQK6lKSQKBlfDmDSRd4l7JT9PQZLsII8AJwFOVX2qNeTpuPxO4bNd6hFZ99C8UbfUvcuzulmt0Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587369; c=relaxed/simple; bh=byhCUQKlJTkl15m+xRBkKItXbuPYYbC1wkHqNUoVjo4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=El8gAUIBmYVVoVSBtc1skTXPM190bM5iRQsxcZtcwGaMk5+W20jG+tgvgSeUlTcdpWiRuRf1oqb86SDb4NUGGPPkmHkTwu9p8zfqzHNOqxCHkHuEqDPiZgp61Pnbpl6VTbczRpA9T3hHGrhVsAWOFud+AFIl+E7Rrt6e38lBJxU= 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=KmY5oxvu; arc=fail smtp.client-ip=40.107.100.64 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="KmY5oxvu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gAK0kIw3GbH85c5jtcKxL7xOB8BbT1dIp6P90RdnMUCeIoDtCBvDgEcgqHnt4BODffI5BPiuCbYuTeLThQO4ua34hLFKm0VdX6E8PUgeP/fUml7a+E9vH3hlyy18Zqvi2rqTVGuQyu3ME0qT86MoRDDTPSrrsHKKpzIks8uJyQfnXlPA0uQVvLKLeQ2Oee88yYYv905ZC8rggzdRHAqOwF1bdp/AXga0WErdRwUem6dGN9Br3iMZAgpuA+7ea/tXV3FKH64K6eGiax7v2NFw22+C5YDndcog4g3gBFXj+P5XvaMNi+S3LdIvPN1jJJrhOPbQxtYwugIztuybOVV0ag== 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=6vlNkV/RtEvW3xa84teBzsXeH9ffrowFb0rpXfzlQ8w=; b=xtQUtpliE16kCOsdSLJLDdOPaH6LI3m/UGWDzfzqmBsxkUIJr6BSNKWEmaeOHi4daDDwAVOZlWEya688VvohrVtU6jgBXmTy+OJsMWvYsulQ5CPX10Bt9Mdc7FM+NSeK0kY7yx5HYYvsJTZmk++2RGrY6nQzHRqjT0jrgR52Gjmt7wrAWGnZF36Zf0OujZp+iDsKhENyelkhqu564wnnOaISUyFxraUPjCT4B8U0YtMTcwN3E/5m1XjJUW4Lkc8Afoyb9r+kVE2vy5Pu58rGBcsyHo+nHLj8hLCwJjznL4SRQhnRaabwZaXZ44tkNbUe+uiC23M1ZNdM+mLe5a4Yxw== 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=6vlNkV/RtEvW3xa84teBzsXeH9ffrowFb0rpXfzlQ8w=; b=KmY5oxvu7Qde6EihP13X9PHw8mYP5xlPg5bH6wHL2umdyPTxSBZXUTStlfFYaVua0Bpv6dZv8Q/2d8rfYdDPvIUe1rGFlYFn5LnWeAAEe5zEZpH7AbUHi0YcqmMGCrG/zi6bxggKUWMovQK/uGazve3/OKwbo38kHWBi+Yrbi5U= Received: from CH2PR11CA0027.namprd11.prod.outlook.com (2603:10b6:610:54::37) by CH3PR12MB9315.namprd12.prod.outlook.com (2603:10b6:610:1cf::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:49:21 +0000 Received: from CH2PEPF0000013B.namprd02.prod.outlook.com (2603:10b6:610:54:cafe::2d) by CH2PR11CA0027.outlook.office365.com (2603:10b6:610:54::37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:49:21 +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 CH2PEPF0000013B.mail.protection.outlook.com (10.167.244.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:49:21 +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, 18 Dec 2024 23:49:17 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 01/21] ASoC: amd: add register header file for ACP7.0 platform Date: Thu, 19 Dec 2024 11:18:37 +0530 Message-ID: <20241219054857.2070420-2-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH2PEPF0000013B:EE_|CH3PR12MB9315:EE_ X-MS-Office365-Filtering-Correlation-Id: 39052d76-ebe9-4071-d034-08dd1ff0e30c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: /A3ZHYyWNwNFNtDMJD91Uwt3KHR4Jg0Fuu0F3Bbh9dFX5+PrD8i8tXea7oaOuamxxR4UsmJiYepCUIhFwrhpYPpFcgcV8Z+53B9sQ7dO0cObEthdwHr6gbJ3qVA+JFauFDyJ31m8kqTLeuGhgbLBDdQFKwC34SxmzfyhnI/7vrdLIHN1c+G2gQ+PWcIrCeDsldE/7jIydNmHFlP4GJwV/zqT0/FhsaG+xjFdnLZqGZgl/w2/QSYtzrJ0bPB0DBbjXeBALeOTLYg6W1Pi8Cx1YSQLPuMTdbYB4Dsq4WDxZZhK3nSXVouxZdXIDx4NxhoOfzwIk/5pL1uCxJc5f2xRvmeL8lpobNKY70lDWn/PB2Vlk6W5/lCUEVM+gzsOxNPP0LRLo5sTQVMt3/H0X4lMCm0RkBCIrw1KatHGQWuuLH6ndAwPdiL82CwtykKS4E1Eps4ypcEvhrFqKMaLQcgTzdkWkbJmaKrWbOTfpRU9SGilC8A0cI4zuYH6rEEBZ2UKs418LUSXzoawWR+Dns+OVSqBCLDhinAfyXut2Euxg03QWmi2+5NUNbfh0aLewLOY/8D+aJ4ugA3P4PGGeDi1zTaPcvZOOohPUhqZ8Lt9Y4/GV2Mut4qLlORQk+4qhBfFxvTmfGGS66ekiPruiDt8QyISnsXw9jjcos3xbNkYLQYv5MiQ7L1uM2yYtWhs/k+XQib52PnVgENlOMfhOrkYkQj0iGCU6DacaNREC/5s5ofBH+x528GWgDobMVwYXmrUCDeSK0ACHqqZdkclFuNmcg+FXdgKzQfTju7Uxd3UJm2eYha+OY/N1HcG6AyqBXj2lppN70SkZZmFDa7fWor78Lq4dGlHAb0Fk33w9rJuROs1LZWG/ePxQsfNCkkckZq9I5HVQQoL5eXWpmuQIy9xLJFj4dO464L/NMgb7fbEXMsMZzdVN418MNwCxr/cV13idVcyDB7UAudEhSqTe/1rM0TG/q15cRaEv/AyyZftdVdXbZgYP9YFOruEf9kWisT2q3KnR69xSohG49rSBOD9vy7NmAMoYjQT+TS34Lc0h7brb9j2AlIYgf2lvfyo7ULgDbpasSpxl6kWHXNZ6JsSUnypoxg0/lvGM4FMQHJIaPCNn1V12zN4UWk4mRoKrW+N/CTN/1Krmno3kuFXTzrJmlVXBzcOulT+ggsG7usYJ22ICZyZHv4wOCECT1+APnLdTWiu2tX9WozOUkc3JCKNW9OfcbsZvzm8vYB2zrYUPWbMlAsOGzQkwirs+ANA+jOKRGoKdIUzLaF3Ie2o5x1p03lgSBGz+yGAkECaKY8v44TnWg/kdp8lquXBFmknqM3rDMkm+usy4VcWfpF9dpO47+NQyHg2TohYhDxAzsCGZH2DzVT+KZ9l/AuJCj6UxJSUcDH2L1XHMx02bk70A7D0BhRx4xB7udN9+ForHK3Hi8Uvy1SqDcJFdiCreurzz6AfezJCC5smkwkRx46soLTC+XEAY3c7LNvhpNqX2QLVt2c= 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)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:49:21.7577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39052d76-ebe9-4071-d034-08dd1ff0e30c 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: CH2PEPF0000013B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9315 Add ACP IP register header file for ACP7.0 platform. Signed-off-by: Vijendar Mukunda --- include/sound/acp70_chip_offset_byte.h | 484 +++++++++++++++++++++++++ 1 file changed, 484 insertions(+) create mode 100644 include/sound/acp70_chip_offset_byte.h diff --git a/include/sound/acp70_chip_offset_byte.h b/include/sound/acp70_chip_offset_byte.h new file mode 100644 index 000000000000..c0d51a0e012e --- /dev/null +++ b/include/sound/acp70_chip_offset_byte.h @@ -0,0 +1,484 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * AMD ACP 7.0 Register Documentation + * + * Copyright 2024 Advanced Micro Devices, Inc. + */ + +#ifndef _acp_ip_OFFSET_HEADER +#define _acp_ip_OFFSET_HEADER + +/* Registers from ACP_AXI2AXIATU block */ +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1 0x0000C00 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_1 0x0000C04 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_2 0x0000C08 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_2 0x0000C0C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_3 0x0000C10 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_3 0x0000C14 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_4 0x0000C18 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_4 0x0000C1C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_5 0x0000C20 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_5 0x0000C24 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_6 0x0000C28 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_6 0x0000C2C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_7 0x0000C30 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_7 0x0000C34 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_8 0x0000C38 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_8 0x0000C3C +#define ACPAXI2AXI_ATU_CTRL 0x0000C40 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_9 0x0000C44 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_9 0x0000C48 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_10 0x0000C4C +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_10 0x0000C50 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_11 0x0000C54 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_11 0x0000C58 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_12 0x0000C5C +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_12 0x0000C60 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_13 0x0000C64 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_13 0x0000C68 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_14 0x0000C6C +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_14 0x0000C70 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_15 0x0000C74 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_15 0x0000C78 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_16 0x0000C7C +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_16 0x0000C80 + +/* Registers from ACP_CLKRST block */ +#define ACP_SOFT_RESET 0x0001000 +#define ACP_CONTROL 0x0001004 +#define ACP_STATUS 0x0001008 +#define ACP_DYNAMIC_CG_MASTER_CONTROL 0x0001010 +#define ACP_ZSC_DSP_CTRL 0x0001014 +#define ACP_ZSC_STS 0x0001018 +#define ACP_PGFSM_CONTROL 0x0001024 +#define ACP_PGFSM_STATUS 0x0001028 +#define ACP_CLKMUX_SEL 0x000102C +#define ACP_SW0_48MHZ_CLK_SEL 0x0001030 + +/* Registers from ACP_AON block */ +#define ACP_PME_EN 0x0001400 +#define ACP_DEVICE_STATE 0x0001404 +#define AZ_DEVICE_STATE 0x0001408 +#define SW_DEVICE_STATE 0x0001430 +#define ACP_PIN_CONFIG 0x0001440 +#define ACP_PAD_PULLUP_CTRL 0x0001444 +#define ACP_PAD_PULLDOWN_CTRL 0x0001448 +#define ACP_PAD_DRIVE_STRENGTH_CTRL 0x000144C +#define ACP_PAD_SCHMEN_CTRL 0x0001450 +#define ACP_SW_PAD_KEEPER_EN 0x0001454 +#define ACP_SW0_WAKE_EN 0x0001458 +#define ACP_I2S_WAKE_EN 0x000145C +#define ACP_SW1_WAKE_EN 0x0001460 +#define ACP_PAD_DISABLE_OE_CTRL 0x0001468 + +/* Registers from ACP_MISC block */ +#define ACP_SW0_I2S_ERROR_REASON 0x00018B4 +#define ACP_SW0_POS_TRACK_AUDIO0_TX_CTRL 0x00018B8 +#define ACP_SW0_AUDIO0_TX_DMA_POS 0x00018BC +#define ACP_SW0_POS_TRACK_AUDIO1_TX_CTRL 0x00018C0 +#define ACP_SW0_AUDIO1_TX_DMA_POS 0x00018C4 +#define ACP_SW0_POS_TRACK_AUDIO2_TX_CTRL 0x00018C8 +#define ACP_SW0_AUDIO2_TX_DMA_POS 0x00018CC +#define ACP_SW0_POS_TRACK_AUDIO0_RX_CTRL 0x00018D0 +#define ACP_SW0_AUDIO0_DMA_POS 0x00018D4 +#define ACP_SW0_POS_TRACK_AUDIO1_RX_CTRL 0x00018D8 +#define ACP_SW0_AUDIO1_RX_DMA_POS 0x00018DC +#define ACP_SW0_POS_TRACK_AUDIO2_RX_CTRL 0x00018E0 +#define ACP_SW0_AUDIO2_RX_DMA_POS 0x00018E4 +#define ACP_ERROR_INTR_MASK1 0x0001974 +#define ACP_ERROR_INTR_MASK2 0x0001978 +#define ACP_ERROR_INTR_MASK3 0x000197C + +/* Registers from ACP_P1_MISC block */ +#define ACP_EXTERNAL_INTR_ENB 0x0001A00 +#define ACP_EXTERNAL_INTR_CNTL 0x0001A04 +#define ACP_EXTERNAL_INTR_CNTL1 0x0001A08 +#define ACP_EXTERNAL_INTR_STAT 0x0001A0C +#define ACP_EXTERNAL_INTR_STAT1 0x0001A10 +#define ACP_ERROR_STATUS 0x0001A4C +#define ACP_SW1_I2S_ERROR_REASON 0x0001A50 +#define ACP_SW1_POS_TRACK_AUDIO0_TX_CTRL 0x0001A6C +#define ACP_SW1_AUDIO0_TX_DMA_POS 0x0001A70 +#define ACP_SW1_POS_TRACK_AUDIO0_RX_CTRL 0x0001A74 +#define ACP_SW1_AUDIO0_RX_DMA_POS 0x0001A78 +#define ACP_P1_DMIC_I2S_GPIO_INTR_CTRL 0x0001A7C +#define ACP_P1_DMIC_I2S_GPIO_INTR_STATUS 0x0001A80 +#define ACP_SCRATCH_REG_BASE_ADDR 0x0001A84 +#define ACP_SW1_POS_TRACK_AUDIO1_TX_CTRL 0x0001A88 +#define ACP_SW1_AUDIO1_TX_DMA_POS 0x0001A8C +#define ACP_SW1_POS_TRACK_AUDIO2_TX_CTRL 0x0001A90 +#define ACP_SW1_AUDIO2_TX_DMA_POS 0x0001A94 +#define ACP_SW1_POS_TRACK_AUDIO1_RX_CTRL 0x0001A98 +#define ACP_SW1_AUDIO1_RX_DMA_POS 0x0001A9C +#define ACP_SW1_POS_TRACK_AUDIO2_RX_CTRL 0x0001AA0 +#define ACP_SW1_AUDIO2_RX_DMA_POS 0x0001AA4 +#define ACP_ERROR_INTR_MASK4 0x0001AEC +#define ACP_ERROR_INTR_MASK5 0x0001AF0 +#define ACP_ERROR_STATUS1 0x0001B28 + +/* Registers from ACP_AUDIO_BUFFERS block */ +#define ACP_AUDIO0_RX_RINGBUFADDR 0x0002000 +#define ACP_AUDIO0_RX_RINGBUFSIZE 0x0002004 +#define ACP_AUDIO0_RX_LINKPOSITIONCNTR 0x0002008 +#define ACP_AUDIO0_RX_FIFOADDR 0x000200C +#define ACP_AUDIO0_RX_FIFOSIZE 0x0002010 +#define ACP_AUDIO0_RX_DMA_SIZE 0x0002014 +#define ACP_AUDIO0_RX_LINEARPOSITIONCNTR_HIGH 0x0002018 +#define ACP_AUDIO0_RX_LINEARPOSITIONCNTR_LOW 0x000201C +#define ACP_AUDIO0_RX_INTR_WATERMARK_SIZE 0x0002020 +#define ACP_AUDIO0_TX_RINGBUFADDR 0x0002024 +#define ACP_AUDIO0_TX_RINGBUFSIZE 0x0002028 +#define ACP_AUDIO0_TX_LINKPOSITIONCNTR 0x000202C +#define ACP_AUDIO0_TX_FIFOADDR 0x0002030 +#define ACP_AUDIO0_TX_FIFOSIZE 0x0002034 +#define ACP_AUDIO0_TX_DMA_SIZE 0x0002038 +#define ACP_AUDIO0_TX_LINEARPOSITIONCNTR_HIGH 0x000203C +#define ACP_AUDIO0_TX_LINEARPOSITIONCNTR_LOW 0x0002040 +#define ACP_AUDIO0_TX_INTR_WATERMARK_SIZE 0x0002044 +#define ACP_AUDIO1_RX_RINGBUFADDR 0x0002048 +#define ACP_AUDIO1_RX_RINGBUFSIZE 0x000204C +#define ACP_AUDIO1_RX_LINKPOSITIONCNTR 0x0002050 +#define ACP_AUDIO1_RX_FIFOADDR 0x0002054 +#define ACP_AUDIO1_RX_FIFOSIZE 0x0002058 +#define ACP_AUDIO1_RX_DMA_SIZE 0x000205C +#define ACP_AUDIO1_RX_LINEARPOSITIONCNTR_HIGH 0x0002060 +#define ACP_AUDIO1_RX_LINEARPOSITIONCNTR_LOW 0x0002064 +#define ACP_AUDIO1_RX_INTR_WATERMARK_SIZE 0x0002068 +#define ACP_AUDIO1_TX_RINGBUFADDR 0x000206C +#define ACP_AUDIO1_TX_RINGBUFSIZE 0x0002070 +#define ACP_AUDIO1_TX_LINKPOSITIONCNTR 0x0002074 +#define ACP_AUDIO1_TX_FIFOADDR 0x0002078 +#define ACP_AUDIO1_TX_FIFOSIZE 0x000207C +#define ACP_AUDIO1_TX_DMA_SIZE 0x0002080 +#define ACP_AUDIO1_TX_LINEARPOSITIONCNTR_HIGH 0x0002084 +#define ACP_AUDIO1_TX_LINEARPOSITIONCNTR_LOW 0x0002088 +#define ACP_AUDIO1_TX_INTR_WATERMARK_SIZE 0x000208C +#define ACP_AUDIO2_RX_RINGBUFADDR 0x0002090 +#define ACP_AUDIO2_RX_RINGBUFSIZE 0x0002094 +#define ACP_AUDIO2_RX_LINKPOSITIONCNTR 0x0002098 +#define ACP_AUDIO2_RX_FIFOADDR 0x000209C +#define ACP_AUDIO2_RX_FIFOSIZE 0x00020A0 +#define ACP_AUDIO2_RX_DMA_SIZE 0x00020A4 +#define ACP_AUDIO2_RX_LINEARPOSITIONCNTR_HIGH 0x00020A8 +#define ACP_AUDIO2_RX_LINEARPOSITIONCNTR_LOW 0x00020AC +#define ACP_AUDIO2_RX_INTR_WATERMARK_SIZE 0x00020B0 +#define ACP_AUDIO2_TX_RINGBUFADDR 0x00020B4 +#define ACP_AUDIO2_TX_RINGBUFSIZE 0x00020B8 +#define ACP_AUDIO2_TX_LINKPOSITIONCNTR 0x00020BC +#define ACP_AUDIO2_TX_FIFOADDR 0x00020C0 +#define ACP_AUDIO2_TX_FIFOSIZE 0x00020C4 +#define ACP_AUDIO2_TX_DMA_SIZE 0x00020C8 +#define ACP_AUDIO2_TX_LINEARPOSITIONCNTR_HIGH 0x00020CC +#define ACP_AUDIO2_TX_LINEARPOSITIONCNTR_LOW 0x00020D0 +#define ACP_AUDIO2_TX_INTR_WATERMARK_SIZE 0x00020D4 + +/* Registers from ACP_I2S_TDM block */ +#define ACP_I2STDM_IER 0x0002400 +#define ACP_I2STDM_IRER 0x0002404 +#define ACP_I2STDM_RXFRMT 0x0002408 +#define ACP_I2STDM_ITER 0x000240C +#define ACP_I2STDM_TXFRMT 0x0002410 +#define ACP_I2STDM0_MSTRCLKGEN 0x0002414 +#define ACP_I2STDM1_MSTRCLKGEN 0x0002418 +#define ACP_I2STDM2_MSTRCLKGEN 0x000241C +#define ACP_I2STDM_REFCLKGEN 0x0002420 + +/* Registers from ACP_BT_TDM block */ +#define ACP_BTTDM_IER 0x0002800 +#define ACP_BTTDM_IRER 0x0002804 +#define ACP_BTTDM_RXFRMT 0x0002808 +#define ACP_BTTDM_ITER 0x000280C +#define ACP_BTTDM_TXFRMT 0x0002810 +#define ACP_HSTDM_IER 0x0002814 +#define ACP_HSTDM_IRER 0x0002818 +#define ACP_HSTDM_RXFRMT 0x000281C +#define ACP_HSTDM_ITER 0x0002820 +#define ACP_HSTDM_TXFRMT 0x0002824 + +/* Registers from ACP_WOV block */ +#define ACP_WOV_PDM_ENABLE 0x0002C04 +#define ACP_WOV_PDM_DMA_ENABLE 0x0002C08 +#define ACP_WOV_RX_RINGBUFADDR 0x0002C0C +#define ACP_WOV_RX_RINGBUFSIZE 0x0002C10 +#define ACP_WOV_RX_LINKPOSITIONCNTR 0x0002C14 +#define ACP_WOV_RX_LINEARPOSITIONCNTR_HIGH 0x0002C18 +#define ACP_WOV_RX_LINEARPOSITIONCNTR_LOW 0x0002C1C +#define ACP_WOV_RX_INTR_WATERMARK_SIZE 0x0002C20 +#define ACP_WOV_PDM_FIFO_FLUSH 0x0002C24 +#define ACP_WOV_PDM_NO_OF_CHANNELS 0x0002C28 +#define ACP_WOV_PDM_DECIMATION_FACTOR 0x0002C2C +#define ACP_WOV_PDM_VAD_CTRL 0x0002C30 +#define ACP_WOV_WAKE 0x0002C54 +#define ACP_WOV_BUFFER_STATUS 0x0002C58 +#define ACP_WOV_MISC_CTRL 0x0002C5C +#define ACP_WOV_CLK_CTRL 0x0002C60 +#define ACP_PDM_VAD_DYNAMIC_CLK_GATING_EN 0x0002C64 +#define ACP_WOV_ERROR_STATUS_REGISTER 0x0002C68 +#define ACP_PDM_CLKDIV 0x0002C6C + +/* Registers from ACP_SW0_SWCLK block */ +#define ACP_SW0_EN 0x0003000 +#define ACP_SW0_EN_STATUS 0x0003004 +#define ACP_SW0_FRAMESIZE 0x0003008 +#define ACP_SW0_SSP_COUNTER 0x000300C +#define ACP_SW0_AUDIO0_TX_EN 0x0003010 +#define ACP_SW0_AUDIO0_TX_EN_STATUS 0x0003014 +#define ACP_SW0_AUDIO0_TX_FRAME_FORMAT 0x0003018 +#define ACP_SW0_AUDIO0_TX_SAMPLEINTERVAL 0x000301C +#define ACP_SW0_AUDIO0_TX_HCTRL_DP0 0x0003020 +#define ACP_SW0_AUDIO0_TX_HCTRL_DP1 0x0003024 +#define ACP_SW0_AUDIO0_TX_HCTRL_DP2 0x0003028 +#define ACP_SW0_AUDIO0_TX_HCTRL_DP3 0x000302C +#define ACP_SW0_AUDIO0_TX_OFFSET_DP0 0x0003030 +#define ACP_SW0_AUDIO0_TX_OFFSET_DP1 0x0003034 +#define ACP_SW0_AUDIO0_TX_OFFSET_DP2 0x0003038 +#define ACP_SW0_AUDIO0_TX_OFFSET_DP3 0x000303C +#define ACP_SW0_AUDIO0_TX_CHANNEL_ENABLE_DP0 0x0003040 +#define ACP_SW0_AUDIO0_TX_CHANNEL_ENABLE_DP1 0x0003044 +#define ACP_SW0_AUDIO0_TX_CHANNEL_ENABLE_DP2 0x0003048 +#define ACP_SW0_AUDIO0_TX_CHANNEL_ENABLE_DP3 0x000304C +#define ACP_SW0_AUDIO1_TX_EN 0x0003050 +#define ACP_SW0_AUDIO1_TX_EN_STATUS 0x0003054 +#define ACP_SW0_AUDIO1_TX_FRAME_FORMAT 0x0003058 +#define ACP_SW0_AUDIO1_TX_SAMPLEINTERVAL 0x000305C +#define ACP_SW0_AUDIO1_TX_HCTRL 0x0003060 +#define ACP_SW0_AUDIO1_TX_OFFSET 0x0003064 +#define ACP_SW0_AUDIO1_TX_CHANNEL_ENABLE_DP0 0x0003068 +#define ACP_SW0_AUDIO2_TX_EN 0x000306C +#define ACP_SW0_AUDIO2_TX_EN_STATUS 0x0003070 +#define ACP_SW0_AUDIO2_TX_FRAME_FORMAT 0x0003074 +#define ACP_SW0_AUDIO2_TX_SAMPLEINTERVAL 0x0003078 +#define ACP_SW0_AUDIO2_TX_HCTRL 0x000307C +#define ACP_SW0_AUDIO2_TX_OFFSET 0x0003080 +#define ACP_SW0_AUDIO2_TX_CHANNEL_ENABLE_DP0 0x0003084 +#define ACP_SW0_AUDIO0_RX_EN 0x0003088 +#define ACP_SW0_AUDIO0_RX_EN_STATUS 0x000308C +#define ACP_SW0_AUDIO0_RX_FRAME_FORMAT 0x0003090 +#define ACP_SW0_AUDIO0_RX_SAMPLEINTERVAL 0x0003094 +#define ACP_SW0_AUDIO0_RX_HCTRL_DP0 0x0003098 +#define ACP_SW0_AUDIO0_RX_HCTRL_DP1 0x000309C +#define ACP_SW0_AUDIO0_RX_HCTRL_DP2 0x0003100 +#define ACP_SW0_AUDIO0_RX_HCTRL_DP3 0x0003104 +#define ACP_SW0_AUDIO0_RX_OFFSET_DP0 0x0003108 +#define ACP_SW0_AUDIO0_RX_OFFSET_DP1 0x000310C +#define ACP_SW0_AUDIO0_RX_OFFSET_DP2 0x0003110 +#define ACP_SW0_AUDIO0_RX_OFFSET_DP3 0x0003114 +#define ACP_SW0_AUDIO0_RX_CHANNEL_ENABLE_DP0 0x0003118 +#define ACP_SW0_AUDIO0_RX_CHANNEL_ENABLE_DP1 0x000311C +#define ACP_SW0_AUDIO0_RX_CHANNEL_ENABLE_DP2 0x0003120 +#define ACP_SW0_AUDIO0_RX_CHANNEL_ENABLE_DP3 0x0003124 +#define ACP_SW0_AUDIO1_RX_EN 0x0003128 +#define ACP_SW0_AUDIO1_RX_EN_STATUS 0x000312C +#define ACP_SW0_AUDIO1_RX_FRAME_FORMAT 0x0003130 +#define ACP_SW0_AUDIO1_RX_SAMPLEINTERVAL 0x0003134 +#define ACP_SW0_AUDIO1_RX_HCTRL 0x0003138 +#define ACP_SW0_AUDIO1_RX_OFFSET 0x000313C +#define ACP_SW0_AUDIO1_RX_CHANNEL_ENABLE_DP0 0x0003140 +#define ACP_SW0_AUDIO2_RX_EN 0x0003144 +#define ACP_SW0_AUDIO2_RX_EN_STATUS 0x0003148 +#define ACP_SW0_AUDIO2_RX_FRAME_FORMAT 0x000314C +#define ACP_SW0_AUDIO2_RX_SAMPLEINTERVAL 0x0003150 +#define ACP_SW0_AUDIO2_RX_HCTRL 0x0003154 +#define ACP_SW0_AUDIO2_RX_OFFSET 0x0003158 +#define ACP_SW0_AUDIO2_RX_CHANNEL_ENABLE_DP0 0x000315C +#define ACP_SW0_BPT_PORT_EN 0x0003160 +#define ACP_SW0_BPT_PORT_EN_STATUS 0x0003164 +#define ACP_SW0_BPT_PORT_FRAME_FORMAT 0x0003168 +#define ACP_SW0_BPT_PORT_SAMPLEINTERVAL 0x000316C +#define ACP_SW0_BPT_PORT_HCTRL 0x0003170 +#define ACP_SW0_BPT_PORT_OFFSET 0x0003174 +#define ACP_SW0_BPT_PORT_CHANNEL_ENABLE 0x0003178 +#define ACP_SW0_BPT_PORT_FIRST_BYTE_ADDR 0x000317C +#define ACP_SW0_CLK_RESUME_CTRL 0x0003180 +#define ACP_SW0_CLK_RESUME_DELAY_CNTR 0x0003184 +#define ACP_SW0_BUS_RESET_CTRL 0x0003188 +#define ACP_SW0_PRBS_ERR_STATUS 0x000318C + +/* Registers from ACP_SW0_ACLK block */ +#define ACP_SW0_CORB_BASE_ADDRESS 0x0003200 +#define ACP_SW0_CORB_WRITE_POINTER 0x0003204 +#define ACP_SW0_CORB_READ_POINTER 0x0003208 +#define ACP_SW0_CORB_CONTROL 0x000320C +#define ACP_SW0_CORB_SIZE 0x0003214 +#define ACP_SW0_RIRB_BASE_ADDRESS 0x0003218 +#define ACP_SW0_RIRB_WRITE_POINTER 0x000321C +#define ACP_SW0_RIRB_RESPONSE_INTERRUPT_COUNT 0x0003220 +#define ACP_SW0_RIRB_CONTROL 0x0003224 +#define ACP_SW0_RIRB_SIZE 0x0003228 +#define ACP_SW0_RIRB_FIFO_MIN_THDL 0x000322C +#define ACP_SW0_IMM_CMD_UPPER_WORD 0x0003230 +#define ACP_SW0_IMM_CMD_LOWER_QWORD 0x0003234 +#define ACP_SW0_IMM_RESP_UPPER_WORD 0x0003238 +#define ACP_SW0_IMM_RESP_LOWER_QWORD 0x000323C +#define ACP_SW0_IMM_CMD_STS 0x0003240 +#define ACP_SW0_BRA_BASE_ADDRESS 0x0003244 +#define ACP_SW0_BRA_TRANSFER_SIZE 0x0003248 +#define ACP_SW0_BRA_DMA_BUSY 0x000324C +#define ACP_SW0_BRA_RESP 0x0003250 +#define ACP_SW0_BRA_RESP_FRAME_ADDR 0x0003254 +#define ACP_SW0_BRA_CURRENT_TRANSFER_SIZE 0x0003258 +#define ACP_SW0_STATECHANGE_STATUS_0TO7 0x000325C +#define ACP_SW0_STATECHANGE_STATUS_8TO11 0x0003260 +#define ACP_SW0_STATECHANGE_STATUS_MASK_0TO7 0x0003264 +#define ACP_SW0_STATECHANGE_STATUS_MASK_8TO11 0x0003268 +#define ACP_SW0_CLK_FREQUENCY_CTRL 0x000326C +#define ACP_SW0_ERROR_INTR_MASK 0x0003270 +#define ACP_SW0_PHY_TEST_MODE_DATA_OFF 0x0003274 + +/* Registers from ACP_P1_AUDIO_BUFFERS block */ +#define ACP_P1_AUDIO0_RX_RINGBUFADDR 0x0003A00 +#define ACP_P1_AUDIO0_RX_RINGBUFSIZE 0x0003A04 +#define ACP_P1_AUDIO0_RX_LINKPOSITIONCNTR 0x0003A08 +#define ACP_P1_AUDIO0_RX_FIFOADDR 0x0003A0C +#define ACP_P1_AUDIO0_RX_FIFOSIZE 0x0003A10 +#define ACP_P1_AUDIO0_RX_DMA_SIZE 0x0003A14 +#define ACP_P1_AUDIO0_RX_LINEARPOSITIONCNTR_HIGH 0x0003A18 +#define ACP_P1_AUDIO0_RX_LINEARPOSITIONCNTR_LOW 0x0003A1C +#define ACP_P1_AUDIO0_RX_INTR_WATERMARK_SIZE 0x0003A20 +#define ACP_P1_AUDIO0_TX_RINGBUFADDR 0x0003A24 +#define ACP_P1_AUDIO0_TX_RINGBUFSIZE 0x0003A28 +#define ACP_P1_AUDIO0_TX_LINKPOSITIONCNTR 0x0003A2C +#define ACP_P1_AUDIO0_TX_FIFOADDR 0x0003A30 +#define ACP_P1_AUDIO0_TX_FIFOSIZE 0x0003A34 +#define ACP_P1_AUDIO0_TX_DMA_SIZE 0x0003A38 +#define ACP_P1_AUDIO0_TX_LINEARPOSITIONCNTR_HIGH 0x0003A3C +#define ACP_P1_AUDIO0_TX_LINEARPOSITIONCNTR_LOW 0x0003A40 +#define ACP_P1_AUDIO0_TX_INTR_WATERMARK_SIZE 0x0003A44 +#define ACP_P1_AUDIO1_RX_RINGBUFADDR 0x0003A48 +#define ACP_P1_AUDIO1_RX_RINGBUFSIZE 0x0003A4C +#define ACP_P1_AUDIO1_RX_LINKPOSITIONCNTR 0x0003A50 +#define ACP_P1_AUDIO1_RX_FIFOADDR 0x0003A54 +#define ACP_P1_AUDIO1_RX_FIFOSIZE 0x0003A58 +#define ACP_P1_AUDIO1_RX_DMA_SIZE 0x0003A5C +#define ACP_P1_AUDIO1_RX_LINEARPOSITIONCNTR_HIGH 0x0003A60 +#define ACP_P1_AUDIO1_RX_LINEARPOSITIONCNTR_LOW 0x0003A64 +#define ACP_P1_AUDIO1_RX_INTR_WATERMARK_SIZE 0x0003A68 +#define ACP_P1_AUDIO1_TX_RINGBUFADDR 0x0003A6C +#define ACP_P1_AUDIO1_TX_RINGBUFSIZE 0x0003A70 +#define ACP_P1_AUDIO1_TX_LINKPOSITIONCNTR 0x0003A74 +#define ACP_P1_AUDIO1_TX_FIFOADDR 0x0003A78 +#define ACP_P1_AUDIO1_TX_FIFOSIZE 0x0003A7C +#define ACP_P1_AUDIO1_TX_DMA_SIZE 0x0003A80 +#define ACP_P1_AUDIO1_TX_LINEARPOSITIONCNTR_HIGH 0x0003A84 +#define ACP_P1_AUDIO1_TX_LINEARPOSITIONCNTR_LOW 0x0003A88 +#define ACP_P1_AUDIO1_TX_INTR_WATERMARK_SIZE 0x0003A8C +#define ACP_P1_AUDIO2_RX_RINGBUFADDR 0x0003A90 +#define ACP_P1_AUDIO2_RX_RINGBUFSIZE 0x0003A94 +#define ACP_P1_AUDIO2_RX_LINKPOSITIONCNTR 0x0003A98 +#define ACP_P1_AUDIO2_RX_FIFOADDR 0x0003A9C +#define ACP_P1_AUDIO2_RX_FIFOSIZE 0x0003AA0 +#define ACP_P1_AUDIO2_RX_DMA_SIZE 0x0003AA4 +#define ACP_P1_AUDIO2_RX_LINEARPOSITIONCNTR_HIGH 0x0003AA8 +#define ACP_P1_AUDIO2_RX_LINEARPOSITIONCNTR_LOW 0x0003AAC +#define ACP_P1_AUDIO2_RX_INTR_WATERMARK_SIZE 0x0003AB0 +#define ACP_P1_AUDIO2_TX_RINGBUFADDR 0x0003AB4 +#define ACP_P1_AUDIO2_TX_RINGBUFSIZE 0x0003AB8 +#define ACP_P1_AUDIO2_TX_LINKPOSITIONCNTR 0x0003ABC +#define ACP_P1_AUDIO2_TX_FIFOADDR 0x0003AC0 +#define ACP_P1_AUDIO2_TX_FIFOSIZE 0x0003AC4 +#define ACP_P1_AUDIO2_TX_DMA_SIZE 0x0003AC8 +#define ACP_P1_AUDIO2_TX_LINEARPOSITIONCNTR_HIGH 0x0003ACC +#define ACP_P1_AUDIO2_TX_LINEARPOSITIONCNTR_LOW 0x0003AD0 +#define ACP_P1_AUDIO2_TX_INTR_WATERMARK_SIZE 0x0003AD4 + +/* Registers from ACP_SW1_SWCLK block */ +#define ACP_SW1_EN 0x0003C00 +#define ACP_SW1_EN_STATUS 0x0003C04 +#define ACP_SW1_FRAMESIZE 0x0003C08 +#define ACP_SW1_SSP_COUNTER 0x0003C0C +#define ACP_SW1_AUDIO0_TX_EN 0x0003C10 +#define ACP_SW1_AUDIO0_TX_EN_STATUS 0x0003C14 +#define ACP_SW1_AUDIO0_TX_FRAME_FORMAT 0x0003C18 +#define ACP_SW1_AUDIO0_TX_SAMPLEINTERVAL 0x0003C1C +#define ACP_SW1_AUDIO0_TX_HCTRL_DP0 0x0003C20 +#define ACP_SW1_AUDIO0_TX_HCTRL_DP1 0x0003C24 +#define ACP_SW1_AUDIO0_TX_OFFSET_DP0 0x0003C30 +#define ACP_SW1_AUDIO0_TX_OFFSET_DP1 0x0003C34 +#define ACP_SW1_AUDIO0_TX_CHANNEL_ENABLE_DP0 0x0003C40 +#define ACP_SW1_AUDIO0_TX_CHANNEL_ENABLE_DP1 0x0003C44 +#define ACP_SW1_AUDIO1_TX_EN 0x0003C50 +#define ACP_SW1_AUDIO1_TX_EN_STATUS 0x0003C54 +#define ACP_SW1_AUDIO1_TX_FRAME_FORMAT 0x0003C58 +#define ACP_SW1_AUDIO1_TX_SAMPLEINTERVAL 0x0003C5C +#define ACP_SW1_AUDIO1_TX_HCTRL 0x0003C60 +#define ACP_SW1_AUDIO1_TX_OFFSET 0x0003C64 +#define ACP_SW1_AUDIO1_TX_CHANNEL_ENABLE_DP0 0x0003C68 +#define ACP_SW1_AUDIO2_TX_EN 0x0003C6C +#define ACP_SW1_AUDIO2_TX_EN_STATUS 0x0003C70 +#define ACP_SW1_AUDIO2_TX_FRAME_FORMAT 0x0003C74 +#define ACP_SW1_AUDIO2_TX_SAMPLEINTERVAL 0x0003C78 +#define ACP_SW1_AUDIO2_TX_HCTRL 0x0003C7C +#define ACP_SW1_AUDIO2_TX_OFFSET 0x0003C80 +#define ACP_SW1_AUDIO2_TX_CHANNEL_ENABLE_DP0 0x0003C84 +#define ACP_SW1_AUDIO0_RX_EN 0x0003C88 +#define ACP_SW1_AUDIO0_RX_EN_STATUS 0x0003C8C +#define ACP_SW1_AUDIO0_RX_FRAME_FORMAT 0x0003C90 +#define ACP_SW1_AUDIO0_RX_SAMPLEINTERVAL 0x0003C94 +#define ACP_SW1_AUDIO0_RX_HCTRL_DP0 0x0003C98 +#define ACP_SW1_AUDIO0_RX_HCTRL_DP1 0x0003C9C +#define ACP_SW1_AUDIO0_RX_OFFSET_DP0 0x0003D08 +#define ACP_SW1_AUDIO0_RX_OFFSET_DP1 0x0003D0C +#define ACP_SW1_AUDIO0_RX_CHANNEL_ENABLE_DP0 0x0003D18 +#define ACP_SW1_AUDIO0_RX_CHANNEL_ENABLE_DP1 0x0003D1C +#define ACP_SW1_AUDIO1_RX_EN 0x0003D28 +#define ACP_SW1_AUDIO1_RX_EN_STATUS 0x0003D2C +#define ACP_SW1_AUDIO1_RX_FRAME_FORMAT 0x0003D30 +#define ACP_SW1_AUDIO1_RX_SAMPLEINTERVAL 0x0003D34 +#define ACP_SW1_AUDIO1_RX_HCTRL 0x0003D38 +#define ACP_SW1_AUDIO1_RX_OFFSET 0x0003D3C +#define ACP_SW1_AUDIO1_RX_CHANNEL_ENABLE_DP0 0x0003D40 +#define ACP_SW1_AUDIO2_RX_EN 0x0003D44 +#define ACP_SW1_AUDIO2_RX_EN_STATUS 0x0003D48 +#define ACP_SW1_AUDIO2_RX_FRAME_FORMAT 0x0003D4C +#define ACP_SW1_AUDIO2_RX_SAMPLEINTERVAL 0x0003D50 +#define ACP_SW1_AUDIO2_RX_HCTRL 0x0003D54 +#define ACP_SW1_AUDIO2_RX_OFFSET 0x0003D58 +#define ACP_SW1_AUDIO2_RX_CHANNEL_ENABLE_DP0 0x0003D5C +#define ACP_SW1_BPT_PORT_EN 0x0003D60 +#define ACP_SW1_BPT_PORT_EN_STATUS 0x0003D64 +#define ACP_SW1_BPT_PORT_FRAME_FORMAT 0x0003D68 +#define ACP_SW1_BPT_PORT_SAMPLEINTERVAL 0x0003D6C +#define ACP_SW1_BPT_PORT_HCTRL 0x0003D70 +#define ACP_SW1_BPT_PORT_OFFSET 0x0003D74 +#define ACP_SW1_BPT_PORT_CHANNEL_ENABLE 0x0003D78 +#define ACP_SW1_BPT_PORT_FIRST_BYTE_ADDR 0x0003D7C +#define ACP_SW1_CLK_RESUME_CTRL 0x0003D80 +#define ACP_SW1_CLK_RESUME_DELAY_CNTR 0x0003D84 +#define ACP_SW1_BUS_RESET_CTRL 0x0003D88 +#define ACP_SW1_PRBS_ERR_STATUS 0x0003D8C + +/* Registers from ACP_SW1_ACLK block */ +#define ACP_SW1_CORB_BASE_ADDRESS 0x0003E00 +#define ACP_SW1_CORB_WRITE_POINTER 0x0003E04 +#define ACP_SW1_CORB_READ_POINTER 0x0003E08 +#define ACP_SW1_CORB_CONTROL 0x0003E0C +#define ACP_SW1_CORB_SIZE 0x0003E14 +#define ACP_SW1_RIRB_BASE_ADDRESS 0x0003E18 +#define ACP_SW1_RIRB_WRITE_POINTER 0x0003E1C +#define ACP_SW1_RIRB_RESPONSE_INTERRUPT_COUNT 0x0003E20 +#define ACP_SW1_RIRB_CONTROL 0x0003E24 +#define ACP_SW1_RIRB_SIZE 0x0003E28 +#define ACP_SW1_RIRB_FIFO_MIN_THDL 0x0003E2C +#define ACP_SW1_IMM_CMD_UPPER_WORD 0x0003E30 +#define ACP_SW1_IMM_CMD_LOWER_QWORD 0x0003E34 +#define ACP_SW1_IMM_RESP_UPPER_WORD 0x0003E38 +#define ACP_SW1_IMM_RESP_LOWER_QWORD 0x0003E3C +#define ACP_SW1_IMM_CMD_STS 0x0003E40 +#define ACP_SW1_BRA_BASE_ADDRESS 0x0003E44 +#define ACP_SW1_BRA_TRANSFER_SIZE 0x0003E48 +#define ACP_SW1_BRA_DMA_BUSY 0x0003E4C +#define ACP_SW1_BRA_RESP 0x0003E50 +#define ACP_SW1_BRA_RESP_FRAME_ADDR 0x0003E54 +#define ACP_SW1_BRA_CURRENT_TRANSFER_SIZE 0x0003E58 +#define ACP_SW1_STATECHANGE_STATUS_0TO7 0x0003E5C +#define ACP_SW1_STATECHANGE_STATUS_8TO11 0x0003E60 +#define ACP_SW1_STATECHANGE_STATUS_MASK_0TO7 0x0003E64 +#define ACP_SW1_STATECHANGE_STATUS_MASK_8TO11 0x0003E68 +#define ACP_SW1_CLK_FREQUENCY_CTRL 0x0003E6C +#define ACP_SW1_ERROR_INTR_MASK 0x0003E70 +#define ACP_SW1_PHY_TEST_MODE_DATA_OFF 0x0003E74 + +/* Registers from ACP_SCRATCH block */ +#define ACP_SCRATCH_REG_0 0x0010000 + +#endif From patchwork Thu Dec 19 05:48:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914485 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2056.outbound.protection.outlook.com [40.107.96.56]) (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 ADBEC1F8906; Thu, 19 Dec 2024 05:50:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587420; cv=fail; b=pOQ8qBinawZ4YTRi9W6bf3i9fYlUSDvzLB/7fEdUz53dmT+91ry+nvAXLkIN8tBCPBWf9v56dAqcz34HElZvhS4ylIErj1Cbbb2pGJsrnTCtSdb+LMmS4nGWFdypiDF1/QkVMbvCmTh2ls3sMhJocgvYf/BUOoxnc1J5V9qL+O0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587420; c=relaxed/simple; bh=Q5aNoNoauKXY4uHDq9Qe4dllz1SyJPFBHOrMplBc084=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L58UdLmmqYfIJ7I6b3SctiLduW+20mcCl3Cx/soZkbbA4gjUTHazwUH8r2EmNz6At2VSrcazlbqdMLeHbGQ9mUXB8R6uDvUySpaXT72PtotnaxrsU+HakRkt9N05cMjrZqsJxFa3JAsbO/XJFP3mTUWGYQRMdxFBLm8QNmOgoFU= 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=zGAY3eD2; arc=fail smtp.client-ip=40.107.96.56 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="zGAY3eD2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tLaMQi3XxWpeDyoxUqkWrd7BPgNV+Uaux9BmeDwfV8AnzJvPGGfYXroKW0lqK2esmxcCYrP/DGcPvKryf+2Vikaw9s8EK5eZFPBd9AJ++ruTt7n1BADJ58Hb1DXgJAmdmVToHgcc4Hx5MSKVI0GdP4r9RfU3w1EEBV0f7ujrADLvNfz/2+jsN3Jm8tOhRi5GaH9HgwomDPUVAHEDsVariBd5R6Fj2hqjBgQ9HTk/vmDQaRN8vpAPHp5xfkJdQ5JpI5OUWZPbBD+cSWqRRfQvXfkYUnBcDLG9fe+yM47J8yFFMsMu5JZfv8ThPnPO/PMboD1gLtVps6WMOXtypwLeFw== 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=L2d4RrV6LRK8gp/01u9Ug0u3GqsFw/mlkJXCD6vAyb0=; b=P/kR28q4N2PGX0kdngFnvzipPOwRqjxoAn3gRBU14j+ZoiCXEvXNhu4aZIHkCx9sTgqIBY8VmnPSxV6oNtVzHjO6559qV1WstqdBhhoXQ4uzwwjs1Xn8vNdYn8k/b8086kuI61D6gqC4DdaVAVsIe4gbURXulbwCNRKtF/NIMMfryc+hDUcBkvsFBAa0zdWNItMZeXsGIMo0lNXx+DEpkHthE26NtNFJopFs+E8F206Ygw1k9tlDfgUigdCJRpgMZBekNuZRMFnUSgObh96H2eyRbCs6wZ2M9uH6ouQmnMN2Wp88umhqi0ub6mSzYCTGISGIQqVIeqYDIXJ5DTa2hQ== 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=L2d4RrV6LRK8gp/01u9Ug0u3GqsFw/mlkJXCD6vAyb0=; b=zGAY3eD2zGFEdN49EUHjBEzvDOGQ1RBeky/Fg89wmak10Q99+987h946lvqQ6hejlhH/0qlAsK444q7APdlT0OG1t9FxY+pAxpvUShQP9PQl/TKnP3dh1IJN1NkPwVUdUoDpPdScX/y36jazoT9BaIE7yQoYj9nMOhWmL9OMpEg= Received: from CH0PR03CA0299.namprd03.prod.outlook.com (2603:10b6:610:e6::34) by CH2PR12MB9494.namprd12.prod.outlook.com (2603:10b6:610:27f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:50:12 +0000 Received: from CH2PEPF0000013D.namprd02.prod.outlook.com (2603:10b6:610:e6:cafe::10) by CH0PR03CA0299.outlook.office365.com (2603:10b6:610:e6::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:50:12 +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 CH2PEPF0000013D.mail.protection.outlook.com (10.167.244.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:50:12 +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, 18 Dec 2024 23:49:21 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 02/21] ASoC: amd: acp70: add acp pci driver for ACP7.0 and ACP7.1 platforms Date: Thu, 19 Dec 2024 11:18:38 +0530 Message-ID: <20241219054857.2070420-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH2PEPF0000013D:EE_|CH2PR12MB9494:EE_ X-MS-Office365-Filtering-Correlation-Id: af7ff5f8-fb3d-4dc8-1995-08dd1ff10138 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: Z9MRR9kP4aQyVJs+T73jKsMPLPe7xmIRd8MNWJL7McueFd4ewevw1qlJu9t0Hr6Gh0LEVRTpHpRPDVFWH0+kPBB7I7VsBBJbilR1Op+vGUkjLdbxR1u9lEj3nRiaj+lTeyTCRvgXqgy/caZZ/t+FOg02pRhsd657l19uaUbMAaJ+VnwKT3b6QvZ6/T4A9AtONomEFXhKZgtP57pu2m+BTKE60hBWo1Dqo0GaQXWBgTovYwxcww4P6+GUM5KvF+JS/J3vhe7me1Az7ICUN/U1kxEqD+z+HEMF0mWZWpgKV0Y4wlD1TZA98Ip8JaXQOOXqI/viHLAwye5QKP+zinPlYoo3H5UOusnRdcuKy/LRaAr1UKVUXiAP/cXwyPGOKbewwXQ8AdveHzjzuio3/kliSuB44bS2GYhEmEvZaMW6iaywdqL7rO6pqxxdjqPkMQyxImr+e2cic8OGMiTDVsDZW71hmxoCzUmAuacS8JVKHpQrz6HBNjIGsnWVHq7dhAw8kETp4KMloagUVaNbOSrdgUkjv+J9EYXPVDW01lUdSCt/+CYlWNDxfCInR81+Xkm6VUGgpIFb1dOZAXqJBeevrdOBskpCIdN/0qp2ZrPsqhbfMn2yuW4tNCmsBM6TDRdi99ejwV8UGUaILz62zD1zLdggXsqi8DfmFb85sPg2yRz0xEpHmWHnFEIPOjQn/q2D356+H+GYOE4FZc4NGp+RipLH67sOcbpMMhPgPHxAEBEtff46N2TDfpL9l5fOC3+wwQewuPbtFL6l1Sl4062o8qhe5ijqHvcM5SEbYRhDJGKObnik2I1poO33ZBBYJgT3vIm7+CfOT2bP+02NR6uSmQBXJ3xqsFi8D/9uOuFL1N71QQyRlrzfRjnwh2U5ZKWZXTImAwd6qGs/j98JiD+5Jh3So2wPOYh51iyJ+fDocDAt0rVhRJ0Q/U1OR8OrRm9Ucck9SI6Ch31RypLabakD4MpAhaVvpru89uhcLvCTzIHD5tJz6DqQG1bu0ejwuL5WsFYttBDEZjQpioWhaUgqj3Co5DkcO+haUkdc3TuX2Hi4QeczFP/dUBjlmhou8xeM7byiZcU9oOuLRuwadYyZWr+WNpGgX9BjqMVRYj4GWhnV46ot/SeEP7+YCt7EleDKnzKhyTiidu0EEzHTOwpw8bbPeZ2EK6AUaVVfZvp747tcrRfj4aZIfRuXLf2d8Fi67mXSdf842l4WuWpXEORa3qclvPY7umrouDNHnDsirUXvW7kSDpzn7q2BjVcHFse5Mn0MLdC3bdM0/6/TtUppnHZehtM7/srG+A9YFKGKE3GU1hzDD5XnIw9g9z1Atl61i70jTEvfS+vO3371ibsmzXqy8Jud1HtNippeySP3A8uW9RXQ1g5kVcJAJc9LmpU//+J0P5/PRNoAmhCidjJlJqPIYyeXGaGauq2s5+9EO64JWQEeOJ3MZ++pSVCMiIhji0MXcmmYL8OtEXUhb2RgNCpo52po8RkEYtbq5xQ6FQk= 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)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:50:12.3887 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af7ff5f8-fb3d-4dc8-1995-08dd1ff10138 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: CH2PEPF0000013D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB9494 ACP is a PCI audio device. This patch adds common PCI driver to bind to this device and get PCI resources for ACP7.0 & ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 33 +++++++++++ sound/soc/amd/acp70/pci-acp70.c | 100 ++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 sound/soc/amd/acp70/acp70.h create mode 100644 sound/soc/amd/acp70/pci-acp70.c diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h new file mode 100644 index 000000000000..28a46f0c2026 --- /dev/null +++ b/sound/soc/amd/acp70/acp70.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * ACP 7.0 platform Common header file + * + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + */ + +#include + +#define ACP_DEVICE_ID 0x15E2 +#define ACP70_REG_START 0x1240000 +#define ACP70_REG_END 0x125C000 +#define ACP70_PCI_REV 0x70 +#define ACP71_PCI_REV 0x71 + +/** + * struct acp70_dev_data - acp pci driver context + * @acp70_base: acp mmio base + * @acp_lock: used to protect acp common registers + * @addr: pci ioremap address + * @reg_range: ACP reigister range + * @acp_rev : ACP PCI revision id + */ + +struct acp70_dev_data { + void __iomem *acp70_base; + struct mutex acp_lock; /* protect shared registers */ + u32 addr; + u32 reg_range; + u32 acp_rev; +}; + +int snd_amd_acp_find_config(struct pci_dev *pci); diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c new file mode 100644 index 000000000000..23e47f619bd7 --- /dev/null +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * AMD common ACP PCI driver for ACP7.0 & ACP7.1 platforms + * + * Copyright 2024 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include "../mach-config.h" + +#include "acp70.h" + +static int snd_acp70_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + struct acp70_dev_data *adata; + u32 addr, flag; + int ret; + + /* Return if acp config flag is defined */ + flag = snd_amd_acp_find_config(pci); + if (flag) + return -ENODEV; + + /* Pink Sardine device check */ + switch (pci->revision) { + case ACP70_PCI_REV: + case ACP71_PCI_REV: + break; + default: + dev_dbg(&pci->dev, "acp70 pci device not found\n"); + return -ENODEV; + } + if (pci_enable_device(pci)) { + dev_err(&pci->dev, "pci_enable_device failed\n"); + return -ENODEV; + } + + ret = pci_request_regions(pci, "AMD ACP6.2 audio"); + if (ret < 0) { + dev_err(&pci->dev, "pci_request_regions failed\n"); + goto disable_pci; + } + adata = devm_kzalloc(&pci->dev, sizeof(struct acp70_dev_data), + GFP_KERNEL); + if (!adata) { + ret = -ENOMEM; + goto release_regions; + } + + addr = pci_resource_start(pci, 0); + adata->acp70_base = devm_ioremap(&pci->dev, addr, + pci_resource_len(pci, 0)); + if (!adata->acp70_base) { + ret = -ENOMEM; + goto release_regions; + } + adata->addr = addr; + adata->reg_range = ACP70_REG_END - ACP70_REG_START; + adata->acp_rev = pci->revision; + pci_set_master(pci); + pci_set_drvdata(pci, adata); + mutex_init(&adata->acp_lock); + return 0; +release_regions: + pci_release_regions(pci); +disable_pci: + pci_disable_device(pci); + + return ret; +} + +static void snd_acp70_remove(struct pci_dev *pci) +{ + pci_release_regions(pci); + pci_disable_device(pci); +} + +static const struct pci_device_id snd_acp70_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_AMD, ACP_DEVICE_ID), + .class = PCI_CLASS_MULTIMEDIA_OTHER << 8, + .class_mask = 0xffffff }, + { 0, }, +}; +MODULE_DEVICE_TABLE(pci, snd_acp70_ids); + +static struct pci_driver ps_acp70_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_acp70_ids, + .probe = snd_acp70_probe, + .remove = snd_acp70_remove, +}; + +module_pci_driver(ps_acp70_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP7.0 PCI driver"); +MODULE_LICENSE("GPL"); From patchwork Thu Dec 19 05:48:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914486 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2057.outbound.protection.outlook.com [40.107.102.57]) (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 D255613C3F2; Thu, 19 Dec 2024 05:50:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587420; cv=fail; b=BzKQFBTegvcvnaMZlrObOw6RW8K9eBEbgNCdcr77ekzC6fIQYvua4QPDN8bBYm0FiVwf1q/lcfO7rcdizD5YAqWfvoM3k7ZZ1nWizbA02rA3UUe8G5C+rjsh9Z5CivnEcIehHLMXijcCvIOwC56uG9Jjh/5cHdHh+p8JEtU60gs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587420; c=relaxed/simple; bh=i/uNFLO7iK3jZnoU0aExPguER4FipoeYRt3NLWxrFgs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gsp4A8H2vQBBJvh9SJf7e1PdHFsCj1YNMQK6jAhwkH25QrwjumGEI2jXEuIqgIXdUFRMXQ200U8VS9imCcpPrS8PjH82K4iMGXRQSu5jpBNRnEBynkNB9huMgJHReeLH5qLQxjRRFj+qu9HJ5/J2DGiD1wHvabY6xt6InNud4Qg= 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=BtO7OFtC; arc=fail smtp.client-ip=40.107.102.57 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="BtO7OFtC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gUaIX8mg72MOVwukflUOfcDMrscUYnk4+p/Knh9EfzXfZKkKtgD3Y+xQY3iAXw/cg37FCu8XebJqzpqcLB3w9JdtLEfOsyRj5MJaec4ocZZoyIRRBZ7fhhcewKACar6CllqIlfjV5zd1pi3HUubu8u/TMGgZkOOhAZTGKfUwfdVxWwQO4jyQKQxDZDvvLC8LvGfYecLoipyZNO7bpPIoDZFc7UMq86ZtHKlxz1rfWDxmfbr3Gk/o9hSBM7YdI3iT2IyhFfHcSymbaxVfu52nnplbijy26FGdPsceEvivCKyiRrD6iqp0rCXaas6ZZwQx/CdvzOzPJuAyrxgQYxKt3A== 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=yeLJ/EHMSN0S8/q2uF9mVb9XD4QOfDbOpmLKTwPMP+c=; b=eAjbK/mvsp71p+UnoJJr7pEaNUyWZ4i6QBHlyLx9XWwAmX1AZP9nd1mMPoAOwwV+kjby32CZX3tZFtQb5BL1i+WDPw7TBUS5q60Y9K9tDo21uqmP7X0JBDD5lDY1sukj8PaaUAEEuT4TFDoBGtMcohdWo+S85kQduNOeo1JNVgLXy14709H5YDdo4zRWYITmWwy/Y4KSA3n1heSBJJT5k5dwBrMBj1NRMYJnTRXkqBeIej8GOqeguzF0k+e+L+BJBLOt0E4aGfPx7Yq8tLxo4bJgdeh3PRCr7aqoxYcEvm3QJ1r3GlO+hfQeCEAapfdPkJwBTkxtkzHEHE4RaUzstw== 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=yeLJ/EHMSN0S8/q2uF9mVb9XD4QOfDbOpmLKTwPMP+c=; b=BtO7OFtCY7snbTOdELd+W3oXB62ChTevPLsuvHRrHUzkNPLqXy7lzGw6Q3DIVAtrT+6sBHEXx5cAV3irXAjK3mLUZ8HPJhHYvjDH3u4fQk6DYtKoH/btjUMiHRfh62iaIc36jVl3yXEqeUsr3GKxtz8g0DcdFz59WtZbTCQO9KY= Received: from SJ0PR13CA0037.namprd13.prod.outlook.com (2603:10b6:a03:2c2::12) by SA0PR12MB7461.namprd12.prod.outlook.com (2603:10b6:806:24b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.16; Thu, 19 Dec 2024 05:50:14 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:a03:2c2:cafe::5a) by SJ0PR13CA0037.outlook.office365.com (2603:10b6:a03:2c2::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8272.8 via Frontend Transport; Thu, 19 Dec 2024 05:50:14 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:50:13 +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, 18 Dec 2024 23:50:10 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 03/21] ASoC: amd: acp70: add acp init and de-init functions Date: Thu, 19 Dec 2024 11:18:39 +0530 Message-ID: <20241219054857.2070420-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CO1PEPF000042A9:EE_|SA0PR12MB7461:EE_ X-MS-Office365-Filtering-Correlation-Id: 34e6830a-6a23-4323-c47b-08dd1ff1022b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: /8E5pfk6x8cev8frBRcOAZ4pmJsLwgKrKkurBLOMifhw+JMFo1aN/dLKTxKuVUsMBBcpGMPB+yHqiA4Uw5JAXj2GZDbiv1YwJeN+tkoWw27M+3VqusUCs2F+ZKrO0HkGtN3oVUrgefhu8w/+GksKnDnaXvM0yeoqqPJv/n0hgEz2kLo2KvDu5k3LDN4v8DMlmYeQrnA1BImYZJcF/48TeG8hmDR4JJuFY6m4v1YLCHSAb/EK0+02YElKq4Mk12+pn9K+C6vWXo6m8SzSUqgri1T5gqMI1DfR/n8gstuOtSB4ilk7KNBp/G66PeUGp09d1DckfiH8zoxn0wvpyvC0YFllIUUd/GzrJNLQg5UnlmXOdqKXOzX0MRfT5q6SLGcdy2IEHTnz4+YdBfbgS/5zwZlsXeQnuWQSrcJFbp4qV4ZG1cxxxJ6lk5SSAM3mxtsY1mNL/xWiEls32TxH14GgKyFeYWC5iE2cFj2AbFQv9SahDiGeEBHKbGw16bzp5wmujIfcvJYEO8rY0AASawvMIiUAkOOViN8aDNyTbxItDjFoQXHBsRnCmTWGWsE1hmDYKr/cww+Cn2/iOd+28nXeeHqDVUxBBmcNmZzqd9q0mGESiaorN7XxtXzEaXRAhNkC7IeuyKWf53RfkBLZbhqYBn+j1mTsA7HYEps7jfWtOhG4x8eBFJBX1zm7s3aKYqGGFBd15JnItOx0hwFk1Uu4lSoYujg267+Dif1EPBcZu/pPfC7zdglOWkuAbjuHBsru6tFuQSbWuXdnP/nBxsMYdQHSmMKk66n0zFmkXAuQti7mveAww1REcRg3MZpTIEyXQITWpVaUMLy0ikLN+z6APHoq0PVVb1i3LIr/jbMgKlHsCEoH6jdG/QojTTle58AXFeFbfCO/Sr8DBLmvJsbtshpk9yIv8HYPUU6TQM/XH0Ru4O+yukwYjo6He/Cf4L80Ws9hfArs1KAT22ERdez0I0OjkTKNNntmp9bQnhIanp/KDAmf8FGMDs5S4WvyZ9rOkQ9T9h8Ki2OZELIXMtm4o4KhZe2NvHCz7t4NbRIokp/5kceYh9RJ93KKeiauVHyyBNJ7pvcTxrXR6kB/DiK3BLsxm8VnbRYf8mmtuVgiLVfYydprnJeT2BsJozZ9Uisv51TFDDmLOm7UnC8O1uRV5DXJ2Ik6WmZXj6/ETEvvFuNThek7Wm2hyVSlBP0tiuwE1tRi9oZS363/QE6bcZABn7YinOGRtzkcjdpUWGD0nN7tG+tiDGpNN9pVr1ddi4MHmDKXMVxYbhiTh3e6KlDiqYSS2ko6F7eyvA5zQplH8vK7gEPzMI8lBVY57nOlEiMPEw8IvVKvu4nnvIKm+G7jSj8w9cUwP3hpbD9qqyF3lUiY2WfK47s62jUEMMcRQMFvVqeEdilS2UV1sp/e8t3Xfj0iQJQDtMNlgFcu5ZyMyh6/JyLXnVQ4686JMChG8Y/S7BRnCHA0f/LXYVKU9kKlxMd+B9SEgf3Ow4+S1L5l9k4= 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)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:50:13.9386 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34e6830a-6a23-4323-c47b-08dd1ff1022b 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7461 Add acp init and deinit functions for ACP7.0 platform. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 15 ++++++ sound/soc/amd/acp70/pci-acp70.c | 92 +++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index 28a46f0c2026..b6f0f75de91d 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -12,6 +12,21 @@ #define ACP70_REG_END 0x125C000 #define ACP70_PCI_REV 0x70 #define ACP71_PCI_REV 0x71 +#define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001 +#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x1F +#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0 +#define ACP_PGFSM_STATUS_MASK 0xFF +#define ACP_POWERED_ON 0 +#define ACP_POWER_ON_IN_PROGRESS 1 +#define ACP_POWERED_OFF 2 +#define ACP_POWER_OFF_IN_PROGRESS 3 +#define DELAY_US 5 +#define ACP_COUNTER 20000 +/* time in ms for acp timeout */ +#define ACP_TIMEOUT 2000 + +#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF +#define ACP_ERROR_IRQ BIT(29) /** * struct acp70_dev_data - acp pci driver context diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index 23e47f619bd7..a98407fa2cd2 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -5,13 +5,94 @@ * Copyright 2024 Advanced Micro Devices, Inc. */ +#include #include +#include #include #include #include "../mach-config.h" #include "acp70.h" +static int acp70_power_on(void __iomem *acp_base) +{ + u32 val = 0; + + val = readl(acp_base + ACP_PGFSM_STATUS); + + if (!val) + return 0; + if (val & ACP_PGFSM_STATUS_MASK) + writel(ACP_PGFSM_CNTL_POWER_ON_MASK, acp_base + ACP_PGFSM_CONTROL); + + return readl_poll_timeout(acp_base + ACP_PGFSM_STATUS, val, !val, DELAY_US, ACP_TIMEOUT); +} + +static int acp70_reset(void __iomem *acp_base) +{ + u32 val; + int ret; + + writel(1, acp_base + ACP_SOFT_RESET); + + ret = readl_poll_timeout(acp_base + ACP_SOFT_RESET, val, + val & ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK, + DELAY_US, ACP_TIMEOUT); + if (ret) + return ret; + + writel(0, acp_base + ACP_SOFT_RESET); + + return readl_poll_timeout(acp_base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); +} + +static void acp70_enable_interrupts(void __iomem *acp_base) +{ + writel(1, acp_base + ACP_EXTERNAL_INTR_ENB); + writel(ACP_ERROR_IRQ, acp_base + ACP_EXTERNAL_INTR_CNTL); +} + +static void acp70_disable_interrupts(void __iomem *acp_base) +{ + writel(ACP_EXT_INTR_STAT_CLEAR_MASK, acp_base + ACP_EXTERNAL_INTR_STAT); + writel(0, acp_base + ACP_EXTERNAL_INTR_CNTL); + writel(0, acp_base + ACP_EXTERNAL_INTR_ENB); +} + +static int acp70_init(void __iomem *acp_base, struct device *dev) +{ + int ret; + + ret = acp70_power_on(acp_base); + if (ret) { + dev_err(dev, "ACP power on failed\n"); + return ret; + } + writel(0x01, acp_base + ACP_CONTROL); + ret = acp70_reset(acp_base); + if (ret) { + dev_err(dev, "ACP reset failed\n"); + return ret; + } + writel(0, acp_base + ACP_ZSC_DSP_CTRL); + acp70_enable_interrupts(acp_base); + return 0; +} + +static int acp70_deinit(void __iomem *acp_base, struct device *dev) +{ + int ret; + + acp70_disable_interrupts(acp_base); + ret = acp70_reset(acp_base); + if (ret) { + dev_err(dev, "ACP reset failed\n"); + return ret; + } + writel(0x01, acp_base + ACP_ZSC_DSP_CTRL); + return 0; +} + static int snd_acp70_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -63,6 +144,10 @@ static int snd_acp70_probe(struct pci_dev *pci, pci_set_master(pci); pci_set_drvdata(pci, adata); mutex_init(&adata->acp_lock); + ret = acp70_init(adata->acp70_base, &pci->dev); + if (ret) + goto release_regions; + return 0; release_regions: pci_release_regions(pci); @@ -74,6 +159,13 @@ static int snd_acp70_probe(struct pci_dev *pci, static void snd_acp70_remove(struct pci_dev *pci) { + struct acp70_dev_data *adata; + int ret; + + adata = pci_get_drvdata(pci); + ret = acp70_deinit(adata->acp70_base, &pci->dev); + if (ret) + dev_err(&pci->dev, "ACP de-init failed\n"); pci_release_regions(pci); pci_disable_device(pci); } From patchwork Thu Dec 19 05:48:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914487 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) (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 2D9A91FC7EC; Thu, 19 Dec 2024 05:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587422; cv=fail; b=g8xGTi/1uEezJO+rtWH25uSCXijNphOlCV+DtGP3KGhg5LpmnNGef/QtwcQRoWUUeCo1kTE/3gM35gfOdQquHue+29McGl6BP7CNt4Dp/Hdu1vypIuVtpO+wTc1qOikNLwq5lnuRZstvtSYBLxFNogXV2Jy68DoIP4N8EywbFnw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587422; c=relaxed/simple; bh=9WGb8A5ee4kLfkR9ePLod0YqPWGev1RzQaJsqsrr8D8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mJHXtPHil0bWcqQwN4hHZo7VaK3wKKjnE3Zk055CPwzQXYNpwhjkHg02dSqq5aTgfw0gdtl6kkCkLzM0rcHDanu5mz1N/PfeuqZ/lhdUBcgNqxvdOB1wMkiDSSiWYP9Y1JlJyh2DAjx8qd/Hryl8fvV+VAtn0nb+RKHtNcxpsEA= 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=PJtUobPb; arc=fail smtp.client-ip=40.107.93.72 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="PJtUobPb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zJuJ40017xHAO6Z6hNLZfT8DZ4FUM/PHcl8NaDSjmjEA1f8h5VA31U0rNkl4eZx0C87nUR7tDAUW/XDjTctLs2dpSXrqRtQzCT3njRtSga/aczMpO5eEBe/37iflqH4siqKPlSP6dLQiB2ic5TS7NFTM038kToJbfFTwvVM4YYNtXAIWm4zsqaEPnDvlz+NCBt5uf0lnNBlR4sOVnR+GrLzG3fWhOSawRPsqe41Ft1PAN+hN+umX0BoDkcGpVMsa2JYCEFrql443C/KJ6//8rp9BcQcmktrPv4TmbWgkBExWcqkbjQxr8C585nfVDic1zmuaFYo+2oPUro3Lcelq3w== 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=is0ljY+jrvV377UZxYtaTa7kQh3b1ki/xBEhg8a6QkE=; b=TWFXzU8K/xenK+NJUeO/fsMr4s586+N2UMtNY2uyeGcc61FFQl06OTpHGKxcxzCbGXGpXI6Uh7tZ0nz3LACMHt+HZQvrc+8R1oIKIGhcEKNI/zQfTvWSdGXIJuXfocxzM516HKBZmeKAJRwcEkjjTp27gDJd/bp79c3Atis2pCK+vsixGaVgxwYWcUZ8ChBfQe75Pz5aiNyveHRzOaN2ojv1JMWrkTRwloWoLYjKsjzFEbAjlnZC6AZBWOEExtNUSwiXwcXODA2pl7Gk5r+jOjPqvffSawrsNcNqkp4YU/wJto1Ejzp/VZi3PnsVfCndfslqHuVSXc0/Ck3SisQzqw== 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=is0ljY+jrvV377UZxYtaTa7kQh3b1ki/xBEhg8a6QkE=; b=PJtUobPbJTI8pkZn361SvoKM4wVYdM0r42uryZK80UAbp1m7v43opEv8iw7BzoCLa50P4f2PuM6+AKViG/cfVHdxfKVxFQlQDgyPe+5CXEHsq5sGPLwxSMKP8+vB+9ehpeQDOKduB6NbAwobuljqvOXqqsBY0caSEC3eInXPHpQ= Received: from CH0PR03CA0295.namprd03.prod.outlook.com (2603:10b6:610:e6::30) by SA1PR12MB9247.namprd12.prod.outlook.com (2603:10b6:806:3af::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Thu, 19 Dec 2024 05:50:17 +0000 Received: from CH2PEPF0000013D.namprd02.prod.outlook.com (2603:10b6:610:e6:cafe::c6) by CH0PR03CA0295.outlook.office365.com (2603:10b6:610:e6::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:50:17 +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 CH2PEPF0000013D.mail.protection.outlook.com (10.167.244.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:50:17 +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, 18 Dec 2024 23:50:13 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 04/21] ASoC: amd: acp70: add logic for scanning acp child devices Date: Thu, 19 Dec 2024 11:18:40 +0530 Message-ID: <20241219054857.2070420-5-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH2PEPF0000013D:EE_|SA1PR12MB9247:EE_ X-MS-Office365-Filtering-Correlation-Id: 489c3a68-7153-4385-f55c-08dd1ff1043e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: 67LJs9zP7ov2iXM5E8yPGENQll6UJkDQexfagx3ucZaOB3plPkhkz8FH5+/03aTJA9QS0xPLtZP6Ik5hT5DkATH62+K4HHJRqDblN9FRFBcwtr34RjpnSS17kiNhbosBi4/TZqgUi5a1+VwKMzaPv747dEll1bDbGnh0HdODZjqXJAjsyD7ejFen3SFU64Q6O+EB9lVg5HCDiDguT4tcPnslNTOPNiTlYbE2IlimSB+KTC3uyC43qBeY5/fln7sx4gqHqBnvbM3CQaeUuBC8WKTUBrJZYnoC1GTyIZ5/GquQcEfcApTLrliyW9IKokw6XDoAnJRrinEacJo9VtVap0x9paSYOw2JAW2CxlJcWQiY6DmrLrZ0WKb632TFVeGsrjJjalak3sjRTxOOuQYd1FkiZ2Mw6RmRVYUYk+y+EiFxFKUmQPt1AaZQSj4ZataJYWWGnm6izM4O37rqhV0CD0OCOkP3r9bFpssAEJs7Tqo8D9faDORLbLesnntweSOlxDa5LqQY3/Ff3eNqVIQU6zVZFpOmBR0u5LXWOyc761pWKax2vP7Ar31qSPWARSfSwbU9GOd0t3OWoNtOZwJWkYhjDN94Nflc8H2fA/3BcTQD9FECzstTXGYIhuP5hTRYd19F/vfb8II0MuhcGgxPFRsGD8fkRTqf2e1FYadasqRxjlshkmXLjDqVvJ12ZZdCkJoCwkqmtshxxSANUIUPHjowBl4MMOFj2i6gccbEYV3uI8MzFIrvI9BTS0T0XTRN/1uw+igOyOAPx9n2bLZ3trs0ETzaJThVsNELeijMTyYiF4qw3dEfGSOm3/0LAgzXnDI28XqCq7xxOp8R5AXk50cPjfPeMK6SwvufCdtsY7I6YuMV0JmVnjtNqLSfE3CTnaWlZDB1K0Z+rgSACV/BZUeSMNW4eVrJQICYKSnFpBnjonta/00sGX/3WnA/VMoizvtgyuR+fXZ7pBc6YFVqozwAEWvQLsshxC6dI3PumwyrL1/hL1Az5uKPmHA7EG8XaSpZ1NQl/7ZDzy5vOPLwbyCKtiVVdm7x2HOXRp2mQDZ2g03FsgLxeorwFXjGZwm/L6uuFY6dWgZuydSHx24O1UPJkGqEau3jxwTgUEvQ8572S6pgmA4dgUARaUfGq+euAgb0cC/zpe96wwnQ59NJWDBUVvb152pq2ude6ZV8wy1BnX6mc0ztYXWFx0o1wDUknAF/1InTMPSYpZfiWPtysDPIGp71lNtpaFPlnhClkYTCJhX4+bEt95bPiHitLXQRhUhsfLxWb0jtMrculPLWHWEbRb4va7/C1mkAhyJ3LcE2MjLTbenP3I6qw1KPUBl7j2k5cDhlaL6vza8Biu3yJRXyA7USdZStW+jkmBO8L2RoJgtsRyrTvAJwevJfFvQpWJROEvxpzyZDTQRv9l64NLZ9EBWcf10AsPx3vw5+6y+/zmwvd/teN8iz4+Oj4Eb0R/RgCLaIRDp+oWZ3/ugQXg== 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)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:50:17.4511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 489c3a68-7153-4385-f55c-08dd1ff1043e 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: CH2PEPF0000013D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB9247 Based on acp pin configuration, add logic for scanning child devices under acp pci device acpi scope. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 43 +++++++++++++ sound/soc/amd/acp70/pci-acp70.c | 103 ++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index b6f0f75de91d..1b20de75876a 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -5,6 +5,7 @@ * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. */ +#include #include #define ACP_DEVICE_ID 0x15E2 @@ -28,21 +29,63 @@ #define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF #define ACP_ERROR_IRQ BIT(29) +#define ACP_DMIC_DEV 2 +#define ACP70_DMIC_ADDR 2 +#define ACP70_SDW_ADDR 5 +#define AMD_SDW_MAX_MANAGERS 2 + +enum acp_config { + ACP_CONFIG_0 = 0, + ACP_CONFIG_1, + ACP_CONFIG_2, + ACP_CONFIG_3, + ACP_CONFIG_4, + ACP_CONFIG_5, + ACP_CONFIG_6, + ACP_CONFIG_7, + ACP_CONFIG_8, + ACP_CONFIG_9, + ACP_CONFIG_10, + ACP_CONFIG_11, + ACP_CONFIG_12, + ACP_CONFIG_13, + ACP_CONFIG_14, + ACP_CONFIG_15, + ACP_CONFIG_16, + ACP_CONFIG_17, + ACP_CONFIG_18, + ACP_CONFIG_19, + ACP_CONFIG_20, +}; + /** * struct acp70_dev_data - acp pci driver context * @acp70_base: acp mmio base * @acp_lock: used to protect acp common registers + * @info: SoundWire AMD information found in ACPI tables + * @sdw: SoundWire context for all SoundWire manager instances * @addr: pci ioremap address * @reg_range: ACP reigister range * @acp_rev : ACP PCI revision id + * @is_sdw_dev: flag set to true when any SoundWire manager instances are available + * @is_pdm_dev: flag set to true when ACP PDM controller exists + * @is_pdm_config: flat set to true when PDM configuration is selected from BIOS + * @is_sdw_config: flag set to true when SDW configuration is selected from BIOS */ struct acp70_dev_data { void __iomem *acp70_base; struct mutex acp_lock; /* protect shared registers */ + struct sdw_amd_acpi_info info; + /* sdw context allocated by SoundWire driver */ + struct sdw_amd_ctx *sdw; u32 addr; u32 reg_range; u32 acp_rev; + bool is_sdw_dev; + bool is_pdm_dev; + bool is_pdm_config; + bool is_sdw_config; }; int snd_amd_acp_find_config(struct pci_dev *pci); diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index a98407fa2cd2..d360dfc396ad 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -5,6 +5,8 @@ * Copyright 2024 Advanced Micro Devices, Inc. */ +#include +#include #include #include #include @@ -93,6 +95,99 @@ static int acp70_deinit(void __iomem *acp_base, struct device *dev) return 0; } +#if IS_ENABLED(CONFIG_SND_SOC_AMD_SOUNDWIRE) +static int acp_scan_sdw_devices(struct device *dev, u64 addr) +{ + struct acpi_device *sdw_dev; + struct acp70_dev_data *acp_data; + + acp_data = dev_get_drvdata(dev); + if (!addr) + return -ENODEV; + + sdw_dev = acpi_find_child_device(ACPI_COMPANION(dev), addr, 0); + if (!sdw_dev) { + pr_err("%s No SoundWire devices found\n", __func__); + return -ENODEV; + } + + acp_data->info.handle = sdw_dev->handle; + acp_data->info.count = AMD_SDW_MAX_MANAGERS; + return amd_sdw_scan_controller(&acp_data->info); +} +#else +static int acp_scan_sdw_devices(struct device *dev, u64 addr) +{ + return 0; +} +#endif + +static int get_acp70_device_config(struct pci_dev *pci, struct acp70_dev_data *acp_data) +{ + struct acpi_device *pdm_dev; + const union acpi_object *obj; + u32 config; + int ret; + bool is_dmic_dev = false; + bool is_sdw_dev = false; + + config = readl(acp_data->acp70_base + ACP_PIN_CONFIG); + dev_dbg(&pci->dev, "ACP_PIN_CONFIG:0x%x\n", config); + switch (config) { + case ACP_CONFIG_4: + case ACP_CONFIG_5: + case ACP_CONFIG_10: + case ACP_CONFIG_11: + case ACP_CONFIG_20: + acp_data->is_pdm_config = true; + break; + case ACP_CONFIG_2: + case ACP_CONFIG_3: + case ACP_CONFIG_16: + acp_data->is_sdw_config = true; + break; + case ACP_CONFIG_6: + case ACP_CONFIG_7: + case ACP_CONFIG_12: + case ACP_CONFIG_8: + case ACP_CONFIG_13: + case ACP_CONFIG_14: + case ACP_CONFIG_17: + case ACP_CONFIG_18: + case ACP_CONFIG_19: + acp_data->is_pdm_config = true; + acp_data->is_sdw_config = true; + break; + default: + break; + } + + if (acp_data->is_pdm_config) { + pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP70_DMIC_ADDR, 0); + if (pdm_dev) { + /* is_dmic_dev flag will be set when ACP PDM controller device exists */ + if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type", + ACPI_TYPE_INTEGER, &obj) && + obj->integer.value == ACP_DMIC_DEV) + is_dmic_dev = true; + } + } + + if (acp_data->is_sdw_config) { + ret = acp_scan_sdw_devices(&pci->dev, ACP70_SDW_ADDR); + if (!ret && acp_data->info.link_mask) + is_sdw_dev = true; + } + + acp_data->is_pdm_dev = is_dmic_dev; + acp_data->is_sdw_dev = is_sdw_dev; + dev_dbg(&pci->dev, "is_pdm_dev:%d is_sdw_dev:%d\n", is_dmic_dev, is_sdw_dev); + if (!is_dmic_dev && !is_sdw_dev) { + dev_dbg(&pci->dev, "No PDM or SoundWire manager devices found\n"); + return -ENODEV; + } + return 0; +} static int snd_acp70_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -148,6 +243,13 @@ static int snd_acp70_probe(struct pci_dev *pci, if (ret) goto release_regions; + ret = get_acp70_device_config(pci, adata); + /* ACP PCI driver probe should be continued even PDM or SoundWire Devices are not found */ + if (ret) { + dev_dbg(&pci->dev, "get acp device config failed:%d\n", ret); + goto skip_pdev_creation; + } +skip_pdev_creation: return 0; release_regions: pci_release_regions(pci); @@ -189,4 +291,5 @@ module_pci_driver(ps_acp70_driver); MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); MODULE_DESCRIPTION("AMD ACP7.0 PCI driver"); +MODULE_IMPORT_NS("SND_AMD_SOUNDWIRE_ACPI"); MODULE_LICENSE("GPL"); From patchwork Thu Dec 19 05:48:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914488 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2059.outbound.protection.outlook.com [40.107.94.59]) (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 B467A216E0A; Thu, 19 Dec 2024 05:50:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587426; cv=fail; b=JrpBD2/U/9WAZFIg9X6vjs2t9bLxEMlpRAgb2jwbrlxlCT9QmFuDvNx8shecOr7B0kVzFUEA6eEsNN8fq3Oh7zthYsMcPC9q7g7PEtd8wKNMAy0OkGEZO1L/kiehk/owrvmnmKEJFhEpra094JP+z/HvdAeZy5tQwpjgvCmuIT0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587426; c=relaxed/simple; bh=t4+PUfENaVtQVP9NBmULA8e2gLrXcG0Bz6KfjUpNU3o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rz9wQ8p63r++OM31uHBOEGP5UUcSsghh0AZLQmTaqPDiRKVKgr0ZI466pRJmr4S/RHryP3DQuhlRV+RZaa+Xcf7qd6oQp6wmCUCe7SNAV0dazdkLBbKsTsMaAKkTQfRrHcX9xzohBaidohUS9SpxBwpugheMX+O+/ufPfO6lYAQ= 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=NyQ0nW+A; arc=fail smtp.client-ip=40.107.94.59 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="NyQ0nW+A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xYL6YU1tsCSGzcvbd7TCt0WtRQLoKor1IJNaGbygLaSCKa8mJMJjh2EeTDuk3r4m0EUsKPlSuQxQQGMl9i10E7/7z7TmAo++B7xAkW7TO4nyJ//NEirGfde73fNQveGJGdG/lcxRvVDLOkcXA6/BesPvNlyJeYIgHpxAwvBE+ufR7E0BRiDRN0/GNmbQSJM2doWishrpLopkMUCireDnQwoQ24c7/XKpOTBqUOjJPOK804VTKfJrFsxgysdICZhAhqg4Jy2/GgS2Pdg3Lb1d84KVClK3CAJfb5OPA83aqWOljlC3eqTeD+YzFIih+eN1sZpyuuj1NrdtJDEERDOfDA== 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=Hh4cwBZN9BmivRU+JmhqehA6+UQLGL24LYv4/83Z8wU=; b=oRW6vzQGJkiYmMcAMr3hgAF7Ev6GWiBm8l+kEbL8bJfKco3k81tn8PczqFI8qqyMExCU6k6CSIp8hBbdf60zpPAzh02YpPQ04rs2T9PXK9Px6Om8iJz6LmH6Pey1fYxmJWlS1qZ7POJqqn30z+bwTF4QAd2EUjARpdt/Hpjdhw4oO/YOTOH+pRJHxGuhGolF2GPIOSgkylGGmB++uiv/0ib2FqiYdHW9jO0kAJ2EgsP4iGLRlRgfv3QKYSesikjvD5OGWtZ2KpFYZ8jpJAtIaxFT4pOKigybl6bG+8Iv3Xv7JQTj5FpInfbeM5oN2pSM7ybTHkKLKA6lt/p6XKVPNw== 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=Hh4cwBZN9BmivRU+JmhqehA6+UQLGL24LYv4/83Z8wU=; b=NyQ0nW+AsWR80DdOuBfebwE3TD0KG6VA64tbk3MHC8laNvLUom1Vqy3gGRusW+mi2bYALHzfZGvyKousnZ7YzzK4vo88VOIqPhgtG7/d0PfQQdQNm62IB4cHk6h4mZ/2rrSlP3z0wt/GD6fq//zgRV4tFUZxVWff+yEjjEcb5Pw= Received: from CH2PR03CA0010.namprd03.prod.outlook.com (2603:10b6:610:59::20) by DM6PR12MB4234.namprd12.prod.outlook.com (2603:10b6:5:213::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:50:21 +0000 Received: from CH2PEPF00000140.namprd02.prod.outlook.com (2603:10b6:610:59:cafe::f0) by CH2PR03CA0010.outlook.office365.com (2603:10b6:610:59::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.24 via Frontend Transport; Thu, 19 Dec 2024 05:50:21 +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 CH2PEPF00000140.mail.protection.outlook.com (10.167.244.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:50:20 +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, 18 Dec 2024 23:50:17 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 05/21] ASoC: amd: acp70: create platform devices for acp child nodes Date: Thu, 19 Dec 2024 11:18:41 +0530 Message-ID: <20241219054857.2070420-6-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH2PEPF00000140:EE_|DM6PR12MB4234:EE_ X-MS-Office365-Filtering-Correlation-Id: 341e1f97-8812-41fd-5fc0-08dd1ff1064c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: OY7+neKREXHMBuAmt/FBhlc65AgksW08/41lj4IdhSLpUc7nW8uFNyERkKQ6cQcRIyVPWO1om6540pUXCK4p8wKknSiYv9ki03pvfTGTaTP/CxQ/jjgg7KsMPVC1gPcpiwY4Yu1/3l0ZJFgYsP9pevtyb/yJZ5QXAK59w1UvCsiOw9xrr6QOcv7S/MM6aIgydpxwLIVvs2AsdFkzXWZiA/k0R0ALWhgf9abdJ6nXvb1uACUSyuB8c8pjIqtzcu3Hr+4AM0HTG/ZilcXZRqnOYH9UifkoIQi/Sw7B9tQIv3sHV7ogYLexbSnhDdWD4SZ0dPbBKMoxJMQ5wwdDX5i8W7T7cfRtALmHpK8bNh57dCFwhmA2GFZCZszIWhDuoT/Jev3l6kMpUiqP4vK66KYlP540IkDNxnS6WgfBTyLumMMkWyTJ2wj4pCiDjb4/QRFkIWl9QrWwzl1pOAjM35eoCarUmhxAzV9ZcNiXFcIlLT547mPcSx8v+xG6kfGEwOOwfRyC+rWsu4Ys7xnBiJbgAugfXQwdtRTAvmcYu+aXm83JScSS6i8shIbnTxPXbD66oyc8z7iQfoBcVVo9+AqUItfczkl++qvh1lJoyhyGrAd5t+mfjui/dLcWg4amiONtP3cf1koWHEJLmKi2JBfvbZoSTg89kCnE6asRYHCl7opHc+N6B/s9fbOiF2fe5doy9/dUdBdoDvJjmTIVEhnTTTqq+xqNe+lUTgSMHQN4JOapAfb7EzCIuDKfYgCuyahwk1IynRMVG284pbbU74/6VO8GgwHP9PL3+u9zfTXMJlodQ8W9f7zXBt2+pGmCmXl3dEg2tb7tZWDrCmYfjoihLUNzWNQJg94UmuuR7AanIuVbI8Gv6eVe+L5ijBGyYpXCv6VfoYRfiDqzrKEFIyqQTLCO+nCzAReA9+yuUxWSNY4qtRzD9EcXjCfi+oDFVrVHgii3Um+UcvgiEaqm+/HZl5lkT/wJ6asfaXw1paHoI3e1FiiITUNbqCj6Z9LDmjt1fBTRbiGk9UAwBiwpJ87jhSCQ6LUdJIEqk2Ada3nCzywkJr8W9eQEzBZjKMNuqkQ+6KI34knJf5kipsJlLEIjuGkYzI7heVWrIiT44zEq8OqC4hyMx2KyX1IDBaFTJMUQFKXjx3f6xE8wGDNr3v5+aFt0iarHVYPbsbBpw2EgPFwmhyt0t0uAyp9F07oD+UvQA7kmKSQI8C2aQF+5gWi7Kg4DbQW92AXataV7t6Qw72WfYjQCebn7ydlcc0rUD9YEIFGxAni1AKRstWi8WgOixwuEEcGxdBuGuVAG0s+FJbRVVgF2rsNpLLVS3cpAV7pyK078ADAN+haBHKsoU4kVpF7paZICpc/PVh4ln8b5JAmYQopIeah63uZxrcnA/wVtdh3Kb4mwxr4zrDaBXz3bUkhejEgLxOMP4OC+9ao86ZIWvTAmiEemMOfLPN1IXQ57Y9sv59ZRAMfopVreVuNLTPdIIr6X+s48660AhSJ2IPw= 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)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:50:20.8945 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 341e1f97-8812-41fd-5fc0-08dd1ff1064c 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: CH2PEPF00000140.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4234 Create platform devices for ACP child nodes(ACP PDM controller, DMIC codec, SoundWire DMA driver, SoundWire manager instances). Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 8 ++ sound/soc/amd/acp70/pci-acp70.c | 157 ++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index 1b20de75876a..68035fbf23d1 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -61,6 +61,10 @@ enum acp_config { /** * struct acp70_dev_data - acp pci driver context * @acp70_base: acp mmio base + * @res: resource + * @pdm_dev: ACP PDM controller platform device + * @dmic_codec: platform device for DMIC Codec + * sdw_dma_dev: platform device for SoundWire DMA controller * @acp_lock: used to protect acp common registers * @info: SoundWire AMD information found in ACPI tables * @sdw: SoundWire context for all SoundWire manager instances @@ -75,6 +79,10 @@ enum acp_config { struct acp70_dev_data { void __iomem *acp70_base; + struct resource *res; + struct platform_device *pdm_dev; + struct platform_device *dmic_codec_dev; + struct platform_device *sdw_dma_dev; struct mutex acp_lock; /* protect shared registers */ struct sdw_amd_acpi_info info; /* sdw context allocated by SoundWire driver */ diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index d360dfc396ad..a6812fa269b1 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "../mach-config.h" #include "acp70.h" @@ -115,11 +116,54 @@ static int acp_scan_sdw_devices(struct device *dev, u64 addr) acp_data->info.count = AMD_SDW_MAX_MANAGERS; return amd_sdw_scan_controller(&acp_data->info); } + +static int amd_sdw_probe(struct device *dev) +{ + struct acp70_dev_data *acp_data; + struct sdw_amd_res sdw_res; + int ret; + + acp_data = dev_get_drvdata(dev); + memset(&sdw_res, 0, sizeof(sdw_res)); + sdw_res.addr = acp_data->addr; + sdw_res.reg_range = acp_data->reg_range; + sdw_res.handle = acp_data->info.handle; + sdw_res.parent = dev; + sdw_res.dev = dev; + sdw_res.acp_lock = &acp_data->acp_lock; + sdw_res.count = acp_data->info.count; + sdw_res.mmio_base = acp_data->acp70_base; + sdw_res.link_mask = acp_data->info.link_mask; + sdw_res.acp_rev = acp_data->acp_rev; + ret = sdw_amd_probe(&sdw_res, &acp_data->sdw); + if (ret) + dev_err(dev, "error: SoundWire probe failed\n"); + return ret; +} + +static int amd_sdw_exit(struct acp70_dev_data *acp_data) +{ + if (acp_data->sdw) + sdw_amd_exit(acp_data->sdw); + acp_data->sdw = NULL; + + return 0; +} #else static int acp_scan_sdw_devices(struct device *dev, u64 addr) { return 0; } + +static int amd_sdw_probe(struct device *dev) +{ + return 0; +} + +static int amd_sdw_exit(struct acp70_dev_data *acp_data) +{ + return 0; +} #endif static int get_acp70_device_config(struct pci_dev *pci, struct acp70_dev_data *acp_data) @@ -188,6 +232,102 @@ static int get_acp70_device_config(struct pci_dev *pci, struct acp70_dev_data *a } return 0; } + +static void acp70_fill_platform_dev_info(struct platform_device_info *pdevinfo, + struct device *parent, + struct fwnode_handle *fw_node, + char *name, unsigned int id, + const struct resource *res, + unsigned int num_res, + const void *data, + size_t size_data) +{ + pdevinfo->name = name; + pdevinfo->id = id; + pdevinfo->parent = parent; + pdevinfo->num_res = num_res; + pdevinfo->res = res; + pdevinfo->data = data; + pdevinfo->size_data = size_data; + pdevinfo->fwnode = fw_node; +} + +static int create_acp70_platform_devs(struct pci_dev *pci, struct acp70_dev_data *adata, u32 addr) +{ + struct platform_device_info pdevinfo; + struct device *parent; + int ret; + + parent = &pci->dev; + + if (adata->is_sdw_dev || adata->is_pdm_dev) { + adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL); + if (!adata->res) { + ret = -ENOMEM; + goto de_init; + } + adata->res->flags = IORESOURCE_MEM; + adata->res->start = addr; + adata->res->end = addr + (ACP70_REG_END - ACP70_REG_START); + memset(&pdevinfo, 0, sizeof(pdevinfo)); + } + + if (adata->is_pdm_dev && adata->is_pdm_config) { + acp70_fill_platform_dev_info(&pdevinfo, parent, NULL, "acp70_pdm_dma", + 0, adata->res, 1, NULL, 0); + + adata->pdm_dev = platform_device_register_full(&pdevinfo); + if (IS_ERR(adata->pdm_dev)) { + dev_err(&pci->dev, + "cannot register %s device\n", pdevinfo.name); + ret = PTR_ERR(adata->pdm_dev); + goto de_init; + } + memset(&pdevinfo, 0, sizeof(pdevinfo)); + acp70_fill_platform_dev_info(&pdevinfo, parent, NULL, "dmic-codec", + 0, NULL, 0, NULL, 0); + adata->dmic_codec_dev = platform_device_register_full(&pdevinfo); + if (IS_ERR(adata->dmic_codec_dev)) { + dev_err(&pci->dev, + "cannot register %s device\n", pdevinfo.name); + ret = PTR_ERR(adata->dmic_codec_dev); + goto unregister_pdm_dev; + } + } + if (adata->is_sdw_dev && adata->is_sdw_config) { + ret = amd_sdw_probe(&pci->dev); + if (ret) { + if (adata->is_pdm_dev) + goto unregister_dmic_codec_dev; + else + goto de_init; + } + memset(&pdevinfo, 0, sizeof(pdevinfo)); + acp70_fill_platform_dev_info(&pdevinfo, parent, NULL, "amd_acp70_sdw_dma", + 0, adata->res, 1, NULL, 0); + + adata->sdw_dma_dev = platform_device_register_full(&pdevinfo); + if (IS_ERR(adata->sdw_dma_dev)) { + dev_err(&pci->dev, + "cannot register %s device\n", pdevinfo.name); + ret = PTR_ERR(adata->sdw_dma_dev); + if (adata->is_pdm_dev) + goto unregister_dmic_codec_dev; + else + goto de_init; + } + } + return 0; +unregister_dmic_codec_dev: + platform_device_unregister(adata->dmic_codec_dev); +unregister_pdm_dev: + platform_device_unregister(adata->pdm_dev); +de_init: + if (acp70_deinit(adata->acp70_base, &pci->dev)) + dev_err(&pci->dev, "ACP de-init failed\n"); + return ret; +} + static int snd_acp70_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -249,8 +389,16 @@ static int snd_acp70_probe(struct pci_dev *pci, dev_dbg(&pci->dev, "get acp device config failed:%d\n", ret); goto skip_pdev_creation; } + ret = create_acp70_platform_devs(pci, adata, addr); + if (ret < 0) { + dev_err(&pci->dev, "ACP platform devices creation failed\n"); + goto de_init; + } skip_pdev_creation: return 0; +de_init: + if (acp70_deinit(adata->acp70_base, &pci->dev)) + dev_err(&pci->dev, "ACP de-init failed\n"); release_regions: pci_release_regions(pci); disable_pci: @@ -265,6 +413,14 @@ static void snd_acp70_remove(struct pci_dev *pci) int ret; adata = pci_get_drvdata(pci); + if (adata->sdw) { + amd_sdw_exit(adata); + platform_device_unregister(adata->sdw_dma_dev); + } + if (adata->is_pdm_dev) { + platform_device_unregister(adata->pdm_dev); + platform_device_unregister(adata->dmic_codec_dev); + } ret = acp70_deinit(adata->acp70_base, &pci->dev); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); @@ -291,5 +447,6 @@ module_pci_driver(ps_acp70_driver); MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); MODULE_DESCRIPTION("AMD ACP7.0 PCI driver"); +MODULE_IMPORT_NS("SOUNDWIRE_AMD_INIT"); MODULE_IMPORT_NS("SND_AMD_SOUNDWIRE_ACPI"); MODULE_LICENSE("GPL"); From patchwork Thu Dec 19 05:48:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914489 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2044.outbound.protection.outlook.com [40.107.92.44]) (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 A93431FAC3B; Thu, 19 Dec 2024 05:50:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587451; cv=fail; b=hEmxoxQCK9CKVFUuTgP9/jPTNLn/+3x4Ffn/gocsvXmvQ9MfAO/NXMkaY0DhIBZr/V+HbDlZZer763LbPDzt8/UMV2harR9N8GxF8H7O4lJu/lLgxBLS1ZfBUC2GWLK6yfOSnvizpzxGubcWzS2IMGMqZn8GPx8vN2G6B8x0oEo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587451; c=relaxed/simple; bh=c9YvyFJkz3gTqlIZHxwSK2i5sTITHXxeQLvjejBo3Ik=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A/vGtVYEoa6wycDbNgd4hTJmvpIEwFcNCEkh7iS2S6+SSdTuvilI5pkMHkBxaU6hPt84XLaU2PrnbIYyAyzYwgwsRb4Zrl6X6CktW2SsIuoi2kCOPDwE3TI/V2uT2tD7LvHH/1UpFtso9fxQLJJjqCoMUAUz5t44AX5VoqZwgzA= 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=qdWtRVi+; arc=fail smtp.client-ip=40.107.92.44 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="qdWtRVi+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xOkPrKUtsL/kUi1QRaCjND854+Xk5Aa51pc9nC0Jz0ETP3FCB4UE2vMEZ9EYjUKZXeee2h4tQ9vJCabTttfYff0vXfU9Vhdhym7yhUjGM+kPIoODwT1fhW6Kr8BaixLY5QCE8/SkyOcwGrQIDXdJIvTbCO92ifasbTUwTxIo9FJl8jE4ltsDJqzs0IM08IbRWyjtW1KmsNmFHKNgv2f3IQfuiZP94MIVZeNsIuNcGfDfDJGplG8zR9/t5w0IOl9MsPyphO9YYNQWgJAUmYvff2D9g3EpEKoXxMDR5Vq1oEUftkLMy/mopu/F45B9fYgYFrBDEKiJNt8p8hz3U24B/Q== 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=06PzbGeFxjPdP9S9uHtftoDnsB0BrW9qa1Ho/2JaLFY=; b=RzVGZCL34/D5A7zwGiXqWhVeMXK+qpzE2Y8WcBpTeBtX4DasBgY1tffih/Za/EF10DwJWMFQQn80T5hcIJcHiEGJ8AIcpmVAujJORJ7nNUWHwTOwJ028nFbeduXoQRcmqSPfXaxZAbuTbFNDdLKNYlQlvkkEyHVPYfdd7uqw+QGzIm1RDN6+WLu9bEQGp5oqqvoFj85c/s4170nZkQJOk/yQlWMpg/6QoiNldVD/uMcH2ji+Su8CaAeCuV0I7/7zPYdcO7grYsyTb+VikNNyc8bs+HCmOleACWRWTEEg8k1xQbvNlWYc+NOxvcyDxR579BrnPoR3QzXG/lYQXehEAg== 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=06PzbGeFxjPdP9S9uHtftoDnsB0BrW9qa1Ho/2JaLFY=; b=qdWtRVi+Te1hVd7tUlisZNYWK4wBRi0xol7Csg20ik5nEfJt5GRdSSlbq5ZBC6gt+asOrMWkBe1O6kj8WajVJMF4fejwqNxfIp5t4a6/fd5u18kRR/YrUC4896nZpOa0NeOqd+bUyg3IxFv/zON/RUmU/T4ZXaxWKT6s9kezL98= Received: from CH2PR02CA0027.namprd02.prod.outlook.com (2603:10b6:610:4e::37) by DM6PR12MB4388.namprd12.prod.outlook.com (2603:10b6:5:2a9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:50:45 +0000 Received: from CH2PEPF00000141.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::e7) by CH2PR02CA0027.outlook.office365.com (2603:10b6:610:4e::37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.24 via Frontend Transport; Thu, 19 Dec 2024 05:50:45 +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 CH2PEPF00000141.mail.protection.outlook.com (10.167.244.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:50:45 +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, 18 Dec 2024 23:50:20 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 06/21] ASoC: amd: acp70: enable driver build for ACP7.0 platform Date: Thu, 19 Dec 2024 11:18:42 +0530 Message-ID: <20241219054857.2070420-7-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH2PEPF00000141:EE_|DM6PR12MB4388:EE_ X-MS-Office365-Filtering-Correlation-Id: 013be76f-c70a-47df-72c5-08dd1ff114de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: 2sAFofwdRNHYlZXck9wv+o4oA10nNfdTGt07trMRqbaG/WnrZ3dfbIhvAQLKTVTEe5/2oGlv08+F/7RHWDuvTLQ/pDvpd4+9kK/xUpLVg0xs6Vc2a1zMOW3jI88y9XIOfUoVbnNH9XxChaw4zyS3AA8babjcA1QnsJ80T5XkxEZNv0n1k+w7o6KqszAAc4fuUvSB0IdF031/8Al6sAI1dVT39Za5iEoWHtOKGTFykMrTyDrC1aeRiPGZznoKHDYI94LN5ht/EypaUXhZbmmWaWXIb3vV3qRuS9/BwPj6xJ2JgrS4BWZ+OyQQc/YJsGFOE2JRej5dJWA2ghE1u79DESAkwYGdIBUcVZ9SxYupF62LFG82pLNuIr146wzJZYq5/4neBrkBQzr49fKJpKV7gdWn5WOpvPO3AREDHEbffn/4091gXkRLUuqOneQ1lJ3G44Rc14nvdVRRCQCR4UQH6kvJflV6bh3RjrgfWJazW4sZzsmFdDtcMU7c95Xyt+L0vtIr5BoRnBoh67n/miPsTNsFf2VIEIi9TxFpxEDwcTYvSe7Bjnkyj9IjHqMBCj4P6IT+EeccvusMZ/DhF7iU55DLwdDaCvgngxbecCZEEH/Su7CCNdKor7rgoJdvPlZ/yVIpFwNdqD+fgZDCZmnuXnGZZMXRqe053sDycdqtpMbpRUcTJkSpUVIv/Ve8dw92UrT8TDlT4qTV2n4keW0vAA4LWrQGWkqJMJm8Y1NT/S5Oa4ckeqNzLLxTS30BY/E78ZOpURtpoZ/3dpVSN89Fz1vba35soGFTjU4uF8HqN3EoQaTGj23uzOGbWN51F4cSqigZminK6Jk7V8PyZw73ZmXDwYzMYUIldenI+mX8+OWWZsB7psE2hh9Eh08rh3ASH4k9SYcSfo3uJ/04hiOYp1MzA1+Nst0mk73fVNcyJXepgQ0NQA+mR6u5rKiqRER4P9+refydRyOne66zRBR4PFQXRdpznVlLTNUSSPPNvjKjDOCb6soFXUDxFZoqDGN69KuvTsL1FoMNtSUQhntrs1E3J0WcwKSvFwCWOsS+KXejuwgTJ19crtIZQo/LH2WCCt1nFnxjrmnlkVUVzU7ynLTsubrhaNCU9Lse2K8bFQBzpVmK5DR5fagi+aP6SSYKxn3pImqbLYtFZ29ORt/wHcHrKsqXMaeJyyRQqvPepVBsErv399wovV+KaZ7pXqxT4sAB49Id/VrlG0g+pPOJIO1WqlQBS03/Vi56H0rTRg9ektohQia9RpFQ9fBueCj71MpwrLRPKNPRrcfD+Lc1Rw16T+QCzL/7No2+7ZA7UZ5sn107H7JHh0e5AqIWhDkTUuwwkTFQ96JGJGICmYoXxn8b1bFTBYvx0VtxbjnVvdlCBWi0UUeEmU8Zym+2y3tFqH3dAUFd5urQZw3wAUJnbl61i4UsAzdi0LSjGbNDytRvrpo3rGHoe5rhPLgRTMjkxN6S73gszFZUPAsTxiIiopAx5WOhlJqtfUIALez1e4U= 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)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:50:45.3399 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 013be76f-c70a-47df-72c5-08dd1ff114de 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: CH2PEPF00000141.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4388 Add Config options for ACP7.0 platform and Make file to trigger ACP7.0 driver build. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/Kconfig | 10 ++++++++++ sound/soc/amd/Makefile | 1 + sound/soc/amd/acp70/Makefile | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 sound/soc/amd/acp70/Makefile diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index c7590d4989bb..9d8114909eb5 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -184,4 +184,14 @@ config SND_SOC_AMD_PS_MACH Say m if you have such a device. If unsure select "N". +config SND_SOC_AMD_ACP70 + tristate "AMD Audio Coprocessor-v7.0 SoundWire support" + select SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE + depends on X86 && PCI && ACPI + help + This option enables Audio Coprocessor i.e ACP v7.0 support. + By enabling this flag build will be triggered for ACP PCI driver. + Say m if you have such a device. + If unsure select "N". + endif diff --git a/sound/soc/amd/Makefile b/sound/soc/amd/Makefile index 4f89d962cce2..d71f74f957ff 100644 --- a/sound/soc/amd/Makefile +++ b/sound/soc/amd/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_SND_AMD_ACP_CONFIG) += acp/ obj-$(CONFIG_SND_AMD_ACP_CONFIG) += snd-acp-config.o obj-$(CONFIG_SND_SOC_AMD_RPL_ACP6x) += rpl/ obj-$(CONFIG_SND_SOC_AMD_PS) += ps/ +obj-$(CONFIG_SND_SOC_AMD_ACP70) += acp70/ diff --git a/sound/soc/amd/acp70/Makefile b/sound/soc/amd/acp70/Makefile new file mode 100644 index 000000000000..5e553de6c772 --- /dev/null +++ b/sound/soc/amd/acp70/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-only +# ACP 7.0 platform Support +snd-pci-acp70-y := pci-acp70.o + +obj-$(CONFIG_SND_SOC_AMD_ACP70) += snd-pci-acp70.o From patchwork Thu Dec 19 05:48:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914490 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2076.outbound.protection.outlook.com [40.107.243.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 475FF13C3F2; Thu, 19 Dec 2024 05:51:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587478; cv=fail; b=gAdDWxvmONQF4DnYj8HmNsiMaiLIJyGutsLKbn4BOObs2WLAQ21GvSRdqzYHiOMj7tD4D0dgkDqaESBTceleXZZujAr+fMMBKQJAwWWY3Xl41MJTsCmNi/FUNl5J7qBMXPR8iAC/SqM1/b5bPEaoABnuqv4jqk71qdDIBfRmPrg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587478; c=relaxed/simple; bh=jUD49omW6eoK0qc+XdxjUI6U0qQ70D08F/wODbko9d0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DK9Az99Ml9aPUW348ILu/sm3Cp8h0so4sDzP8fbLpXsKypLgC5YfxAGau49sSbh6SW/HcoX88j0xfHXcoapZinI5k0RD72lMFfVKUpSGnw4b7UTpLtejGREIC2JNlz+gXatKByHUU9qA1LVtd7NpyzO5wKsy8H0fIS4PeYwMMAI= 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=s9+JVC1l; arc=fail smtp.client-ip=40.107.243.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="s9+JVC1l" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A0mXtFLJ6cLQ4/IftUt6IydiGbt4x56DCFxYdZDPzPb4LH7jTfzHV341qaU4/rpqlLFHE6za4Dv9UDuhb3irLXXrximrpO5h5JS1HrF0pg4VnkDPnl5Ce6tVK3baexdaBBIkLzH7HWN3WsnEhBAdfmYz6BINtVv6N8rKslZ4PqvxJBuAffY/SLPKRfUaWeyIH/k/cmODlq608cRWUeOuhhAh8/Qraur/KCBbpGHPL7WdKlDMifV+f6f0fpcP/CVKYqgnutAnC+Fg6gHRt8DBAYH3wVwP5dpdVpPQNsWrSwl4CnVcYRFgnv6OX+hlGkiCYNISAh0yxltAGzPoCDREyA== 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=14JSuMIGx0dkAqxU3CKi2t75n/nXxh+ywxQUex3Pl2E=; b=hqLMSg3udbnszurRyK5SCK0udQ+G4stYul2mCC0zznFYBhA16OnViZtb1PUrEmatsbKPXryG3k0LUe7IgUq1+ZU7pbUEAkAXyu5Us/ISS6qKr9TIFTZWAQV5eMBIDYagQ1Kd1JWkU3yrQzVb2RILWfxNf6A9zIQyBQihioN7rMKGfi37vWl8YVYCSxNJIZ0J90FwbZzPsN7BfiTORPWGfjWnref8WDqBb/Ks97XkDslHjGOTz3RkKP4UTh7hsGA1lVfeYioM7MVDYl9Y6DLrP8E3jU50eha9/iFHDCqweJ4kOCheWORxIWliLUuzVZcQqLE0xeXUGfCBNu/SNEmwrw== 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=14JSuMIGx0dkAqxU3CKi2t75n/nXxh+ywxQUex3Pl2E=; b=s9+JVC1lfl/Dod0Mk7lHvOpG360jgoYDOuNSUhWciW7k9PEhCIEhfJOSCNBajwuzUbn7cjdPvYQn6g9qZA9y331ocRJ4OAUpx0xgax/BF2myPsIFpi4dPtBb1MoE5cqzjl0YxflGjmRF5ogs7D18G4TIvsc30ydQzY3BqePwEpI= Received: from CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) by BL3PR12MB6593.namprd12.prod.outlook.com (2603:10b6:208:38c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 05:51:14 +0000 Received: from CH1PEPF0000AD81.namprd04.prod.outlook.com (2603:10b6:610:55:cafe::79) by CH2PR18CA0056.outlook.office365.com (2603:10b6:610:55::36) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.24 via Frontend Transport; Thu, 19 Dec 2024 05:51:13 +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 CH1PEPF0000AD81.mail.protection.outlook.com (10.167.244.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:13 +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, 18 Dec 2024 23:50:44 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 07/21] ASoC: amd: acp70: add acp pdm platform driver Date: Thu, 19 Dec 2024 11:18:43 +0530 Message-ID: <20241219054857.2070420-8-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD81:EE_|BL3PR12MB6593:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b290d27-79c2-4f6b-5d55-08dd1ff125d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: WtQ4jjIRgkB98dSjGvWgFhlkA+XkRQTpPreQD2hKtkyq0HTRvDRDKLh/JIINAMJAsmlxRNh5vGlMcuGFA/RWxrlZ38qzM8MrWvvLEp68zxSLvIH6nES6f9H4tVMiZH4pk+Tu50G7YnGF0G7Y9TjIeeVQtWpCdVdKsa45LtdYonY/ABZv4Zzcf9ZqwtYFK/73mVQwUrVFcaraIe8G5vAZ/GS0EhyTWt3wMfMPgsl1Zf36MDA97gQqhyQ9nPMyPotQixCBKn2x9WYlv1C/7jrMfn3Kthiy49mvmf4bNmARtoaJiTDAzndqcJ51cdRvz4DEH157/YqeA6P/iZ0MRyDTDGl6n0iZ5VYQTAgaw0ROWb5SIvOX+u7w7qxFg8wntF6DWei54nC1rWylYXPk1QfQvlybWtlKY2QvkgNBjIUKPYefUGxrnqcJoaZnEFqlhvKvYsAS5OBsC2gsOSd5xb9yfmxl1Pejkg8BRXGU6q2LIlW28h2XyXFGBJy8zRrzdqxSX7WAbcupgZ13QBmN+Mr4Ypgt+YldnIXMpE8jT53mseQ7/SwUYjTv7pqm+0YFE52D/yAppPRMd9vLiRfVHOjiTkvZRGGmX9i/dP2CRbqIwmcdP+31pBh49IOsuIZyfa1HwY/fMxG4cE5flaRQRv4axmegGFWqwBsrrFqX39uq0U5xhcyaN/AQVZyW1Yp1zDCWApaSTIxB7V6WIM08n7pKVPVaR5C/DFtrXwCz46/dZCZ0S5kv0K9+qmuDByzqguInvqF4oaCW7WaV1gNYUuRBcqun7XVZ/POvZThahvEcjNlwes6rbEPZKpMe9uBjBYWtUdNLeir9fYAHRIGx1ugSPzvyLAL3YL/FrIYiXVSDNNluhT/1Kuctq6fKeQUhqBASwwWXNvq4xf0vEKCp0Q9hpcOej1FfBFQl6A+EagEr38MpwSItbs4lYIk3XvX6dBF4iMz64H9kkS+TQAShRl5uGu5xStZRmuChm4GB4WnXnj5kjfitZitbZM9d08GW3gJaYTxfcZ0/rUEM9J/rux2mx8Bzw2q98thBQp+s7NEic4bjPA1YsSS+fjeOHhiTNwhxvmmAmHra1tkiulp9Dnn07odxolyu2XrOXe8K7QbYqje/hdDzHQR4PVU45ncFXt1b4KfXaczrJQ7F/f1PRWScS76HZSQvsXGPsnEsJ/HgY3TKG2oZZQRzhuuZ9poK3RcyqIhRpAQCQk9WjIINAex4wG2QSYOPBuTHk1QKZ4SS2NkxoVDXc93A3ml7VWELO/sgv1Ot0hsZhsY5H5wgHTY8zdYmdHMgmJj2OuU69yVgS9XJpd5Zfv/pGpArQlexvCYud1c6xWSv0P3f5Fi9rmtTu7onyUSH2zvXJOyd90AiECrnknVYw3QSy0/6VIj9KtlL83MPjV2OIJt2krYddeb5uaKf6RH9FlssBc/7ffh/+EFpQPUjUUYQ/1JIF+tWEvDxhfN3P4Ral5+UOThmUVl1aA== 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)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:13.8041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b290d27-79c2-4f6b-5d55-08dd1ff125d3 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: CH1PEPF0000AD81.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6593 PDM platform driver binds to the platform device created by ACP7.0 PCI device. PDM driver registers ALSA DMA and CPU DAI components with ASoC framework. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/Makefile | 2 + sound/soc/amd/acp70/acp70-pdm-dma.c | 87 +++++++++++++++++++++++++++++ sound/soc/amd/acp70/acp70.h | 7 +++ 3 files changed, 96 insertions(+) create mode 100644 sound/soc/amd/acp70/acp70-pdm-dma.c diff --git a/sound/soc/amd/acp70/Makefile b/sound/soc/amd/acp70/Makefile index 5e553de6c772..778bdf268731 100644 --- a/sound/soc/amd/acp70/Makefile +++ b/sound/soc/amd/acp70/Makefile @@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only # ACP 7.0 platform Support snd-pci-acp70-y := pci-acp70.o +snd-acp70-pdm-dma-y := acp70-pdm-dma.o obj-$(CONFIG_SND_SOC_AMD_ACP70) += snd-pci-acp70.o +obj-$(CONFIG_SND_SOC_AMD_ACP70) += snd-acp70-pdm-dma.o diff --git a/sound/soc/amd/acp70/acp70-pdm-dma.c b/sound/soc/amd/acp70/acp70-pdm-dma.c new file mode 100644 index 000000000000..fd31e31a02a6 --- /dev/null +++ b/sound/soc/amd/acp70/acp70-pdm-dma.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * AMD ALSA SoC ACP 7.0 PDM Driver + * + * Copyright 2024 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acp70.h" + +#define DRV_NAME "acp70_pdm_dma" + +static struct snd_soc_dai_driver acp70_pdm_dai_driver = { + .name = "acp_acp70_pdm_dma.0", + .capture = { + .rates = SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 48000, + .rate_max = 48000, + }, +}; + +static const struct snd_soc_component_driver acp70_pdm_component = { + .name = DRV_NAME, +}; + +static int acp70_pdm_audio_probe(struct platform_device *pdev) +{ + struct resource *res; + struct pdm_dev_data *adata; + struct acp70_dev_data *acp_data; + struct device *parent; + int status; + + parent = pdev->dev.parent; + acp_data = dev_get_drvdata(parent); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENODEV; + } + + adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + if (!adata) + return -ENOMEM; + + adata->acp70_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!adata->acp70_base) + return -ENOMEM; + + adata->capture_stream = NULL; + adata->acp_lock = &acp_data->acp_lock; + dev_set_drvdata(&pdev->dev, adata); + status = devm_snd_soc_register_component(&pdev->dev, + &acp70_pdm_component, + &acp70_pdm_dai_driver, 1); + if (status) { + dev_err(&pdev->dev, "Fail to register acp pdm dai\n"); + + return -ENODEV; + } + return 0; +} + +static struct platform_driver acp70_pdm_dma_driver = { + .probe = acp70_pdm_audio_probe, + .driver = { + .name = "acp70_pdm_dma", + }, +}; + +module_platform_driver(acp70_pdm_dma_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP 7.0 PDM Driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index 68035fbf23d1..c7cabb98cc1a 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -58,6 +58,13 @@ enum acp_config { ACP_CONFIG_20, }; +struct pdm_dev_data { + u32 pdm_irq; + void __iomem *acp70_base; + struct mutex *acp_lock; /* mutex to protect acp common register access */ + struct snd_pcm_substream *capture_stream; +}; + /** * struct acp70_dev_data - acp pci driver context * @acp70_base: acp mmio base From patchwork Thu Dec 19 05:48:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914491 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) (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 D0416216612; Thu, 19 Dec 2024 05:51:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587481; cv=fail; b=dVYwvZAU2rSWKnKDfyzkkU695Yicz4q8+piNyttY9FR2rYS1V/c3flwOBnTxuJOIfQW+iiD85aEmRnF56kG/p3AXLXWEvT+caRsZDuHeccBz+sEM6ND6C1ugC0mai/q+tQXZSXHH/gw8yLFgMg11O82pwOHGqNRJ7nxCX28ymLI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587481; c=relaxed/simple; bh=tjvuItLl2ipucrxFV0dJEEx8ihFUfRy2+qnlQ9UVWYA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Cfg+7sRJU1X0krQsQLbjApRViQ748HY4CHBXdVubmBDNWvJ7eu0FrSZ7GI/s913dHBUgSzqs7wxD9yszOHKZR09IZ1Ar6XWadpUmiUeqI8rxwjx8hs0UCgn/haxHFDKTNax9psiht7570tmzuecMQOi1kSyeCPNny4+uTsRk9ZM= 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=XzVdVtlt; arc=fail smtp.client-ip=40.107.94.56 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="XzVdVtlt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QeO7Jcgie88e02n1qfYiXjBucHUw+RN6WblshlVsAC1LC89pcWDcLqG6ddEenOHmyngUvj0lLBCedr78ZqtyMaGze78dRUIBw4FgGXjWvT3fHLcgOla3HM7O2n4rc9UTapXP6TvjenWiWKmk73rx6t+3edY5BPGptgUCE5YV3Qdqs+jpiVn8E3GnnnXTgR53+2jUR2Zybqb1YQb0OCXiHaXnEdtjoYsY5CqA+hQvZxJqMXIzlBm0uznNkmfvCmsBzlF1HsjNG1pI7SUO9BW+KIvx0iGqj5KGBmasxKGTbl3LOUwXXsiyMH4LXtt9Sq5xW7pyx1WBfAUvDGRljB7Q5Q== 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=Fk6FoldldQf1a87QnUneWjChYtE4d49bzLbcxUx2EFM=; b=hXv2QCfAAjqfhKN9E2rtXlQeJyRuRXhMCAwORBB8fCeZWwwGGhtHsPL1KeH7aap0o916FqLigtNqB/WLzfYSLaQq9KMntufWJSLJXKi7W0wTXxAO/v7P447C2FI67IAl5KMuMzvFe7pn4R7NWDFU/xdv31LCSucS5XL5WP7llu9/2k5+OqSo4ytnIbX3vwXklq6o3Lr6NDrScR0ptdbIpamfSPMAJVU+9D2Mxo/N8ZGMyX46v7QLCcJm4sT1NVzP2fw7VKYenIt/UEOsKo0RzggWXzAVsxKXj/AFx8WMNrf6pHoC/v98BQiF2HGzaR/12hWetMm3MAUwjOEvEUnWvA== 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=Fk6FoldldQf1a87QnUneWjChYtE4d49bzLbcxUx2EFM=; b=XzVdVtltIqjh6sSs3xOJPnRiKOkb34gOAVmkvRwd5wPGlJO08xTzYd8tEQMuX1A6LQ3QJcOAvH1/a18gHF/eESP8AWq1lZZp7X09IE31eOAa5U7rzluB8e52i351+s4P7zNCf/JZco6743+Kj1Y4E5/9xRIJWTGjXSXbW2rfmCU= Received: from CH2PR18CA0058.namprd18.prod.outlook.com (2603:10b6:610:55::38) by CY5PR12MB6622.namprd12.prod.outlook.com (2603:10b6:930:42::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 05:51:16 +0000 Received: from CH1PEPF0000AD81.namprd04.prod.outlook.com (2603:10b6:610:55:cafe::76) by CH2PR18CA0058.outlook.office365.com (2603:10b6:610:55::38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:51:15 +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 CH1PEPF0000AD81.mail.protection.outlook.com (10.167.244.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:15 +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, 18 Dec 2024 23:51:12 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 08/21] ASoC: amd: acp70: add acp pdm driver dma ops and dai ops Date: Thu, 19 Dec 2024 11:18:44 +0530 Message-ID: <20241219054857.2070420-9-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD81:EE_|CY5PR12MB6622:EE_ X-MS-Office365-Filtering-Correlation-Id: efc72a86-de2e-42b8-5064-08dd1ff12709 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: YlWfgT4ScdIT4Uviw0boQ83P8rJ+twsUh5VarP9OzarleMqpkj7in9CxT138GK7clP/zJWFnESROQ/v5FyI0N8hZLoV4d5+qIPF4qcdAqacsTc0XFl4kzAeg3EMgyQc6vZohsTl7quJuGJjDa36sDDpoh0TKc4JQ+KCH6m+2ke604N/Lhp2XF5UNzHTqTWZEcb8bMPye3gTxc3khaJUwD8Col18CQYlGpl0YkqmWgWbjZqBV7+eIKPzPUC9IArA1lguFjN0oSq2ELNEz5QJskdJz/9ekoufohNO7ArUqyiu6kXZ3fzBA8PBMQSLZ3c8hBWKCKg3HAfwK35bDbQf73WyR6hT+LdW9CAbazH37Ef3LdBvJ4dKB9Iy/tJgW/cY7fAa/IRkFk+sUH+Gve/10MhbKmGgNQqPUnbG8xIXcO+6UU1rLCMn0Z/lxuiZfn4UCpKXUfNXDnnhi518F15tajQnmyvj6om1y3BOqkB4AQmlVGRGXkasvbMppU29fuGCHBjt/De0zX3BLfQkRyLCxZ1snzs01EaVKe3lqiwm5lfTz+5jO/VfpnMTH9GMZ42x4SNs7qcfsJZ0BydY31WilaRDsF5Q0Un8tNGEkxLsGpMkhZr9foN276eXykynoomgy0jYy+GEIxQK5SJ0nZmRlXdKLMrZZYDNjY30jIQA4MdVBBFi2qgblhFrhHjrchjVS1+s1g5ONZHpxHKRr2EHMt2apO+gaX/0/11kCrWfx09j6TDgZirYtXzWSFezC/MThj9YHHIURhgxOL2rvriDOx2B87T04UM2r3LmPbEkOx000Yn7Codu7RCkLGWY2fdxa96y1ewix8V9y7T0r8TyOqEDwouSqlMRVgdy/1X4NwefzuGj9C4fjGVScNSqx5opiWV/412fIi6JB5IxGGcRA6zh4/DqGI1EAZKbNhtu+3KoLpJVSRFK420hFZXZoz4VbVhDMbPhNS9OmEKbLxFfpl1UZa/rmeWF7vVIMUAzNbKuDylEzn+0DW+8zy+MtXfCfMu96iS+wNq4QKkf5FkpRDbmpE2m9umqwQ8i1NtKEfc8Lzqy3FoYD8WQli0njFhLHIE7mwZnt1tE5g+OTTYaI8GozsCR1ClbXHpfuUPB46McJj3aSgNEnoAfnlQxx1OEZT6+avFXtnDo79WnN95k8OoU32KTS+mJZKyimfhSsiGJxXNAWWjtFoi0/nlk+uWTwVqLngIpkGojl4UF7d9gtQWu/6eEM/2O16xIUXDdOPBpp1Tjx1qO1EUmyOH2TODu5VSf3oHzxwozbnbaygfpVlbQYlHxyxfYkKmT/Vl/ClpbcL3HdUj9AlVF9jx7joXvHMbCgAOxNcDvfqBRFMbUjWsSHCV1zrUlKbGNH+2hsc/nL0pTK03PlaLKsNq5FyWRd8HIE8UxOgyx0G9dZrELr1qxgzALemXVLlt7jJFv6tVYheMLnhCFDtd+uGtrpes5XRgt+enWT6E/iHx98z4HSDb8AOvaBUegGIr3tXj2RfqE= 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: 19 Dec 2024 05:51:15.8198 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efc72a86-de2e-42b8-5064-08dd1ff12709 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: CH1PEPF0000AD81.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6622 Add acp pdm driver dma ops and dai ops for ACP7.0 & ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70-pdm-dma.c | 319 ++++++++++++++++++++++++++++ sound/soc/amd/acp70/acp70.h | 32 +++ 2 files changed, 351 insertions(+) diff --git a/sound/soc/amd/acp70/acp70-pdm-dma.c b/sound/soc/amd/acp70/acp70-pdm-dma.c index fd31e31a02a6..197214e68489 100644 --- a/sound/soc/amd/acp70/acp70-pdm-dma.c +++ b/sound/soc/amd/acp70/acp70-pdm-dma.c @@ -18,6 +18,319 @@ #define DRV_NAME "acp70_pdm_dma" +static int pdm_gain = 3; +module_param(pdm_gain, int, 0644); +MODULE_PARM_DESC(pdm_gain, "Gain control (0-3)"); + +static const struct snd_pcm_hardware acp70_pdm_hardware_capture = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, + .formats = SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .buffer_bytes_max = CAPTURE_MAX_NUM_PERIODS * CAPTURE_MAX_PERIOD_SIZE, + .period_bytes_min = CAPTURE_MIN_PERIOD_SIZE, + .period_bytes_max = CAPTURE_MAX_PERIOD_SIZE, + .periods_min = CAPTURE_MIN_NUM_PERIODS, + .periods_max = CAPTURE_MAX_NUM_PERIODS, +}; + +static void acp70_init_pdm_ring_buffer(u32 physical_addr, u32 buffer_size, + u32 watermark_size, void __iomem *acp_base) +{ + writel(physical_addr, acp_base + ACP_WOV_RX_RINGBUFADDR); + writel(buffer_size, acp_base + ACP_WOV_RX_RINGBUFSIZE); + writel(watermark_size, acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE); + writel(0x01, acp_base + ACPAXI2AXI_ATU_CTRL); +} + +static void acp70_enable_pdm_clock(void __iomem *acp_base) +{ + u32 pdm_clk_enable, pdm_ctrl; + + pdm_clk_enable = ACP_PDM_CLK_FREQ_MASK; + pdm_ctrl = 0x00; + + writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL); + pdm_ctrl = readl(acp_base + ACP_WOV_MISC_CTRL); + pdm_ctrl &= ~ACP_WOV_GAIN_CONTROL; + pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, clamp(pdm_gain, 0, 3)); + writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL); +} + +static void acp70_enable_pdm_interrupts(struct pdm_dev_data *adata) +{ + u32 ext_int_ctrl; + + mutex_lock(adata->acp_lock); + ext_int_ctrl = readl(adata->acp70_base + ACP_EXTERNAL_INTR_CNTL); + ext_int_ctrl |= PDM_DMA_INTR_MASK; + writel(ext_int_ctrl, adata->acp70_base + ACP_EXTERNAL_INTR_CNTL); + mutex_unlock(adata->acp_lock); +} + +static void acp70_disable_pdm_interrupts(struct pdm_dev_data *adata) +{ + u32 ext_int_ctrl; + + mutex_lock(adata->acp_lock); + ext_int_ctrl = readl(adata->acp70_base + ACP_EXTERNAL_INTR_CNTL); + ext_int_ctrl &= ~PDM_DMA_INTR_MASK; + writel(ext_int_ctrl, adata->acp70_base + ACP_EXTERNAL_INTR_CNTL); + mutex_unlock(adata->acp_lock); +} + +static bool acp70_check_pdm_dma_status(void __iomem *acp_base) +{ + bool pdm_dma_status; + u32 pdm_enable, pdm_dma_enable; + + pdm_dma_status = false; + pdm_enable = readl(acp_base + ACP_WOV_PDM_ENABLE); + pdm_dma_enable = readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if ((pdm_enable & ACP_PDM_ENABLE) && (pdm_dma_enable & ACP_PDM_DMA_EN_STATUS)) + pdm_dma_status = true; + + return pdm_dma_status; +} + +static int acp70_start_pdm_dma(void __iomem *acp_base) +{ + u32 pdm_enable; + u32 pdm_dma_enable; + int timeout; + + pdm_enable = 0x01; + pdm_dma_enable = 0x01; + + acp70_enable_pdm_clock(acp_base); + writel(pdm_enable, acp_base + ACP_WOV_PDM_ENABLE); + writel(pdm_dma_enable, acp_base + ACP_WOV_PDM_DMA_ENABLE); + timeout = 0; + while (++timeout < ACP_COUNTER) { + pdm_dma_enable = readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if ((pdm_dma_enable & 0x02) == ACP_PDM_DMA_EN_STATUS) + return 0; + udelay(DELAY_US); + } + return -ETIMEDOUT; +} + +static int acp70_stop_pdm_dma(void __iomem *acp_base) +{ + u32 pdm_enable, pdm_dma_enable; + int timeout; + + pdm_enable = 0x00; + pdm_dma_enable = 0x00; + + pdm_enable = readl(acp_base + ACP_WOV_PDM_ENABLE); + pdm_dma_enable = readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if (pdm_dma_enable & 0x01) { + pdm_dma_enable = 0x02; + writel(pdm_dma_enable, acp_base + ACP_WOV_PDM_DMA_ENABLE); + timeout = 0; + while (++timeout < ACP_COUNTER) { + pdm_dma_enable = readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if ((pdm_dma_enable & 0x02) == 0x00) + break; + udelay(DELAY_US); + } + if (timeout == ACP_COUNTER) + return -ETIMEDOUT; + } + if (pdm_enable == ACP_PDM_ENABLE) { + pdm_enable = ACP_PDM_DISABLE; + writel(pdm_enable, acp_base + ACP_WOV_PDM_ENABLE); + } + writel(0x01, acp_base + ACP_WOV_PDM_FIFO_FLUSH); + return 0; +} + +static void acp70_config_dma(struct pdm_stream_instance *rtd, int direction) +{ + u16 page_idx; + u32 low, high, val; + dma_addr_t addr; + + addr = rtd->dma_addr; + val = PDM_PTE_OFFSET; + + /* Group Enable */ + writel(ACP_SRAM_PTE_OFFSET | BIT(31), rtd->acp70_base + ACPAXI2AXI_ATU_BASE_ADDR_GRP_1); + writel(PAGE_SIZE_4K_ENABLE, rtd->acp70_base + ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1); + for (page_idx = 0; page_idx < rtd->num_pages; page_idx++) { + /* Load the low address of page int ACP SRAM through SRBM */ + low = lower_32_bits(addr); + high = upper_32_bits(addr); + + writel(low, rtd->acp70_base + ACP_SCRATCH_REG_0 + val); + high |= BIT(31); + writel(high, rtd->acp70_base + ACP_SCRATCH_REG_0 + val + 4); + val += 8; + addr += PAGE_SIZE; + } +} + +static int acp70_pdm_dma_open(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + struct pdm_dev_data *adata; + struct pdm_stream_instance *pdm_data; + int ret; + + runtime = substream->runtime; + adata = dev_get_drvdata(component->dev); + pdm_data = kzalloc(sizeof(*pdm_data), GFP_KERNEL); + if (!pdm_data) + return -EINVAL; + + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + runtime->hw = acp70_pdm_hardware_capture; + + ret = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (ret < 0) { + dev_err(component->dev, "set integer constraint failed\n"); + kfree(pdm_data); + return ret; + } + + acp70_enable_pdm_interrupts(adata); + + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + adata->capture_stream = substream; + + pdm_data->acp70_base = adata->acp70_base; + runtime->private_data = pdm_data; + return ret; +} + +static int acp70_pdm_dma_hw_params(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct pdm_stream_instance *rtd; + size_t size, period_bytes; + + rtd = substream->runtime->private_data; + if (!rtd) + return -EINVAL; + size = params_buffer_bytes(params); + period_bytes = params_period_bytes(params); + rtd->dma_addr = substream->runtime->dma_addr; + rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); + acp70_config_dma(rtd, substream->stream); + acp70_init_pdm_ring_buffer(PDM_MEM_WINDOW_START, size, + period_bytes, rtd->acp70_base); + return 0; +} + +static u64 acp70_pdm_get_byte_count(struct pdm_stream_instance *rtd, + int direction) +{ + u32 high, low; + u64 byte_count; + + high = readl(rtd->acp70_base + ACP_WOV_RX_LINEARPOSITIONCNTR_HIGH); + byte_count = high; + low = readl(rtd->acp70_base + ACP_WOV_RX_LINEARPOSITIONCNTR_LOW); + byte_count = (byte_count << 32) | low; + return byte_count; +} + +static snd_pcm_uframes_t acp70_pdm_dma_pointer(struct snd_soc_component *comp, + struct snd_pcm_substream *stream) +{ + struct pdm_stream_instance *rtd; + u32 pos, buffersize; + u64 bytescount; + + rtd = stream->runtime->private_data; + buffersize = frames_to_bytes(stream->runtime, + stream->runtime->buffer_size); + bytescount = acp70_pdm_get_byte_count(rtd, stream->stream); + if (bytescount > rtd->bytescount) + bytescount -= rtd->bytescount; + pos = do_div(bytescount, buffersize); + return bytes_to_frames(stream->runtime, pos); +} + +static int acp70_pdm_dma_new(struct snd_soc_component *component, + struct snd_soc_pcm_runtime *rtd) +{ + struct device *parent = component->dev->parent; + + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + parent, MIN_BUFFER, MAX_BUFFER); + return 0; +} + +static int acp70_pdm_dma_close(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct pdm_dev_data *adata = dev_get_drvdata(component->dev); + struct snd_pcm_runtime *runtime = substream->runtime; + + acp70_disable_pdm_interrupts(adata); + adata->capture_stream = NULL; + kfree(runtime->private_data); + return 0; +} + +static int acp70_pdm_dai_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + struct pdm_stream_instance *rtd; + int ret; + bool pdm_status; + unsigned int ch_mask; + + rtd = substream->runtime->private_data; + ret = 0; + switch (substream->runtime->channels) { + case TWO_CH: + ch_mask = 0x00; + break; + default: + return -EINVAL; + } + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + writel(ch_mask, rtd->acp70_base + ACP_WOV_PDM_NO_OF_CHANNELS); + writel(PDM_DECIMATION_FACTOR, rtd->acp70_base + ACP_WOV_PDM_DECIMATION_FACTOR); + rtd->bytescount = acp70_pdm_get_byte_count(rtd, substream->stream); + pdm_status = acp70_check_pdm_dma_status(rtd->acp70_base); + if (!pdm_status) + ret = acp70_start_pdm_dma(rtd->acp70_base); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + pdm_status = acp70_check_pdm_dma_status(rtd->acp70_base); + if (pdm_status) + ret = acp70_stop_pdm_dma(rtd->acp70_base); + break; + default: + ret = -EINVAL; + break; + } + return ret; +} + +static const struct snd_soc_dai_ops acp70_pdm_dai_ops = { + .trigger = acp70_pdm_dai_trigger, +}; + static struct snd_soc_dai_driver acp70_pdm_dai_driver = { .name = "acp_acp70_pdm_dma.0", .capture = { @@ -28,10 +341,16 @@ static struct snd_soc_dai_driver acp70_pdm_dai_driver = { .rate_min = 48000, .rate_max = 48000, }, + .ops = &acp70_pdm_dai_ops, }; static const struct snd_soc_component_driver acp70_pdm_component = { .name = DRV_NAME, + .open = acp70_pdm_dma_open, + .close = acp70_pdm_dma_close, + .hw_params = acp70_pdm_dma_hw_params, + .pointer = acp70_pdm_dma_pointer, + .pcm_construct = acp70_pdm_dma_new, }; static int acp70_pdm_audio_probe(struct platform_device *pdev) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index c7cabb98cc1a..d6c99d43ed4f 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -34,6 +34,30 @@ #define ACP70_SDW_ADDR 5 #define AMD_SDW_MAX_MANAGERS 2 +#define PDM_DMA_STAT 0x10 +#define PDM_DMA_INTR_MASK 0x10000 +#define ACP_ERROR_STAT 29 +#define PDM_DECIMATION_FACTOR 2 +#define ACP_PDM_CLK_FREQ_MASK 7 +#define ACP_WOV_GAIN_CONTROL GENMASK(4, 3) +#define ACP_PDM_ENABLE 1 +#define ACP_PDM_DISABLE 0 +#define ACP_PDM_DMA_EN_STATUS 2 +#define TWO_CH 2 + +#define ACP_SRAM_PTE_OFFSET 0x03800000 +#define PAGE_SIZE_4K_ENABLE 2 +#define PDM_PTE_OFFSET 0 +#define PDM_MEM_WINDOW_START 0x4000000 + +#define CAPTURE_MIN_NUM_PERIODS 4 +#define CAPTURE_MAX_NUM_PERIODS 4 +#define CAPTURE_MAX_PERIOD_SIZE 8192 +#define CAPTURE_MIN_PERIOD_SIZE 4096 + +#define MAX_BUFFER (CAPTURE_MAX_PERIOD_SIZE * CAPTURE_MAX_NUM_PERIODS) +#define MIN_BUFFER MAX_BUFFER + enum acp_config { ACP_CONFIG_0 = 0, ACP_CONFIG_1, @@ -58,6 +82,14 @@ enum acp_config { ACP_CONFIG_20, }; +struct pdm_stream_instance { + u16 num_pages; + u16 channels; + dma_addr_t dma_addr; + u64 bytescount; + void __iomem *acp70_base; +}; + struct pdm_dev_data { u32 pdm_irq; void __iomem *acp70_base; From patchwork Thu Dec 19 05:48:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914492 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) (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 6090C216E0E; Thu, 19 Dec 2024 05:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587484; cv=fail; b=Qt07pDS82xYvzorVUJdDwieFBR4KV6amla9y1aC/nIj0I7opLrZzw4ry5O+eK0GR/2EZulTT4LxBCcnVP/qLR75qUp+S7g4PzEnVzBV+v1YIvRdwEDO7rcdg+sz0e4Du0mWiGB07gF9YcGlQWjxHAeopKi16cOkVMw5D82z1PEQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587484; c=relaxed/simple; bh=8zfMggSaGPgVOluTTFEYBg25lnFXl/2ApMT5XwS1o04=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BCF6iXZlcR5t1+1I1s3orQm4e2jgkDHdnvgTooyIaRy2U0H8u0hsAaRlc5/KPTIJAcMCjb+cfUPTlKk4h7qdgKM79uoIod548t1/W0OIvEY/CTyQDXb744osLbuc3S8n0A91N1Jdbjj8uPKPnMilfaaRX0cy+jnfBsVPJfSJKjE= 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=2h7VyBFf; arc=fail smtp.client-ip=40.107.223.85 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="2h7VyBFf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yD1FAu14qNel3ILYXfWIxkfkHmygXWH7bMvSqsBS9pXkJGWfAD9Elc6vkX8fEmVRrxANXJGJ+XmQX0l1w8aZIJOUkF951KY4yM6kmwi6XoevPvnCjR1BjJSqhsSfXgvZrtPGDWKWlNEK4XRsCy87H6WqPVksaI4xDHmHEkuF9HfJwTmYbXAcRIkwC/IjmoRF81EDSS8iy8tS+xt0i7yI0o7h4dErnFernS6K1qKf7Il1uNwF/fy+U26DyCIe51g5d2/XKjcD0mzw7Y/A8JZJRiXpv1NsREbUhaST+pi2QhfAGkCiJj1hWaA73y9/RzLk67VFu976pVp89ApLExdM2Q== 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=N0mHmi3x2XfPwnw1peF6G77Qs3/Zm4UCQI8CCkVrF5s=; b=DU9w5uMSbGJv0IhapbkPQj+c9ad7T4/xME7PZCH21t33vjyepGbMItMdBbynPpBfQZTjoAe0OW6vCRT/ldiYX5L5ah5/WQTJGnld6zUHBhK/mIySag43QPNK3TlzV4TU3+ZvoupG2tg6PK9ApELKQ3dOfHxrzrxx8+9DkK8R6sML0thOps30iurP6Rekzcm7qEL7l6ABZIE3nogrxAbVkGqsLibe1ylXQyuN0h/hKiYDcbFutPGvaTz1r03dVdfStZ3vLIkL/DOg5u78WJPlqdTHYPZUkVJO7gn65b4P+xNoizq3ime+EoNcGeO1EISce7hWNXcqgFg9RAzDVg4iqA== 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=N0mHmi3x2XfPwnw1peF6G77Qs3/Zm4UCQI8CCkVrF5s=; b=2h7VyBFfUpn9bKIo8cfXFr7mJhVE7ylKdoqW/3padYdl0ESVgY7LgflxwnW+tvQ2g5YyPL+5FXYZwiwB9ELko1j/gMmH6Jv9tlkjOTKKMTaA9oLddeplsfvRw8YoEH71u1GoUJZUeBv7CVXa42uluzgU6Uexk6oIjTvPFJDqMP0= Received: from CH5P222CA0012.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::7) by DM4PR12MB6010.namprd12.prod.outlook.com (2603:10b6:8:6a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:51:19 +0000 Received: from CH1PEPF0000AD7D.namprd04.prod.outlook.com (2603:10b6:610:1ee:cafe::f0) by CH5P222CA0012.outlook.office365.com (2603:10b6:610:1ee::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:51:19 +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 CH1PEPF0000AD7D.mail.protection.outlook.com (10.167.244.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:19 +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, 18 Dec 2024 23:51:15 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 09/21] ASoC: amd: acp70: add acp soundwire dma driver Date: Thu, 19 Dec 2024 11:18:45 +0530 Message-ID: <20241219054857.2070420-10-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7D:EE_|DM4PR12MB6010:EE_ X-MS-Office365-Filtering-Correlation-Id: 5be47e3c-f03a-44b3-d344-08dd1ff1291c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: oEyTecldwIsnC0dV6xnmaesb/Ov3UpKA2I2b7AqZd4TEbA7Q527VnIp5/i7Wz7iuG+jUph6NoPetqiuUreRVvwq0s0n/7OOtkibnTB0jJ5Cg9xYuTSh/uUQmm9VjIZ61Faaz4MrZ1zYnjMx59Nydv36jcB0RsNjkobk6Q3ZqMvLcFnCo/0WAkK+Jbf4cJQLYU1vccfSa1qidPbhM3+HN0PV41Kug0gURHXfQZCuLaDuPssA+OXeRAhYnlN7HeVcrRmoz7l1kSe8hKxYz+p4JqB/DgMwRT/szroCoaJcxhezg8o+2xsscJKRoddbe7DIUjIGLhGroH8Q3lzRzL6cHXKc00A18/d2Y7QNdCYQWRoOAOBtRReZHq27izXwPqTLHdyv8WdwmwPTtXZXYA2uyARlA0gphfgD7Oyip6T2H392BuXcwt/wP/OQWBPP2s+ICfqCnUmnWS+c7HTu9AmqdNFpwtmtvNtrcRmW7hF9EvlUCbSFVvrnOtatJh5XNftb91W/xhZ/UUvUwYcTXzNOB5P9JHHb3nBQ7DcaSlrjGaRRh6d33qKVO9Rtv4ihYAN5LxD/z/k3bIe6jfblly0oiO7ZMNZySN67vcYU6f+3fvSeE2rxT4Mkd9OLsX6ajFHZ/DSqshFKWMifin2jLbNib9g4NFLqAxVD+GDd++iP5Zjc2EOT555Lk/gEgVfgeShncxbnpi3NInlRKgZZt+Y0GMrYK4JOsTog45T8hVM7W7C23k7n88uHNpx5+5IUVtNIqF7yp2l2HXkkqtO1bQnkYyaLJqWKygDrG+7U3jyJpWGAfkQ5Uf9e0ZR+rGBi1AoTGSZeV/ObNMrFdCeOMqhQL5SUSLlc9lapMehkYmAw0rFweXaWj6+SEBVCDI7CI16hVYoRxC5fa51mA4HK4AWng/jLPadYAvjNt05GuQZY4AyA0SPliFB0PJLSwgWtUjdNqQhJwV73C+uEjaEo1i2UTxXIp0zMLxMjQXAPwwG1GmQlxJFu8sf3DVzOvpi/3kXlOqwXvvGFYvDX4ZEHhX/YjkpPlxLvGNtp51KMnVKRsA3LjP5IatppCDJU4lFEEYT2N3uFO4aRK2taWtH5zlahqbZ85VqW/QyIebNFayRgyrHb9FsDPZerb9wfta7elKTztAiNombEowvAUx5pCjzJTGwW0PEssWjphrD87r8OJ+b8I8naGTu92fmOEc0X+D3hTE/FVMUiEgLIRcbKafLI17fZTgBzLaM8enHgi4mf8mN3T7ZMuKffyQfAUnQHtbbyizGR81AYd4BpoKrgAVYhcP4iXyv23Lx4+tSz0DfzQoJpebOJK8/h5VnHd+XUZdDvejA9kKRgHUAK+ZjpHGcJM3b62i94sn0pcjIZTPVsXV89aZB4+PpTJefJJVnQlUKXl0G30XdHbL0ONa8bGyKXs6rh/71M1pjBAMtT1B7a/RZXyhNwfNmtEQbi27DBCiSFVjr0cqQ5Fs8GHqYufeKdmFA== 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)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:19.3031 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5be47e3c-f03a-44b3-d344-08dd1ff1291c 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: CH1PEPF0000AD7D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6010 SoundWire DMA platform driver binds to the platform device created by ACP PCI device. SoundWire DMA driver registers ALSA DMA component with ASoC framework. Add common SoundWire dma driver for ACP7.0 and ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/Makefile | 2 + sound/soc/amd/acp70/acp70-sdw-dma.c | 74 +++++++++++++++++++++++++++++ sound/soc/amd/acp70/acp70.h | 5 ++ 3 files changed, 81 insertions(+) create mode 100644 sound/soc/amd/acp70/acp70-sdw-dma.c diff --git a/sound/soc/amd/acp70/Makefile b/sound/soc/amd/acp70/Makefile index 778bdf268731..f3e47635558b 100644 --- a/sound/soc/amd/acp70/Makefile +++ b/sound/soc/amd/acp70/Makefile @@ -2,6 +2,8 @@ # ACP 7.0 platform Support snd-pci-acp70-y := pci-acp70.o snd-acp70-pdm-dma-y := acp70-pdm-dma.o +snd-acp70-sdw-dma-y := acp70-sdw-dma.o obj-$(CONFIG_SND_SOC_AMD_ACP70) += snd-pci-acp70.o obj-$(CONFIG_SND_SOC_AMD_ACP70) += snd-acp70-pdm-dma.o +obj-$(CONFIG_SND_SOC_AMD_ACP70) += snd-acp70-sdw-dma.o diff --git a/sound/soc/amd/acp70/acp70-sdw-dma.c b/sound/soc/amd/acp70/acp70-sdw-dma.c new file mode 100644 index 000000000000..6d748b295cb0 --- /dev/null +++ b/sound/soc/amd/acp70/acp70-sdw-dma.c @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * AMD ALSA SoC common SoundWire DMA Driver for ACP 7.0 and + * ACP 7.1 platforms. + * + * Copyright 2024 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "acp70.h" + +#define DRV_NAME "amd_acp70_sdw_dma" + +static const struct snd_soc_component_driver acp70_sdw_component = { + .name = DRV_NAME, + .use_dai_pcm_id = true, +}; + +static int acp70_sdw_platform_probe(struct platform_device *pdev) +{ + struct resource *res; + struct sdw_dma_dev_data *sdw_data; + struct acp70_dev_data *acp_data; + struct device *parent; + int status; + + parent = pdev->dev.parent; + acp_data = dev_get_drvdata(parent); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENODEV; + } + + sdw_data = devm_kzalloc(&pdev->dev, sizeof(*sdw_data), GFP_KERNEL); + if (!sdw_data) + return -ENOMEM; + + sdw_data->acp_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!sdw_data->acp_base) + return -ENOMEM; + + sdw_data->acp_lock = &acp_data->acp_lock; + dev_set_drvdata(&pdev->dev, sdw_data); + status = devm_snd_soc_register_component(&pdev->dev, + &acp70_sdw_component, + NULL, 0); + if (status) { + dev_err(&pdev->dev, "Fail to register sdw dma component\n"); + return status; + } + return 0; +} + +static struct platform_driver acp70_sdw_dma_driver = { + .probe = acp70_sdw_platform_probe, + .driver = { + .name = "amd_acp70_sdw_dma", + }, +}; + +module_platform_driver(acp70_sdw_dma_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP7.0 SDW DMA Driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index d6c99d43ed4f..c707c10c4be4 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -97,6 +97,11 @@ struct pdm_dev_data { struct snd_pcm_substream *capture_stream; }; +struct sdw_dma_dev_data { + void __iomem *acp_base; + struct mutex *acp_lock; /* used to protect acp common register access */ +}; + /** * struct acp70_dev_data - acp pci driver context * @acp70_base: acp mmio base From patchwork Thu Dec 19 05:48:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914493 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2061.outbound.protection.outlook.com [40.107.236.61]) (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 B915C217651; Thu, 19 Dec 2024 05:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587488; cv=fail; b=So3nnjqGnMzemG95keiV+QZXJVtn8dMT2W67Vhrgedk2k5rujzW6uOAFrBEB3wo3VaSXSkMZmIu8hc0o7wcfhH6DgSY+fbTcGwy0+voTtqUbn45LwwwrxDzoLv2c1T8l2R+e5HElbf3s3OqkaogIgHBX5YKiYu7521ybOzeF450= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587488; c=relaxed/simple; bh=CYHX+EwwJM53HLYs4GjJ0KgOGSVimR/OyTNhm50CRGg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=chdqQwgrOyDam6trOvLwU10xVnoom36Zk1iNqTJPU6DFFlTBq+CQ2PP+ol59y4zSVCAuanY6RzEhfP11NKiHLBliIeMgXUzykupV4l4P5wrVQsjHHf0rS9zBXfYcqSwk2xqJtFgkx/D1iPGoKJDs6EmrhCehTNB/OBH5qm8U50Y= 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=5ja9ZE+p; arc=fail smtp.client-ip=40.107.236.61 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="5ja9ZE+p" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I7+n55JwEtjIzQr9zJ6n+Xs/qMj8Q+gk86oO3eFOPAW8KQoNTcSjeUwjPpXUDD4digRiCh9hVi2330eBatHc+qvpcQ6Vc9pw0SL0yoJ/FsDHw9bWSLCE5i+FJkcPtQcVauHZDBrT4a6OK3uzx396+RtamlfZajrE248KhUnboprU7k5kYLgRpaVTUQFNnvfJCVAPnxCe3GW8+7+l8zUFPNWosX3xEB5ojhnfTKEeG4lqyENv7wsg8bhG/18CrDBgfzR6IhXKc4HZP73ak2pTz4r+YKBXZ2iY1OR9IQjZZpOky25kcVPzVHMAne/t5LGKWvHyd1gdx19jFgOnjAWk5A== 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=c8XnQZEWqTGGIli30mMhb2rL4KfNvTgzC+9DvhAG1/I=; b=EFTyW2tDOuNpdqFvlQ7woU9Hfa+05pW7lg3K2X6pgJh7bjk0piGkKO8YTqUVYNhl3UuI2R88XzWUjnqe7PcENapGU+SvhuRN/ROnXCg3i3yTrC4hJyw25sllUFBOmKuJ4alzHJwvVqiTjK9F1XxG4tkyjkUE9ASR5q7GISRLtONluVZ66Nty/iI1AIlSvYYa4vKa1N1wGqyXVEX6ObNGc+8l5B8o9QOVqjzA+KUkCu6Zsh6mAkDABx9Ne9vcL513yjLzvS5OWeoHJJAj7Bi8fsoNI94O4iHVOU04fnlcgTqCrKuEZ6YQfeQhUzP9sOfmgDLBUkL53M30p07zRee6Wg== 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=c8XnQZEWqTGGIli30mMhb2rL4KfNvTgzC+9DvhAG1/I=; b=5ja9ZE+pVgb8owAFTWd1bHK4YOy58qf1bxInDWmU842ONJZ4xnlyth9zlJvUQSTUDubZVLqcnN5j2ErQ6qM3bCdYzCEXycF231KAPn5R4Fwqpif3rnGii6hOtaUMkwaLEyVHoMKTH4hgm5Y0t63URKz4cXUccb3M9+1PCICzEQE= Received: from CH0PR03CA0017.namprd03.prod.outlook.com (2603:10b6:610:b0::22) by SA1PR12MB8841.namprd12.prod.outlook.com (2603:10b6:806:376::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:51:22 +0000 Received: from CH1PEPF0000AD7E.namprd04.prod.outlook.com (2603:10b6:610:b0:cafe::2) by CH0PR03CA0017.outlook.office365.com (2603:10b6:610:b0::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8158.24 via Frontend Transport; Thu, 19 Dec 2024 05:51:22 +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 CH1PEPF0000AD7E.mail.protection.outlook.com (10.167.244.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:22 +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, 18 Dec 2024 23:51:19 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 10/21] ASoC: amd: update ACP7.0 KConfig option description Date: Thu, 19 Dec 2024 11:18:46 +0530 Message-ID: <20241219054857.2070420-11-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7E:EE_|SA1PR12MB8841:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b8f9f89-b2b9-4aad-acb4-08dd1ff12b17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: KpWtNiW2h8nxWpk+ndQFLu5i7Os9pKDQEw3IdblYwrUPet1mASeKzbYSj2SPGMZ3QrCWalcjFs5/WwYoB294OHzVSXwrNV46baX8dBPdLUxkSoUKuYSYNEB5vg1ajJ72HHIxQh4v9uIt0NXQHwgcm54ho4uMWnX9lkWnxwvYcIG1dXmLgi0TRwGyYXGPS5z0Hf9NUMAmMEdwvKB8NfpKJ+dRo2TdrAmCfvcBypafaoqHiHhwoKZVWeQnUuTsKWkqBJDMfOvuOzPgRqMGAVWC4Xg3kKpj+gY0TLh2x0N2nMgq3pcPBeUCdrBqpYezKE84w91vtPRUYXCeVWKBVUsw5hVZ7ZWTiDWMwHuvQDViRXkC6Pq7bitBZ0q1+u4jX8615jVSVzSvyDV8fARoWGYkavXSBJKTpZ4DEK25jxHUcIBC7f/CKZEC3XS5J1HwhQ36ELoAhkbMFPPe5MOd6Pnbl1HtqubYx1TNKS4W7JWjDxkbcK+LKTVGE0BAMhrDXHF7cgyBLI5ervcaZYTnMpWtqCFNruYTwa3NX2Y2Lq2yNeGqemmnwGvM299XFsnsiwF8oDGj6qHAOuMAApINoXwOfv2+Y1Cc1dGJd7zQW9PK4fjMZL36GgBwRn4R6h/22Zr9F1ESGT2PvV0zvIqcXDD4FTE7ifFauTth8tMN2NRznUyE4QLe2Vc64xgbV0zUu5DRQWt4sriLl+yyAcKfDEDSNZSfNh/Xxyvu7W38arTrx2EciDXFuiN6BS0sKsp+Ptfnrc74mnwBe/8Qqac8rI7Wm3mgQf38nVvHu8VTSOJewLbs9tj2tCgZyLNCnGB+Ixt4jj6qJZ7ZbjzypyDyyC+7omJG6S+WDesXAvRX0IOBiF9uRw+xuC1ZFB6YOn7zOWYaMYca7mfEHUAMJUpg7AZhC1AIAHj50h5oUcdOzTM/YXquJeLR1d3ZhLPp5Cto6HdEzLXvr6HxV5ntEWIgqGtceUXlfFJIQ5ZZKTzRimPuXPbpWt9mLLohUj/EOMl67pZrr/VLT1wdCzdexJF6AksHixmCrIb01yQLvkzLYf85kcxkk/vLUHyoZfKa0OYmVlPlg6yN+ESYTBSaicSM581EDFQ7lhHck2BqAr+nQuFkxzv+twwScYwacbQCcpGAHp4bB7NXBrrTQvcgxg3d/CcEasbP7J14haEmRXyWNAteZ5vSdoHiP+ZNXO+sCXtZ0ur0LBDBldiChkPWX9AP2NJgshooxmCNba4d0tLo5OKmxVfPiQWa0lwCpkZCG93nYVhroKYn10qQWSjTb8rQ3rTucXXtYzwU25VXrLPU1ZXej2ED5j0IdrvyvZZbN2q0RBjSg4yN2QANhSGqICz3E58lHfiE33apKN3vyGNpgaF//+bVDKMBs/878xei1glZEHNABaSjsn01f49I7UvM0cs3sCuFqTOPTGezUDaBt1eTxrLXfwbhhCAPsDqFIhp+3SbiVSsBA+Bw6AvsPAV0PH9XblnatUWhJ7C3mr/PKam+SL0= 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)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:22.6092 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b8f9f89-b2b9-4aad-acb4-08dd1ff12b17 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: CH1PEPF0000AD7E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8841 Update Kconfig option description for "SND_SOC_AMD_ACP70". Signed-off-by: Vijendar Mukunda --- sound/soc/amd/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index 9d8114909eb5..57743bc4fcea 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -190,7 +190,8 @@ config SND_SOC_AMD_ACP70 depends on X86 && PCI && ACPI help This option enables Audio Coprocessor i.e ACP v7.0 support. - By enabling this flag build will be triggered for ACP PCI driver. + By enabling this flag build will be triggered for ACP PCI driver, + ACP PDM DMA driver, ACP SoundWire DMA driver. Say m if you have such a device. If unsure select "N". From patchwork Thu Dec 19 05:48:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914494 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2055.outbound.protection.outlook.com [40.107.244.55]) (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 2842F217651; Thu, 19 Dec 2024 05:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587494; cv=fail; b=tVpQ+XS5p11iheKPALNqLMycYaXpHXhfQRLvkuwNxqe2r1dw7AmGwG58ogs/6i+bMjp6eagAw49w6dV/TxsaqgoJXDJKd4p/WW+iORF3uHTGlS9JIXMSYuapOYMuFfx5en9hzHPV7gxR7N+zkli3ICDlEuxBJQOl36VpnXN1lWQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587494; c=relaxed/simple; bh=VWcygLyxk3dKd5f2rSPJKHmqutOXHGarh/Ucs3TexFc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sEyzTwOaPsJ+OHDnpJ8r0i0Or/g8p++oPJhJFb1zecCwpv5AXv29kRck5eD0hOZsj8BeuJsqCAnVs5NXnZo+5cQGHb10M41e8nilH13FljCRt7ByV0Iuzpjt7wBrwNX0ONDh7iv0LQcJJZ/RrT47ePIJjqxOUlI8+VoJw5gaErc= 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=xVO7bFz/; arc=fail smtp.client-ip=40.107.244.55 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="xVO7bFz/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DLQ/afIQ2qUNGqgvdl3ZNpMTeLE7RHfTe8SVKtAEMTP7fKfCQO5GY9uzY3jmk/OwpPD2mOjVGKyPujJOmINDnZvNA0C4kCcXxidCW9LhkH577/13xjSOPfm0oUrfaUnixXTkVkuaxaetqXSVVxyfKvNGvO1GUL8ViVzVoqNjaq69AIn3+oUe8zevlTZ9KG6nWJdtDOpjwOom3mBzrvcGoniusN2KzPKBEN7HwqUyP0WHahwJSPgYYv7s2Mv09d5UEd1k3di6RPg/hzxTvEBcmWFgmRRF7L9bhofLwcGwre/55o/zXICfLXsnk2AqWRWwXaiZgn1Q0pb3iIyr9fC1sA== 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=B1TNG6cFjI8nSJJv9jCpoQmJV9lD6JqbzsO99PpApSo=; b=l+RuRm0o9aPrUO2fvrTsLWc7chcSb3J614M98zIJIe3dv02AqNJRS2JpFimuqN1LD/9kZ89zhN6uKh44gTG4SqXEJFyeUXHFZ2YbZszvO+SRLDpkSwkMC7flZvlaK1ZqnvTKHL9Q/COjecNoMR6NuUqORJSyIZ55n/ZMMRLOXmvbT658JXQj7rJVdTnhN1EDLIpHARRjBZjaZlkySuEkTmVKfpvXyNwQKAANFLgXphBPJaM+ocpjNgL4j2oJSqoyMOENEut80Ac+9NLqps9XrVKbvwnzYuX/Ly1tj4EnVTtYXtcUb/NEEAH7Ni1TPDa3GAM8HJsIwevZQlyLGJrTXA== 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=B1TNG6cFjI8nSJJv9jCpoQmJV9lD6JqbzsO99PpApSo=; b=xVO7bFz/N0cC6xwlu2Vh8B84pEYF74s5ujQoGZDXgtWUbu8Fy1hBVf+DMxPsnHMSBBdn3suxmCPPNbkRFlZX6F0MX1zoQnqzLr+SV+fr0/E8z2AyyR5O8xlk3g97bEWcJAcpMxjmPYyfN+j3vgY6Dew0f0FCPXdplkV/qwOiGrw= Received: from CH2PR18CA0040.namprd18.prod.outlook.com (2603:10b6:610:55::20) by DM4PR12MB6566.namprd12.prod.outlook.com (2603:10b6:8:8d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:51:27 +0000 Received: from CH1PEPF0000AD81.namprd04.prod.outlook.com (2603:10b6:610:55:cafe::a4) by CH2PR18CA0040.outlook.office365.com (2603:10b6:610:55::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.22 via Frontend Transport; Thu, 19 Dec 2024 05:51:27 +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 CH1PEPF0000AD81.mail.protection.outlook.com (10.167.244.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:27 +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, 18 Dec 2024 23:51:22 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 11/21] ASoC: amd: acp70: add soundwire dma driver dma ops Date: Thu, 19 Dec 2024 11:18:47 +0530 Message-ID: <20241219054857.2070420-12-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD81:EE_|DM4PR12MB6566:EE_ X-MS-Office365-Filtering-Correlation-Id: dd331ce3-e428-4879-cc6c-08dd1ff12dd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: 2Gy2XjmsVVJUz2LvzGGnORReUmLBsb9rEOgApNtu2gb6bgFT6gfvpkxmnSir/dvxJs65CMixKYDuhmV9V8j9pFgWrqQLL1VaXh7IkZ7JzeSxzZS7oaIqHGjsV3TOrkyXJ+MtmHXpDmQ55o5wLXZnzm11JaeUVMvIxt//GzQ140qGP0MIB7kfjaHN3uJNO1FSBxEQfjMjzyZStAc/yGIxUDzi75el1B1/Qvwghy+XcdIDZcDrC2elPdgLQ87jxoGqIboMJrdumvUY//iUKqmYG+Sz0psFmmk8gFv3IbiNDR6o9Rb06T65cFz6RR9N9lDXrEyhtU2cTgpRpHD0y4QeNUjSt9xxbAgWBoBhbsu6xxTdabZrGwa6C+GuD9hOfeAlxnbmpBleiSx8a+t7bIogBsaIuc3zetqZC/5FZSI4JiprDQGbiYEb8F+S/gVEEuAeVKTVjePfI+IkghX0iuiqIUg8d/eJ7fhlkKLOXDxb9ONdOpmlOb6N4OR4f8C+E1bTghXXVAPiR7/GFrcYgpLcfgWSPKOn4irUZZx+bF6YQRDd+B0DkdlmCqA1Te2wIPYkflQLGc7qBe+pKbZ9iTdMUrlLCkS2oTYIsn+xCj3+dZAf9xoXqoITBlpY/StDRlZhaUNJ5iEsk+Hd8K9gL8zfccEZXs0K0+HqD0X357RHMko0uWvXZYm8r1MY/g/5efPSJidQ6dUr75XhXzRDv4Xu2pwtQOh2hZf+vgIUouSn1gcJ6W6WTtSKEfzkve4pugWdOvuRSOEeEKt6f8bAvGHue4MkO2PU70LAl8NmkcvbeR5RM3x7mpDsYU8oCWwphokVUzG3RQWoa2wa20UJeBrxNJ4CLBmqZO/JgrT5PVyhLXVK/DWrt0fcNkQTf6IgopE4jnIWNbVCctBCW73QV9FZe4CZV3Q7nHxpLbnEBS8//tM4IsVPZOrxEsDH74YzRJfs3dduaQ+ewBirvRgXaGXZ2a4GpcTjmnl0ZcGlJuIF33SJfqw67FK4VM3nI25WX5a5M/OUxJLhnV3Vg3uHPwT6ROhrkVPPlApVGn/WsSAqNKbNGgPTcQ8f9tyhkQuloLVv9FkuGwsl2F8Nw9xeKm+wW3YAR+Tn2VnI++ubuaj18a3xBOZ9xfCZxndMonwFz9JgwjiIi/+77XvoNgiM00Rv71Ur5JDbvMgdP/m77iXa4//ppJRtVPQJGC0SlgBj7N2obxSlZRMYKSJioDW1tkeIk6ED1JJgNedsnkO6dARdzdCzVxfhLGK5008w8WP8yVN/wHzGHfA8/wk9whFe2niIUBQWtptkHVljc92NuKh2KJYCNnfg3oWPoFK1n8S4I4ZIIWpkjjECZ7EDXfwNx2WDUkOVxa6Xjl0e5jmNOrg7xBCVZcBG3qUm8NKnaOriFdEsYZjwM8Ndr7p/3dDnA8MgZxy/1pr85Hg+1iKtTpSLB+Dp3T2P58v207YIH6JyZIO00y6anYjYZzW/Y/GEzuOR+EA70JsSb0v/mdtpmmLFhgQ= 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)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:27.2106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd331ce3-e428-4879-cc6c-08dd1ff12dd5 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: CH1PEPF0000AD81.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6566 Add SoundWire dma driver dma ops for ACP7.0 and ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70-sdw-dma.c | 420 ++++++++++++++++++++++++++++ sound/soc/amd/acp70/acp70.h | 123 ++++++++ 2 files changed, 543 insertions(+) diff --git a/sound/soc/amd/acp70/acp70-sdw-dma.c b/sound/soc/amd/acp70/acp70-sdw-dma.c index 6d748b295cb0..2c01f60cf3b9 100644 --- a/sound/soc/amd/acp70/acp70-sdw-dma.c +++ b/sound/soc/amd/acp70/acp70-sdw-dma.c @@ -18,8 +18,428 @@ #define DRV_NAME "amd_acp70_sdw_dma" +static struct sdw_dma_ring_buf_reg sdw0_dma_ring_buf_reg[ACP70_SDW0_DMA_MAX_STREAMS] = { + {ACP_AUDIO0_TX_DMA_SIZE, ACP_AUDIO0_TX_FIFOADDR, ACP_AUDIO0_TX_FIFOSIZE, + ACP_AUDIO0_TX_RINGBUFSIZE, ACP_AUDIO0_TX_RINGBUFADDR, ACP_AUDIO0_TX_INTR_WATERMARK_SIZE, + ACP_AUDIO0_TX_LINEARPOSITIONCNTR_LOW, ACP_AUDIO0_TX_LINEARPOSITIONCNTR_HIGH}, + {ACP_AUDIO1_TX_DMA_SIZE, ACP_AUDIO1_TX_FIFOADDR, ACP_AUDIO1_TX_FIFOSIZE, + ACP_AUDIO1_TX_RINGBUFSIZE, ACP_AUDIO1_TX_RINGBUFADDR, ACP_AUDIO1_TX_INTR_WATERMARK_SIZE, + ACP_AUDIO1_TX_LINEARPOSITIONCNTR_LOW, ACP_AUDIO1_TX_LINEARPOSITIONCNTR_HIGH}, + {ACP_AUDIO2_TX_DMA_SIZE, ACP_AUDIO2_TX_FIFOADDR, ACP_AUDIO2_TX_FIFOSIZE, + ACP_AUDIO2_TX_RINGBUFSIZE, ACP_AUDIO2_TX_RINGBUFADDR, ACP_AUDIO2_TX_INTR_WATERMARK_SIZE, + ACP_AUDIO2_TX_LINEARPOSITIONCNTR_LOW, ACP_AUDIO2_TX_LINEARPOSITIONCNTR_HIGH}, + {ACP_AUDIO0_RX_DMA_SIZE, ACP_AUDIO0_RX_FIFOADDR, ACP_AUDIO0_RX_FIFOSIZE, + ACP_AUDIO0_RX_RINGBUFSIZE, ACP_AUDIO0_RX_RINGBUFADDR, ACP_AUDIO0_RX_INTR_WATERMARK_SIZE, + ACP_AUDIO0_RX_LINEARPOSITIONCNTR_LOW, ACP_AUDIO0_RX_LINEARPOSITIONCNTR_HIGH}, + {ACP_AUDIO1_RX_DMA_SIZE, ACP_AUDIO1_RX_FIFOADDR, ACP_AUDIO1_RX_FIFOSIZE, + ACP_AUDIO1_RX_RINGBUFSIZE, ACP_AUDIO1_RX_RINGBUFADDR, ACP_AUDIO1_RX_INTR_WATERMARK_SIZE, + ACP_AUDIO1_RX_LINEARPOSITIONCNTR_LOW, ACP_AUDIO1_RX_LINEARPOSITIONCNTR_HIGH}, + {ACP_AUDIO2_RX_DMA_SIZE, ACP_AUDIO2_RX_FIFOADDR, ACP_AUDIO2_RX_FIFOSIZE, + ACP_AUDIO2_RX_RINGBUFSIZE, ACP_AUDIO2_RX_RINGBUFADDR, ACP_AUDIO2_RX_INTR_WATERMARK_SIZE, + ACP_AUDIO2_RX_LINEARPOSITIONCNTR_LOW, ACP_AUDIO2_RX_LINEARPOSITIONCNTR_HIGH} +}; + +static struct sdw_dma_ring_buf_reg sdw1_dma_ring_buf_reg[ACP70_SDW1_DMA_MAX_STREAMS] = { + {ACP_P1_AUDIO0_TX_DMA_SIZE, ACP_P1_AUDIO0_TX_FIFOADDR, ACP_P1_AUDIO0_TX_FIFOSIZE, + ACP_P1_AUDIO0_TX_RINGBUFSIZE, ACP_P1_AUDIO0_TX_RINGBUFADDR, + ACP_P1_AUDIO0_TX_INTR_WATERMARK_SIZE, + ACP_P1_AUDIO0_TX_LINEARPOSITIONCNTR_LOW, ACP_P1_AUDIO0_TX_LINEARPOSITIONCNTR_HIGH}, + {ACP_P1_AUDIO1_TX_DMA_SIZE, ACP_P1_AUDIO1_TX_FIFOADDR, ACP_P1_AUDIO1_TX_FIFOSIZE, + ACP_P1_AUDIO1_TX_RINGBUFSIZE, ACP_P1_AUDIO1_TX_RINGBUFADDR, + ACP_P1_AUDIO1_TX_INTR_WATERMARK_SIZE, + ACP_P1_AUDIO1_TX_LINEARPOSITIONCNTR_LOW, ACP_P1_AUDIO1_TX_LINEARPOSITIONCNTR_HIGH}, + {ACP_P1_AUDIO2_TX_DMA_SIZE, ACP_P1_AUDIO2_TX_FIFOADDR, ACP_P1_AUDIO2_TX_FIFOSIZE, + ACP_P1_AUDIO2_TX_RINGBUFSIZE, ACP_P1_AUDIO2_TX_RINGBUFADDR, + ACP_P1_AUDIO2_TX_INTR_WATERMARK_SIZE, + ACP_P1_AUDIO2_TX_LINEARPOSITIONCNTR_LOW, ACP_P1_AUDIO2_TX_LINEARPOSITIONCNTR_HIGH}, + {ACP_P1_AUDIO0_RX_DMA_SIZE, ACP_P1_AUDIO0_RX_FIFOADDR, ACP_P1_AUDIO0_RX_FIFOSIZE, + ACP_P1_AUDIO0_RX_RINGBUFSIZE, ACP_P1_AUDIO0_RX_RINGBUFADDR, + ACP_P1_AUDIO0_RX_INTR_WATERMARK_SIZE, + ACP_P1_AUDIO0_RX_LINEARPOSITIONCNTR_LOW, ACP_P1_AUDIO0_RX_LINEARPOSITIONCNTR_HIGH}, + {ACP_P1_AUDIO1_RX_DMA_SIZE, ACP_P1_AUDIO1_RX_FIFOADDR, ACP_P1_AUDIO1_RX_FIFOSIZE, + ACP_P1_AUDIO1_RX_RINGBUFSIZE, ACP_P1_AUDIO1_RX_RINGBUFADDR, + ACP_P1_AUDIO1_RX_INTR_WATERMARK_SIZE, + ACP_P1_AUDIO1_RX_LINEARPOSITIONCNTR_LOW, ACP_P1_AUDIO1_RX_LINEARPOSITIONCNTR_HIGH}, + {ACP_P1_AUDIO2_RX_DMA_SIZE, ACP_P1_AUDIO2_RX_FIFOADDR, ACP_P1_AUDIO2_RX_FIFOSIZE, + ACP_P1_AUDIO2_RX_RINGBUFSIZE, ACP_P1_AUDIO2_RX_RINGBUFADDR, + ACP_P1_AUDIO2_RX_INTR_WATERMARK_SIZE, + ACP_P1_AUDIO2_RX_LINEARPOSITIONCNTR_LOW, ACP_P1_AUDIO2_RX_LINEARPOSITIONCNTR_HIGH} +}; + +static u32 sdw0_dma_enable_reg[ACP70_SDW0_DMA_MAX_STREAMS] = { + ACP_SW0_AUDIO0_TX_EN, + ACP_SW0_AUDIO1_TX_EN, + ACP_SW0_AUDIO2_TX_EN, + ACP_SW0_AUDIO0_RX_EN, + ACP_SW0_AUDIO1_RX_EN, + ACP_SW0_AUDIO2_RX_EN, +}; + +#define ACP_SW1_AUDIO0_TX_EN 0x0003C10 +#define ACP_SW1_AUDIO2_TX_EN 0x0003C6C +#define ACP_SW1_AUDIO0_RX_EN 0x0003C88 +#define ACP_SW1_AUDIO2_RX_EN 0x0003D44 + +static u32 sdw1_dma_enable_reg[ACP70_SDW1_DMA_MAX_STREAMS] = { + ACP_SW1_AUDIO0_TX_EN, + ACP_SW1_AUDIO1_TX_EN, + ACP_SW1_AUDIO2_TX_EN, + ACP_SW1_AUDIO0_RX_EN, + ACP_SW1_AUDIO1_RX_EN, + ACP_SW1_AUDIO2_RX_EN, +}; + +static const struct snd_pcm_hardware acp70_sdw_hardware_playback = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .buffer_bytes_max = SDW_PLAYBACK_MAX_NUM_PERIODS * SDW_PLAYBACK_MAX_PERIOD_SIZE, + .period_bytes_min = SDW_PLAYBACK_MIN_PERIOD_SIZE, + .period_bytes_max = SDW_PLAYBACK_MAX_PERIOD_SIZE, + .periods_min = SDW_PLAYBACK_MIN_NUM_PERIODS, + .periods_max = SDW_PLAYBACK_MAX_NUM_PERIODS, +}; + +static const struct snd_pcm_hardware acp70_sdw_hardware_capture = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .buffer_bytes_max = SDW_CAPTURE_MAX_NUM_PERIODS * SDW_CAPTURE_MAX_PERIOD_SIZE, + .period_bytes_min = SDW_CAPTURE_MIN_PERIOD_SIZE, + .period_bytes_max = SDW_CAPTURE_MAX_PERIOD_SIZE, + .periods_min = SDW_CAPTURE_MIN_NUM_PERIODS, + .periods_max = SDW_CAPTURE_MAX_NUM_PERIODS, +}; + +static void acp70_config_dma(struct acp_sdw_dma_stream *stream, void __iomem *acp_base, + u32 stream_id) +{ + u16 page_idx; + u32 low, high, val; + u32 sdw_dma_pte_offset; + dma_addr_t addr; + + addr = stream->dma_addr; + sdw_dma_pte_offset = SDW_PTE_OFFSET(stream->instance); + val = sdw_dma_pte_offset + (stream_id * ACP_SDW_PTE_OFFSET); + + /* Group Enable */ + writel(ACP_SDW_SRAM_PTE_OFFSET | BIT(31), acp_base + ACPAXI2AXI_ATU_BASE_ADDR_GRP_2); + writel(PAGE_SIZE_4K_ENABLE, acp_base + ACPAXI2AXI_ATU_PAGE_SIZE_GRP_2); + for (page_idx = 0; page_idx < stream->num_pages; page_idx++) { + /* Load the low address of page int ACP SRAM through SRBM */ + low = lower_32_bits(addr); + high = upper_32_bits(addr); + + writel(low, acp_base + ACP_SCRATCH_REG_0 + val); + high |= BIT(31); + writel(high, acp_base + ACP_SCRATCH_REG_0 + val + 4); + val += 8; + addr += PAGE_SIZE; + } + writel(0x1, acp_base + ACPAXI2AXI_ATU_CTRL); +} + +static int acp70_configure_sdw_ringbuffer(void __iomem *acp_base, u32 stream_id, u32 size, + u32 manager_instance) +{ + u32 reg_dma_size; + u32 reg_fifo_addr; + u32 reg_fifo_size; + u32 reg_ring_buf_size; + u32 reg_ring_buf_addr; + u32 sdw_fifo_addr; + u32 sdw_fifo_offset; + u32 sdw_ring_buf_addr; + u32 sdw_ring_buf_size; + u32 sdw_mem_window_offset; + + switch (manager_instance) { + case ACP_SDW0: + reg_dma_size = sdw0_dma_ring_buf_reg[stream_id].reg_dma_size; + reg_fifo_addr = sdw0_dma_ring_buf_reg[stream_id].reg_fifo_addr; + reg_fifo_size = sdw0_dma_ring_buf_reg[stream_id].reg_fifo_size; + reg_ring_buf_size = sdw0_dma_ring_buf_reg[stream_id].reg_ring_buf_size; + reg_ring_buf_addr = sdw0_dma_ring_buf_reg[stream_id].reg_ring_buf_addr; + break; + case ACP_SDW1: + reg_dma_size = sdw1_dma_ring_buf_reg[stream_id].reg_dma_size; + reg_fifo_addr = sdw1_dma_ring_buf_reg[stream_id].reg_fifo_addr; + reg_fifo_size = sdw1_dma_ring_buf_reg[stream_id].reg_fifo_size; + reg_ring_buf_size = sdw1_dma_ring_buf_reg[stream_id].reg_ring_buf_size; + reg_ring_buf_addr = sdw1_dma_ring_buf_reg[stream_id].reg_ring_buf_addr; + break; + default: + return -EINVAL; + } + sdw_fifo_offset = ACP_SDW_FIFO_OFFSET(manager_instance); + sdw_mem_window_offset = SDW_MEM_WINDOW_START(manager_instance); + sdw_fifo_addr = sdw_fifo_offset + (stream_id * SDW_FIFO_OFFSET); + sdw_ring_buf_addr = sdw_mem_window_offset + (stream_id * ACP_SDW_RING_BUFF_ADDR_OFFSET); + sdw_ring_buf_size = size; + writel(sdw_ring_buf_size, acp_base + reg_ring_buf_size); + writel(sdw_ring_buf_addr, acp_base + reg_ring_buf_addr); + writel(sdw_fifo_addr, acp_base + reg_fifo_addr); + writel(SDW_DMA_SIZE, acp_base + reg_dma_size); + writel(SDW_FIFO_SIZE, acp_base + reg_fifo_size); + return 0; +} + +static int acp70_sdw_dma_open(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + struct acp_sdw_dma_stream *stream; + struct snd_soc_dai *cpu_dai; + struct amd_sdw_manager *amd_manager; + struct snd_soc_pcm_runtime *prtd = substream->private_data; + int ret; + + runtime = substream->runtime; + cpu_dai = snd_soc_rtd_to_cpu(prtd, 0); + amd_manager = snd_soc_dai_get_drvdata(cpu_dai); + stream = kzalloc(sizeof(*stream), GFP_KERNEL); + if (!stream) + return -ENOMEM; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + runtime->hw = acp70_sdw_hardware_playback; + else + runtime->hw = acp70_sdw_hardware_capture; + ret = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (ret < 0) { + dev_err(component->dev, "set integer constraint failed\n"); + kfree(stream); + return ret; + } + + stream->stream_id = cpu_dai->id; + stream->instance = amd_manager->instance; + runtime->private_data = stream; + return ret; +} + +static int acp70_sdw_dma_hw_params(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct acp_sdw_dma_stream *stream; + struct sdw_dma_dev_data *sdw_data; + u32 period_bytes; + u32 water_mark_size_reg; + u32 irq_mask, ext_intr_ctrl; + u64 size; + u32 stream_id; + u32 acp_ext_intr_cntl_reg; + int ret; + + sdw_data = dev_get_drvdata(component->dev); + stream = substream->runtime->private_data; + if (!stream) + return -EINVAL; + stream_id = stream->stream_id; + switch (stream->instance) { + case ACP_SDW0: + sdw_data->sdw0_dma_stream[stream_id] = substream; + water_mark_size_reg = sdw0_dma_ring_buf_reg[stream_id].water_mark_size_reg; + acp_ext_intr_cntl_reg = ACP_EXTERNAL_INTR_CNTL; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + irq_mask = BIT(SDW0_DMA_TX_IRQ_MASK(stream_id)); + else + irq_mask = BIT(SDW0_DMA_RX_IRQ_MASK(stream_id)); + break; + case ACP_SDW1: + sdw_data->sdw1_dma_stream[stream_id] = substream; + acp_ext_intr_cntl_reg = ACP_EXTERNAL_INTR_CNTL1; + water_mark_size_reg = sdw1_dma_ring_buf_reg[stream_id].water_mark_size_reg; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + irq_mask = BIT(SDW1_DMA_TX_IRQ_MASK(stream_id)); + else + irq_mask = BIT(SDW1_DMA_RX_IRQ_MASK(stream_id)); + + break; + default: + return -EINVAL; + } + size = params_buffer_bytes(params); + period_bytes = params_period_bytes(params); + stream->dma_addr = substream->runtime->dma_addr; + stream->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); + acp70_config_dma(stream, sdw_data->acp_base, stream_id); + ret = acp70_configure_sdw_ringbuffer(sdw_data->acp_base, stream_id, size, + stream->instance); + if (ret) { + dev_err(component->dev, "Invalid DMA channel\n"); + return -EINVAL; + } + ext_intr_ctrl = readl(sdw_data->acp_base + acp_ext_intr_cntl_reg); + ext_intr_ctrl |= irq_mask; + writel(ext_intr_ctrl, sdw_data->acp_base + acp_ext_intr_cntl_reg); + writel(period_bytes, sdw_data->acp_base + water_mark_size_reg); + return 0; +} + +static u64 acp70_sdw_get_byte_count(struct acp_sdw_dma_stream *stream, void __iomem *acp_base) +{ + union acp_sdw_dma_count byte_count; + u32 pos_low_reg, pos_high_reg; + + byte_count.bytescount = 0; + switch (stream->instance) { + case ACP_SDW0: + pos_low_reg = sdw0_dma_ring_buf_reg[stream->stream_id].pos_low_reg; + pos_high_reg = sdw0_dma_ring_buf_reg[stream->stream_id].pos_high_reg; + break; + case ACP_SDW1: + pos_low_reg = sdw1_dma_ring_buf_reg[stream->stream_id].pos_low_reg; + pos_high_reg = sdw1_dma_ring_buf_reg[stream->stream_id].pos_high_reg; + break; + default: + goto POINTER_RETURN_BYTES; + } + if (pos_low_reg) { + byte_count.bcount.high = readl(acp_base + pos_high_reg); + byte_count.bcount.low = readl(acp_base + pos_low_reg); + } +POINTER_RETURN_BYTES: + return byte_count.bytescount; +} + +static snd_pcm_uframes_t acp70_sdw_dma_pointer(struct snd_soc_component *comp, + struct snd_pcm_substream *substream) +{ + struct sdw_dma_dev_data *sdw_data; + struct acp_sdw_dma_stream *stream; + u32 pos, buffersize; + u64 bytescount; + + sdw_data = dev_get_drvdata(comp->dev); + stream = substream->runtime->private_data; + buffersize = frames_to_bytes(substream->runtime, + substream->runtime->buffer_size); + bytescount = acp70_sdw_get_byte_count(stream, sdw_data->acp_base); + if (bytescount > stream->bytescount) + bytescount -= stream->bytescount; + pos = do_div(bytescount, buffersize); + return bytes_to_frames(substream->runtime, pos); +} + +static int acp70_sdw_dma_new(struct snd_soc_component *component, + struct snd_soc_pcm_runtime *rtd) +{ + struct device *parent = component->dev->parent; + + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + parent, SDW_MIN_BUFFER, SDW_MAX_BUFFER); + return 0; +} + +static int acp70_sdw_dma_close(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct sdw_dma_dev_data *sdw_data; + struct acp_sdw_dma_stream *stream; + + sdw_data = dev_get_drvdata(component->dev); + stream = substream->runtime->private_data; + if (!stream) + return -EINVAL; + switch (stream->instance) { + case ACP_SDW0: + sdw_data->sdw0_dma_stream[stream->stream_id] = NULL; + break; + case ACP_SDW1: + sdw_data->sdw1_dma_stream[stream->stream_id] = NULL; + break; + default: + return -EINVAL; + } + kfree(stream); + return 0; +} + +static int acp70_sdw_dma_enable(struct snd_pcm_substream *substream, + void __iomem *acp_base, bool sdw_dma_enable) +{ + struct acp_sdw_dma_stream *stream; + u32 stream_id; + u32 sdw_dma_en_reg; + u32 sdw_dma_en_stat_reg; + u32 sdw_dma_stat; + u32 dma_enable; + + stream = substream->runtime->private_data; + stream_id = stream->stream_id; + switch (stream->instance) { + case ACP_SDW0: + sdw_dma_en_reg = sdw0_dma_enable_reg[stream_id]; + break; + case ACP_SDW1: + sdw_dma_en_reg = sdw1_dma_enable_reg[stream_id]; + break; + default: + return -EINVAL; + } + sdw_dma_en_stat_reg = sdw_dma_en_reg + 4; + dma_enable = sdw_dma_enable; + writel(dma_enable, acp_base + sdw_dma_en_reg); + return readl_poll_timeout(acp_base + sdw_dma_en_stat_reg, sdw_dma_stat, + (sdw_dma_stat == dma_enable), ACP_DELAY_US, ACP_COUNTER); +} + +static int acp70_sdw_dma_trigger(struct snd_soc_component *comp, + struct snd_pcm_substream *substream, + int cmd) +{ + struct sdw_dma_dev_data *sdw_data; + int ret; + + sdw_data = dev_get_drvdata(comp->dev); + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + case SNDRV_PCM_TRIGGER_RESUME: + ret = acp70_sdw_dma_enable(substream, sdw_data->acp_base, true); + break; + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_STOP: + ret = acp70_sdw_dma_enable(substream, sdw_data->acp_base, false); + break; + default: + ret = -EINVAL; + } + if (ret) + dev_err(comp->dev, "trigger %d failed: %d", cmd, ret); + return ret; +} + static const struct snd_soc_component_driver acp70_sdw_component = { .name = DRV_NAME, + .open = acp70_sdw_dma_open, + .close = acp70_sdw_dma_close, + .hw_params = acp70_sdw_dma_hw_params, + .trigger = acp70_sdw_dma_trigger, + .pointer = acp70_sdw_dma_pointer, + .pcm_construct = acp70_sdw_dma_new, .use_dai_pcm_id = true, }; diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index c707c10c4be4..a96b021e64da 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -58,6 +58,81 @@ #define MAX_BUFFER (CAPTURE_MAX_PERIOD_SIZE * CAPTURE_MAX_NUM_PERIODS) #define MIN_BUFFER MAX_BUFFER +#define ACP_SDW0_STAT BIT(21) +#define ACP_SDW1_STAT BIT(2) +#define ACP_ERROR_IRQ BIT(29) + +#define ACP_AUDIO0_TX_THRESHOLD 0x1c +#define ACP_AUDIO1_TX_THRESHOLD 0x1a +#define ACP_AUDIO2_TX_THRESHOLD 0x18 +#define ACP_AUDIO0_RX_THRESHOLD 0x1b +#define ACP_AUDIO1_RX_THRESHOLD 0x19 +#define ACP_AUDIO2_RX_THRESHOLD 0x17 +#define ACP_P1_AUDIO0_TX_THRESHOLD 0x8 +#define ACP_P1_AUDIO1_TX_THRESHOLD 0x6 +#define ACP_P1_AUDIO2_TX_THRESHOLD 0x4 +#define ACP_P1_AUDIO0_RX_THRESHOLD 0x7 +#define ACP_P1_AUDIO1_RX_THRESHOLD 0x5 +#define ACP_P1_AUDIO2_RX_THRESHOLD 0x3 +#define ACP_SDW_DMA_IRQ_MASK 0x1F800000 +#define ACP_P1_SDW_DMA_IRQ_MASK 0x1F8 +#define ACP70_SDW0_DMA_MAX_STREAMS 6 +#define ACP70_SDW1_DMA_MAX_STREAMS 6 + +/* + * Below entries describes SDW0 instance DMA stream id and DMA irq bit mapping + * in ACP_EXTENAL_INTR_CNTL register. + * Stream id IRQ Bit + * 0 (SDW0_AUDIO0_TX) 28 + * 1 (SDW0_AUDIO1_TX) 26 + * 2 (SDW0_AUDIO2_TX) 24 + * 3 (SDW0_AUDIO0_RX) 27 + * 4 (SDW0_AUDIO1_RX) 25 + * 5 (SDW0_AUDIO2_RX) 23 + */ +#define SDW0_DMA_TX_IRQ_MASK(i) (ACP_AUDIO0_TX_THRESHOLD - (2 * (i))) +#define SDW0_DMA_RX_IRQ_MASK(i) (ACP_AUDIO0_RX_THRESHOLD - (2 * ((i) - 3))) + +/* + * Below entries describes SDW1 instance DMA stream id and DMA irq bit mapping + * in ACP_EXTENAL_INTR_CNTL1 register. + * Stream id IRQ Bit + * 0 (SDW1_AUDIO0_TX) 8 + * 1 (SDW1_AUDIO1_TX) 6 + * 2 (SDW1_AUDIO2_TX) 4 + * 3 (SDW1_AUDIO0_RX) 7 + * 4 (SDW1_AUDIO1_RX) 5 + * 5 (SDW1_AUDIO2_RX) 3 + */ +#define SDW1_DMA_TX_IRQ_MASK(i) (ACP_P1_AUDIO0_TX_THRESHOLD - (2 * (i))) +#define SDW1_DMA_RX_IRQ_MASK(i) (ACP_P1_AUDIO0_RX_THRESHOLD - (2 * ((i) - 3))) + +#define ACP_DELAY_US 5 +#define ACP_SDW_RING_BUFF_ADDR_OFFSET (128 * 1024) +#define SDW0_MEM_WINDOW_START 0x4800000 +#define ACP_SDW_SRAM_PTE_OFFSET 0x03800400 +#define SDW0_PTE_OFFSET 0x400 +#define SDW_FIFO_SIZE 0x100 +#define SDW_DMA_SIZE 0x40 +#define ACP_SDW0_FIFO_OFFSET 0x100 +#define ACP_SDW_PTE_OFFSET 0x100 +#define SDW_FIFO_OFFSET 0x100 +#define SDW_PTE_OFFSET(i) (SDW0_PTE_OFFSET + ((i) * 0x600)) +#define ACP_SDW_FIFO_OFFSET(i) (ACP_SDW0_FIFO_OFFSET + ((i) * 0x500)) +#define SDW_MEM_WINDOW_START(i) (SDW0_MEM_WINDOW_START + ((i) * 0xC0000)) + +#define SDW_PLAYBACK_MIN_NUM_PERIODS 2 +#define SDW_PLAYBACK_MAX_NUM_PERIODS 8 +#define SDW_PLAYBACK_MAX_PERIOD_SIZE 8192 +#define SDW_PLAYBACK_MIN_PERIOD_SIZE 1024 +#define SDW_CAPTURE_MIN_NUM_PERIODS 2 +#define SDW_CAPTURE_MAX_NUM_PERIODS 8 +#define SDW_CAPTURE_MAX_PERIOD_SIZE 8192 +#define SDW_CAPTURE_MIN_PERIOD_SIZE 1024 + +#define SDW_MAX_BUFFER (SDW_PLAYBACK_MAX_PERIOD_SIZE * SDW_PLAYBACK_MAX_NUM_PERIODS) +#define SDW_MIN_BUFFER SDW_MAX_BUFFER + enum acp_config { ACP_CONFIG_0 = 0, ACP_CONFIG_1, @@ -82,6 +157,24 @@ enum acp_config { ACP_CONFIG_20, }; +enum amd_sdw0_channel { + ACP_SDW0_AUDIO0_TX = 0, + ACP_SDW0_AUDIO1_TX, + ACP_SDW0_AUDIO2_TX, + ACP_SDW0_AUDIO0_RX, + ACP_SDW0_AUDIO1_RX, + ACP_SDW0_AUDIO2_RX, +}; + +enum amd_sdw1_channel { + ACP_SDW1_AUDIO0_TX = 0, + ACP_SDW1_AUDIO1_TX, + ACP_SDW1_AUDIO2_TX, + ACP_SDW1_AUDIO0_RX, + ACP_SDW1_AUDIO1_RX, + ACP_SDW1_AUDIO2_RX, +}; + struct pdm_stream_instance { u16 num_pages; u16 channels; @@ -97,9 +190,39 @@ struct pdm_dev_data { struct snd_pcm_substream *capture_stream; }; +union acp_sdw_dma_count { + struct { + u32 low; + u32 high; + } bcount; + u64 bytescount; +}; + +struct acp_sdw_dma_stream { + u16 num_pages; + u16 channels; + u32 stream_id; + u32 instance; + dma_addr_t dma_addr; + u64 bytescount; +}; + +struct sdw_dma_ring_buf_reg { + u32 reg_dma_size; + u32 reg_fifo_addr; + u32 reg_fifo_size; + u32 reg_ring_buf_size; + u32 reg_ring_buf_addr; + u32 water_mark_size_reg; + u32 pos_low_reg; + u32 pos_high_reg; +}; + struct sdw_dma_dev_data { void __iomem *acp_base; struct mutex *acp_lock; /* used to protect acp common register access */ + struct snd_pcm_substream *sdw0_dma_stream[ACP70_SDW0_DMA_MAX_STREAMS]; + struct snd_pcm_substream *sdw1_dma_stream[ACP70_SDW1_DMA_MAX_STREAMS]; }; /** From patchwork Thu Dec 19 05:48:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914495 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) (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 F1DF2208961; Thu, 19 Dec 2024 05:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587495; cv=fail; b=nb2XzGTzPDX6PxxemVTn3QPa7oEDMtgH+Eikv4tR9/a4v+8IcpElF3mp7l9U9oC5UVjSFzhKfeFusWduAMoy4UCpPdNFDF//zVa4l5xw44EbSNe3auzeJJxVpXMZwlXxotHhn1UD5QemAs6cZoMUL0UDccZ9We2EI3ev/SXF2mc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587495; c=relaxed/simple; bh=61vLK/Lfbnuo0apna6hf5huq1f9vNvNfWkOnCfLep8I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BZUZxX8krIjxXtGt7Hnkxgz2JaS4IoWQ+muL6K3QPLwD4tN6qJeYCR2/i/bTdPwo7+0JBq8oPQUtby5AngLkvwx3vl4xGd/ncjm/F2nYERNs/LXpELPozJ2IoMHUeG5ZNipLiqoJnwUUEOAQ6h+6iItglmJy2u1hn7d5abw6lKw= 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=vnKXZFHj; arc=fail smtp.client-ip=40.107.92.80 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="vnKXZFHj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=auXi4OMMZlvUWXo5E6suiu2fn2F2cAliYz0H5H9FCC+paSO7MCTE0VvlF/ztd9bfWUnncJBSTxAM7tvEJ+kxZs9AZEStbuG3XgDQyuZOc/6wWK4G28ynwE9Vd9HxxJrb2WGrKuhunt6fF/Rkdy/4XKDv+TxaNnZBrniQTvv/2wh0zvZ0UI9v3jarUnRagbmNqgplZz0iNcO1Dl+69i7n7V2WjGUBtU5l7e9cZ4yGPowVz9cxzAF84psNdZutqBjdb/Cm2vFHvIdSQ+jR+km3hHEYWB4tIiJlcGnh6w2zZcYqJDOdxX7dQkeBE1SXZqAa7Gv2TvZVqjsqI5M8b1wSTw== 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=7I/noJPxLUYHqZ/gxxeYaLw3vbYs4PWX8xD6KqYdxSA=; b=C6awTweHfzjhLrkGr3BHOF3o+Gl4igTL5L1fJm+f181mwCuYnpyVP4/48lEKwxVjpCUPHCxdi9G5SaFoB8OMERqEodskFCQ6VkfEf34K0q922Xf3m+WITZuGkv3Ftx47qZJ0v0cF7BOqXST9EX1USAAOZHEEEFMyEvcqdzNZscSm+zXiBzkNJOIxBYCRvefmH9XbRMXcxBSnzvJOk0SkFmT2kaJXXBSLRRGUXfPQRgI4zFSYwCsEdcWBeWBCCayY+l3zvnuCsFzb/uBBZqNpcncIl6Lf0E3hMm+24PLFb/W2FQEsZs+aAnx1TG/RymYiwKUdEM909W8qAnZbDGKLDA== 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=7I/noJPxLUYHqZ/gxxeYaLw3vbYs4PWX8xD6KqYdxSA=; b=vnKXZFHjANMzU5tKyPWYM6hZNmq0+NDPNn8iaMFXFyzJJP5huq7ps1X/6JKADzHN0F+uJSTUoV5eGvhQKX7cplhLZ7upfUR4U6qRb2B7yu4c3paN7My3zs434zJR8C4gtHkSa776bV9RYR9UHUYN8NWirxJmdd6/JGQ1yncsIvo= Received: from CH5PR03CA0008.namprd03.prod.outlook.com (2603:10b6:610:1f1::26) by CY5PR12MB6298.namprd12.prod.outlook.com (2603:10b6:930:21::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 05:51:30 +0000 Received: from CH1PEPF0000AD80.namprd04.prod.outlook.com (2603:10b6:610:1f1:cafe::ac) by CH5PR03CA0008.outlook.office365.com (2603:10b6:610:1f1::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.24 via Frontend Transport; Thu, 19 Dec 2024 05:51:29 +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 CH1PEPF0000AD80.mail.protection.outlook.com (10.167.244.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:29 +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, 18 Dec 2024 23:51:26 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 12/21] ASoC: amd: acp70: add acp ip interrupt handler Date: Thu, 19 Dec 2024 11:18:48 +0530 Message-ID: <20241219054857.2070420-13-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD80:EE_|CY5PR12MB6298:EE_ X-MS-Office365-Filtering-Correlation-Id: dd352223-24a3-470f-c377-08dd1ff12f56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: WuqSQe9FmBbHA04Ro5Tt6DY8Om1EWXu25IrWu8X8qSo2mJFWUb6XAretAS3Bwi/O2NTDDuCtXS2kb87vN4U9t+srV1NUsinHtw/GL4qRlTQyVals0Oabirb9dPOZrQEI0aGnWzOZs79iothRzMi55w4ExXFReDpuRrCHQQ14PYmVp/gKrxzDUb9EG3DNF8aOeDd1IHaJH3KgZXuboihHJRbR+5qrw2SSDPh+8qFHe6W2/R3NA7GhLm+ROxnDrBiYKUuwHTEyp3OFuGsfY5sLCXNlAl1Zsdp4KXAQhmO2/A1+yUPgSahV8i9z30jWIh9HMR7SU+LLaLn38i2zfnUe3k3iKENTAsPpZn8tMmJe2gkV457+62v1F7X4OFTv38G1l4I2d9Lq/7A0/GSL+S6+3qRqAYe/va37Ta06pv+060QMfOcuO0IbuqJuvYSsAFyVnEUGTaiAOl2/Z1dHy5NxJaVjtYDsgLynN7g7Mm6NusgD6iOjmLpA2fQuogVeETG864n1V0yKHZIaoraM3k2jof8vSBBZSfnQ/TyuJ54jim9hV7oiLJyOzu09QTXmdmsOZ3dwiFin38Vkw6d0ZfT9qaj/3vPdOulW4OGtIkPeTQ2pAbhSpafldNyx5MgcTkf7gZE0ZHYtkXCVGzmFFI6sUbegcwMjJ66cTtwZ+6gG0LClFNQbTVbFLZNnxXhSU7Fb/wnGAPUw3fYe8JBWyCC/drZ7Fqck6RJYIIxNqg/FJO97fDaIrLSrhcRPZDX1v/lNFs0ccnRUk8J9CIucIeAc8vhJjlwrQPItdUUV8FhlHVPQY5VSgg3QlnN0iM57c0FYLzwmQE/OMjt4CqYaRja53gyUf5XOh3sY7OReOSAvxlmi0Q2+44HhFHr+kiw451z/rRS0hsKbnJNDBtPvmiriZrIedSHKihQm5G4nkAp1CnUQDqjkQaOsLca5jJxuSnOY9w7kGDsX7qMTrRdg97cEPyEt5HwvxRJkb7JnBCcwjAt1SkiEci0H7G3uwuFQniRTtglxRkEzZHwKp+yeoAfwVxSK3lpYyCFVamJfuOyeH/G28zVjS2Pfea61j1okXcIfESRvqCuCnrynpQSkohkb/g9JdFQjye8bTjeEjW9eK4fOKO41vNhJJ/bE/kJLrsQuYvgNd3e5VhPzhqy7RzrrasowqDxdlvGTBgoAeFTKP6xLlCJncO0J9at2h3eH676LVC0ih9jOkm3Cnb949/5JkDdVAe1w3KUT/vc9KVIGWYK812ISs9R8xCTd657YCT35hv0wYnKIocAgwIgqQ0WVbDFIoG8gRzY20zi31gMQrtV4Q9/R2A0OHpdyCislbm51BGv+G1dtF8MixeAl40fEDk9M4ZqDVavImAGmDAKOpDoU/w7hJyKjrxYMRI3x156D+OT0Yily2cmXV2LDFS/Rr6yS++vsZH3N/mbnGx4O+z5sGcirknv+N5dCvlsRO23sibPKbS+7S76XH04EQYzgBSwEGByJesyokxdHyh3ZJOM= 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)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:29.7335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd352223-24a3-470f-c377-08dd1ff12f56 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: CH1PEPF0000AD80.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6298 Add interrupt handler for handling, below listed interrupts for ACP IP. - SoundWire dma driver interrupts - ACP PDM dma driver interrupts - SoundWire manager related interrupts - ACP error interrupts. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 4 + sound/soc/amd/acp70/pci-acp70.c | 161 +++++++++++++++++++++++++++++++- 2 files changed, 164 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index a96b021e64da..d5ab606adedc 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -238,6 +238,8 @@ struct sdw_dma_dev_data { * @addr: pci ioremap address * @reg_range: ACP reigister range * @acp_rev : ACP PCI revision id + * @sdw0-dma_intr_stat: DMA interrupt status array for SoundWire manager-SW0 instance + * @sdw_dma_intr_stat: DMA interrupt status array for SoundWire manager-SW1 instance * @is_sdw_dev: flag set to true when any SoundWire manager instances are available * @is_pdm_dev: flag set to true when ACP PDM controller exists * @is_pdm_config: flat set to true when PDM configuration is selected from BIOS @@ -257,6 +259,8 @@ struct acp70_dev_data { u32 addr; u32 reg_range; u32 acp_rev; + u16 sdw0_dma_intr_stat[ACP70_SDW0_DMA_MAX_STREAMS]; + u16 sdw1_dma_intr_stat[ACP70_SDW1_DMA_MAX_STREAMS]; bool is_sdw_dev; bool is_pdm_dev; bool is_pdm_config; diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index a6812fa269b1..e732a680c092 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -8,11 +8,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include "../mach-config.h" #include "acp70.h" @@ -96,6 +98,155 @@ static int acp70_deinit(void __iomem *acp_base, struct device *dev) return 0; } +static irqreturn_t acp70_irq_thread(int irq, void *context) +{ + struct sdw_dma_dev_data *sdw_dma_data; + struct acp70_dev_data *adata = context; + u32 stream_index; + + sdw_dma_data = dev_get_drvdata(&adata->sdw_dma_dev->dev); + + for (stream_index = 0; stream_index < ACP70_SDW0_DMA_MAX_STREAMS; stream_index++) { + if (adata->sdw0_dma_intr_stat[stream_index]) { + if (sdw_dma_data->sdw0_dma_stream[stream_index]) + snd_pcm_period_elapsed(sdw_dma_data->sdw0_dma_stream[stream_index]); + adata->sdw0_dma_intr_stat[stream_index] = 0; + } + } + for (stream_index = 0; stream_index < ACP70_SDW1_DMA_MAX_STREAMS; stream_index++) { + if (adata->sdw1_dma_intr_stat[stream_index]) { + if (sdw_dma_data->sdw1_dma_stream[stream_index]) + snd_pcm_period_elapsed(sdw_dma_data->sdw1_dma_stream[stream_index]); + adata->sdw1_dma_intr_stat[stream_index] = 0; + } + } + return IRQ_HANDLED; +} + +static irqreturn_t acp70_irq_handler(int irq, void *dev_id) +{ + struct acp70_dev_data *adata; + struct pdm_dev_data *ps_pdm_data; + struct amd_sdw_manager *amd_manager; + u32 ext_intr_stat, ext_intr_stat1; + u32 stream_id = 0; + u16 irq_flag = 0; + u16 sdw_dma_irq_flag = 0; + u16 index; + + adata = dev_id; + if (!adata) + return IRQ_NONE; + /* ACP interrupts will be cleared by reading particular bit and writing + * same value to the status register. writing zero's doesn't have any + * effect. + * Bit by bit checking of IRQ field is implemented. + */ + ext_intr_stat = readl(adata->acp70_base + ACP_EXTERNAL_INTR_STAT); + if (ext_intr_stat & ACP_SDW0_STAT) { + writel(ACP_SDW0_STAT, adata->acp70_base + ACP_EXTERNAL_INTR_STAT); + amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev); + if (amd_manager) + schedule_work(&amd_manager->amd_sdw_irq_thread); + irq_flag = 1; + } + + ext_intr_stat1 = readl(adata->acp70_base + ACP_EXTERNAL_INTR_STAT1); + if (ext_intr_stat1 & ACP_SDW1_STAT) { + writel(ACP_SDW1_STAT, adata->acp70_base + ACP_EXTERNAL_INTR_STAT1); + amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev); + if (amd_manager) + schedule_work(&amd_manager->amd_sdw_irq_thread); + irq_flag = 1; + } + + if (ext_intr_stat & ACP_ERROR_IRQ) { + writel(ACP_ERROR_IRQ, adata->acp70_base + ACP_EXTERNAL_INTR_STAT); + writel(0, adata->acp70_base + ACP_SW0_I2S_ERROR_REASON); + writel(0, adata->acp70_base + ACP_SW1_I2S_ERROR_REASON); + writel(0, adata->acp70_base + ACP_ERROR_STATUS); + irq_flag = 1; + } + + if (ext_intr_stat & BIT(PDM_DMA_STAT)) { + ps_pdm_data = dev_get_drvdata(&adata->pdm_dev->dev); + writel(BIT(PDM_DMA_STAT), adata->acp70_base + ACP_EXTERNAL_INTR_STAT); + if (ps_pdm_data->capture_stream) + snd_pcm_period_elapsed(ps_pdm_data->capture_stream); + irq_flag = 1; + } + + if (ext_intr_stat & ACP_SDW_DMA_IRQ_MASK) { + for (index = ACP_AUDIO2_RX_THRESHOLD; index <= ACP_AUDIO0_TX_THRESHOLD; index++) { + if (ext_intr_stat & BIT(index)) { + writel(BIT(index), adata->acp70_base + ACP_EXTERNAL_INTR_STAT); + switch (index) { + case ACP_AUDIO0_TX_THRESHOLD: + stream_id = ACP_SDW0_AUDIO0_TX; + break; + case ACP_AUDIO1_TX_THRESHOLD: + stream_id = ACP_SDW0_AUDIO1_TX; + break; + case ACP_AUDIO2_TX_THRESHOLD: + stream_id = ACP_SDW0_AUDIO2_TX; + break; + case ACP_AUDIO0_RX_THRESHOLD: + stream_id = ACP_SDW0_AUDIO0_RX; + break; + case ACP_AUDIO1_RX_THRESHOLD: + stream_id = ACP_SDW0_AUDIO1_RX; + break; + case ACP_AUDIO2_RX_THRESHOLD: + stream_id = ACP_SDW0_AUDIO2_RX; + break; + } + + adata->sdw0_dma_intr_stat[stream_id] = 1; + sdw_dma_irq_flag = 1; + } + } + } + + if (ext_intr_stat1 & ACP_P1_SDW_DMA_IRQ_MASK) { + for (index = ACP_P1_AUDIO2_RX_THRESHOLD; index <= ACP_P1_AUDIO0_TX_THRESHOLD; index++) { + if (ext_intr_stat1 & BIT(index)) { + writel(BIT(index), adata->acp70_base + ACP_EXTERNAL_INTR_STAT1); + switch (index) { + case ACP_P1_AUDIO0_TX_THRESHOLD: + stream_id = ACP_SDW1_AUDIO0_TX; + break; + case ACP_P1_AUDIO1_TX_THRESHOLD: + stream_id = ACP_SDW1_AUDIO1_TX; + break; + case ACP_P1_AUDIO2_TX_THRESHOLD: + stream_id = ACP_SDW1_AUDIO2_TX; + break; + case ACP_P1_AUDIO0_RX_THRESHOLD: + stream_id = ACP_SDW1_AUDIO0_RX; + break; + case ACP_P1_AUDIO1_RX_THRESHOLD: + stream_id = ACP_SDW1_AUDIO1_RX; + break; + case ACP_P1_AUDIO2_RX_THRESHOLD: + stream_id = ACP_SDW1_AUDIO2_RX; + break; + } + + adata->sdw1_dma_intr_stat[stream_id] = 1; + sdw_dma_irq_flag = 1; + } + } + } + + if (sdw_dma_irq_flag) + return IRQ_WAKE_THREAD; + + if (irq_flag) + return IRQ_HANDLED; + else + return IRQ_NONE; +} + #if IS_ENABLED(CONFIG_SND_SOC_AMD_SOUNDWIRE) static int acp_scan_sdw_devices(struct device *dev, u64 addr) { @@ -333,8 +484,11 @@ static int snd_acp70_probe(struct pci_dev *pci, { struct acp70_dev_data *adata; u32 addr, flag; + u32 irqflags; int ret; + irqflags = IRQF_SHARED; + /* Return if acp config flag is defined */ flag = snd_amd_acp_find_config(pci); if (flag) @@ -382,7 +536,12 @@ static int snd_acp70_probe(struct pci_dev *pci, ret = acp70_init(adata->acp70_base, &pci->dev); if (ret) goto release_regions; - + ret = devm_request_threaded_irq(&pci->dev, pci->irq, acp70_irq_handler, + acp70_irq_thread, irqflags, "ACP_PCI_IRQ", adata); + if (ret) { + dev_err(&pci->dev, "ACP PCI IRQ request failed\n"); + goto de_init; + } ret = get_acp70_device_config(pci, adata); /* ACP PCI driver probe should be continued even PDM or SoundWire Devices are not found */ if (ret) { From patchwork Thu Dec 19 05:48:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914496 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2041.outbound.protection.outlook.com [40.107.220.41]) (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 4DC08217717; Thu, 19 Dec 2024 05:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587498; cv=fail; b=m2aZMVVr2qlQeJqeTufXIyY8HydtNTf8WjHBi+0joswzBkiyUT1kAaXOhD+8aK/m+AdlMqjyEytCtYWhof2VPEoRSFTSj/lmAQtGMg+5JVThZmqJhWo7IlFN5rnevQ9ga9FnbK2SEZejX2OiKakf5RzCRiXoKl66oV4V+QQ4qE0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587498; c=relaxed/simple; bh=WwekW25sM31HWqRtWcjTLS6n/Ap8nkhiErzQ/Hlq37Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=spqgH4fLeja/Ydle9xRAPbmg0wrlumTrd/ec7oiIdnBTb4xP4A4l9+MOSkc7gkZY/SSjPUmY77P1DLOzOaMZm/aGnVtMDvpRvrdK47mfy1n5WPVNG+ukCdVawuRGpdCAycMv1OowdDeDIemQnLPk3LIauLhMDKM5/nH3mFIixYc= 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=XAnPcTh6; arc=fail smtp.client-ip=40.107.220.41 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="XAnPcTh6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EMgD+odk6hMdkwwdvssBuszOL68PVvvZW/n93pz/Clft/GthoD9tBOEzcnpv0NGedEdyfjOexRdBkRZyOJN6CbdTSJtRYbP81XfhVn64eexADvtx5QFNrnTfZrkxP9EH5ElMozuSPyEvP2kEL8J04omdNtJJftBmYcoRZn23UEHRc6m/qHH2Nr7hgtLQsw6Gs9Bp7Ah3wp5p7QSU03hzXkYmTZQZbrvPJqV1svNn+b4qhKRWvg+JVk6z92L3bQVdTisq2faPBoZJt1L3qiwSq0bMTj/d9e0z8kYsH+5MxXcMH701+JsrhK3aB6KfVR0xMklV9laC1HNyNsxO/7ctgQ== 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=kJQi71sXiDZNgwfIvXoSLGbmEiJoWJQjzWCC2CVlwxw=; b=YACvnVnD+oZbvS3Qa2GmU2QDZa3rACKit78pcukZENufZn5/yk4j/uK+0r9GoTDfbGTz6+pVBbHbtACRJCE7SElQwYewhUzmpIA37Sn7VuFLYD1vrUTKDE+osyLDulx5SRU5afjo74rg3hKA9YhpZPPRlq7tkZYRZ8i16uW+eBlbAJg/1c3SzAy3p1yuqqS/wf7o/0mIpMNJALRUFAePr2+rJpEHYRsq9i4VggJ6oJgHurOUbM4sLXRJamKhTBkgMenrMavWwVIvv1SZnxisX5VboCCdvcp77+BYwEYXaUAkSkgAbizbQiErdB3kVJDfnOFe+YCrmqkOjhKWzXMVgg== 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=kJQi71sXiDZNgwfIvXoSLGbmEiJoWJQjzWCC2CVlwxw=; b=XAnPcTh6GNzbZuMKvM+muM6LGGNqjULBi+zg2JcA0sOBsFYdPmgfHuErtYJSoDIt9bSt/rbJJOavI5ALRWvQsUTJL5gJ4J1vex9cK9uw2rsqWAtWxcypGjyZq3rrOy7zP08xgNn2IocqVvVr7Si3pmF1ogyhyDPML8Oo9TNZEVY= Received: from CH2PR15CA0027.namprd15.prod.outlook.com (2603:10b6:610:51::37) by DS0PR12MB6630.namprd12.prod.outlook.com (2603:10b6:8:d2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:51:33 +0000 Received: from CH1PEPF0000AD7F.namprd04.prod.outlook.com (2603:10b6:610:51:cafe::e3) by CH2PR15CA0027.outlook.office365.com (2603:10b6:610:51::37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.24 via Frontend Transport; Thu, 19 Dec 2024 05:51:33 +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 CH1PEPF0000AD7F.mail.protection.outlook.com (10.167.244.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51: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, 18 Dec 2024 23:51:29 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 13/21] ASoC: amd: acp70: add acp pdm driver pm ops Date: Thu, 19 Dec 2024 11:18:49 +0530 Message-ID: <20241219054857.2070420-14-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7F:EE_|DS0PR12MB6630:EE_ X-MS-Office365-Filtering-Correlation-Id: 3fd298ba-ef32-4534-c3c7-08dd1ff13155 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: O7KmXvVEqyR56puyU1BXtCGPGA1i2qZoT9qVn62SXb6MtzGxJPBu2YUtQ09UwBlFzsnw/5muzAVdEz9NPObwm+aToHQSJ6jHg4HzUSPEE+AMDTB722YdRSh7vbhS3EHD4X1GE1bzLjZVOxJpKxw7wzvYDk87iMQwe9Eb1mkOHPBrASU7zrbhX+0zX8MBEV0Kn3OcZoU350QnEWXpbL5BY8O/z1OoZuLLQ8ef48zFl3p6zJkwvJuykI0b7Arqd17XCDzpwqTXFMCI/mSo22MrnALmx5Bnxw7SwYpoQOi1OtSkqJfuWeWVCu5funnWLqv+RHHoa0AawNQSuH833cSyDjZmq2WJ9YbeIoe7fyIDuukkGtsY6Z/AkxRAClKxvelX9FKcIdp91e2DrhaTBfsr0KRnto3vw3FzCpYqb5XEvCXQMdONOSCF2dT8HiQBxJGfYdUMcLAnoQOpE16kK6scwfc84Db+hUeFZD8kICo7xtzh6N3ooLHtdd/s5mb93H/Hc4a1hk9mK0SJWmHPerUqr51+J2BLaGtWM+49NjUQk42oG+3zAVHKYCMb3WMWbljrTacXi8oc9sSf9JdyyayxCYIHMZN/QQJpIKRyT7Sxx/6zRiJELBSfLzlLyqT7ceQfXlJd1FxXcAverE4dUbaz/zMG6S0MLj+vuraW3hExhlczd9hbofW31y3HckbL1zpIGNZBSwrVlXlAjOcraVzAid5GD8vNILHlk3xUsL0svjpyDMIhR/mxuR9UXDGT5egLj7NtPRLwHuk+BoUzpa48sIYU7E2mwx5YGCa8qBL+uJGMfXf8Qzyd4xvAMvHXoMJB5KK8gpB341Gfdvu8N72KQquGtum/HynCbL0wWGCxJdpisO8pCh1Hm7QCoS//9LFjJQZy4yAovOuTCJR2gReXKKz0Wb9fd1nna1nd1Fn3TQWuhDJ2QO/Hi1EfmX+TEgqrvBd9orFfCI2C3hDmlM+b8sGK6kJMBZAXM6MBhHBRdlvf80uCEr44J0xgl/Parwn6NWBh/T07UBjj7ar4e9uGgZmIbKYUm2fY1ZcpwRpftsJaecw+YhKB878gQlVEgmdsOaqunrPwCu+epx4wW2vMgUDr5LVYbKBkcS7C73Tn48c6qXz7ENBh1sz6SrlRNP5dVGtb+t3S/E4uXxak2RZyOQziM3qfE8nGXMBMHJT7kryIdlt8QL86N5CmnbSRcB2j+T+pHJ1np+1kU/Kdd30ofY3nRQdZDBejwcC4QbJrHLmPyZiclhYrufntcRkF3CJ424mRxTEf8lbYLe4SrdZ1n2AGNWvFI/28YAUzJXYmFp5enF5ZTmeyT5RKT/asNZXoNn4BGY45wKDItZmppMnNUpENunpZeOei+swhvlUmjdlNynd4p8P8+8nPYNMfxM5XHV20AqpnL+i/ATGVaEVK0/zXtiSJYlGFc3xe1K9iKYqJVM4jrqiuPEmgTZoC0mY/HbMHQkqyNDu6eSz4YgRwvr3oahG/ytPdWuFfyI2npYg= 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)(1800799024)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:33.0980 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3fd298ba-ef32-4534-c3c7-08dd1ff13155 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: CH1PEPF0000AD7F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6630 Add acp pdm driver pm ops for ACP7.0 & ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70-pdm-dma.c | 57 +++++++++++++++++++++++++++++ sound/soc/amd/acp70/acp70.h | 3 ++ 2 files changed, 60 insertions(+) diff --git a/sound/soc/amd/acp70/acp70-pdm-dma.c b/sound/soc/amd/acp70/acp70-pdm-dma.c index 197214e68489..0d24c9ed917f 100644 --- a/sound/soc/amd/acp70/acp70-pdm-dma.c +++ b/sound/soc/amd/acp70/acp70-pdm-dma.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "acp70.h" @@ -388,13 +389,69 @@ static int acp70_pdm_audio_probe(struct platform_device *pdev) return -ENODEV; } + pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); return 0; } +static void acp70_pdm_audio_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); +} + +static int __maybe_unused acp70_pdm_resume(struct device *dev) +{ + struct pdm_dev_data *adata; + struct snd_pcm_runtime *runtime; + struct pdm_stream_instance *rtd; + u32 period_bytes, buffer_len; + + adata = dev_get_drvdata(dev); + if (adata->capture_stream && adata->capture_stream->runtime) { + runtime = adata->capture_stream->runtime; + rtd = runtime->private_data; + period_bytes = frames_to_bytes(runtime, runtime->period_size); + buffer_len = frames_to_bytes(runtime, runtime->buffer_size); + acp70_config_dma(rtd, SNDRV_PCM_STREAM_CAPTURE); + acp70_init_pdm_ring_buffer(PDM_MEM_WINDOW_START, buffer_len, + period_bytes, adata->acp70_base); + } + acp70_enable_pdm_interrupts(adata); + return 0; +} + +static int __maybe_unused acp70_pdm_suspend(struct device *dev) +{ + struct pdm_dev_data *adata; + + adata = dev_get_drvdata(dev); + acp70_disable_pdm_interrupts(adata); + return 0; +} + +static int __maybe_unused acp70_pdm_runtime_resume(struct device *dev) +{ + struct pdm_dev_data *adata; + + adata = dev_get_drvdata(dev); + acp70_enable_pdm_interrupts(adata); + return 0; +} + +static const struct dev_pm_ops acp70_pdm_pm_ops = { + SET_RUNTIME_PM_OPS(acp70_pdm_suspend, acp70_pdm_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(acp70_pdm_suspend, acp70_pdm_resume) +}; + static struct platform_driver acp70_pdm_dma_driver = { .probe = acp70_pdm_audio_probe, + .remove = acp70_pdm_audio_remove, .driver = { .name = "acp70_pdm_dma", + .pm = &acp70_pdm_pm_ops, }, }; diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index d5ab606adedc..1d8e670264fc 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -133,6 +133,9 @@ #define SDW_MAX_BUFFER (SDW_PLAYBACK_MAX_PERIOD_SIZE * SDW_PLAYBACK_MAX_NUM_PERIODS) #define SDW_MIN_BUFFER SDW_MAX_BUFFER +/* time in ms for runtime suspend delay */ +#define ACP_SUSPEND_DELAY_MS 2000 + enum acp_config { ACP_CONFIG_0 = 0, ACP_CONFIG_1, From patchwork Thu Dec 19 05:48:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914497 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2088.outbound.protection.outlook.com [40.107.244.88]) (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 0EFD6217F50; Thu, 19 Dec 2024 05:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587502; cv=fail; b=Y/DXBwLTKmbG9bo7a8pbb2Duku+GXrZeV0wxtx1p4k5fkd6ekoQCVLas5K7HP+8+JDA4TYhcgmtR5za+WRqZCvgqwS5yFuvpqnL/IzIChfWLg6Cgso/1ljefdE+Y17DuRrz0avffQhJRDD3fjSJqqsTm4+msNCwlhoekfyrjWmU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587502; c=relaxed/simple; bh=2DLLAcn0QGCogNDu/mz9L1jpqhgPgtko4u2oVNEFEV4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lM6P+kNsbsZoBU3vp2eIMKqUJLfukLxU7ggFiiaczEp+giW3zevkwxW+oS9u1or8fO1x50Ib6BcLhxvQxJnyE6m8XUriEXAORdHEyQIv5J40TmTN/puBwnHKlBw8p488fTiGD8ZuBqUTkxfTO3xZRkBEEBHUSiSC2sz9RcBXxVo= 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=u2okrACR; arc=fail smtp.client-ip=40.107.244.88 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="u2okrACR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Xui+3fYZiLDAyUSZ9biMIjnrbKGIBdqwZMa+gZLRZLptA1siUm5fdHBwjUDxi1Kj9FJFp764M+sDcSpyUXgS6PsO5NwXzFj11H16uFHmHh4h9WYRWpPkz72lOgehaZED/eUYfwdESGz9yptdyiYqeS+zz7+SuTxioFxBNp3ID8Oqc8pifXjsr1H3VMMenHLZ+hX9crW596lvRC7UHvNFw5PUGXzwaRglV73veAyiqyinG3ZqyeEPQoQ3V2eZKsdi2grFGei20H9CfGMlyZZZ6J1zB4jOpFpoqVRmx4lsIV0cFXvnjhrQ9iGkenxIP7qXen9hfQKy+EXx4pHDeSLECg== 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=J7/yTQeHNtmdxnm0k1s+wffRwfi9FaOQjVYSwNos5L0=; b=FDMTA8VLrTUnNuT/f5DuBFi5Ru5UL4oE38kt/hoC+TGPF935c4Myi1aN68Tbd72cnqivNgaDEFonR8HIyjNXyKGspTjm6jFL/G4UKGb7Oi5vLeTCcRpTxZPvwWIOU5YoCFMpdjSsZ3injIX649pl9EGC3ivODwegr4WEV7VLpq/DQ6257iIhyk5p1F8WdeTmMDRkUzUMeFU2duXUy7utERCI9PlVnhGx9A++C/lb9MLlypRTEOy98XrRGeWqWan0saAJkQTqGz6wPa0AnKJ/dOsexx7pD1J4Gfn9iyKgP6/yPpTrbSNy+YCseUQTbs94MusDwsY+pn96ZqG2mS4qgQ== 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=J7/yTQeHNtmdxnm0k1s+wffRwfi9FaOQjVYSwNos5L0=; b=u2okrACRCufER84qwkQoFD85WPJ44X1JxV+l4hzIKwdZeUIIkNy5a7FIJvxkFxzuGhTE4492pqOsPNZsIsXb/jrvFbgIQ1W+TSWDSTCbGfRNUufi6xRqqGaAHderNnKW/wAS7OUcivIzKoHBUWiJ6TowoYFjbQ3NPmRk3cpkYKA= Received: from CH2PR15CA0012.namprd15.prod.outlook.com (2603:10b6:610:51::22) by DS0PR12MB7703.namprd12.prod.outlook.com (2603:10b6:8:130::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.15; Thu, 19 Dec 2024 05:51:36 +0000 Received: from CH1PEPF0000AD7F.namprd04.prod.outlook.com (2603:10b6:610:51:cafe::5d) by CH2PR15CA0012.outlook.office365.com (2603:10b6:610:51::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:51:36 +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 CH1PEPF0000AD7F.mail.protection.outlook.com (10.167.244.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:36 +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, 18 Dec 2024 23:51:32 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 14/21] ASoC: amd: acp70: add pm ops support for soundwire dma driver Date: Thu, 19 Dec 2024 11:18:50 +0530 Message-ID: <20241219054857.2070420-15-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7F:EE_|DS0PR12MB7703:EE_ X-MS-Office365-Filtering-Correlation-Id: 39632c70-b82a-4cab-e7a6-08dd1ff1335f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: Y6dn67P676Lt6wEe1+eTCnFK3ypPidlWK88i3EQn3+a88vta/QIDKA5Rxy+2lAcMQ7dK1ulc0T+raqlFANs4Be9Z9Hq1gvf40nTva6fN3cBJ6PZ/dEOZT6p2n7MzkF/YGKga2FKiNPRcclxrkaQiQxznciBTLn4h0LGV0Rs6orNtODuTBI7jB9igbcDApO4G7GiavOxwr/rkLBzbPdWj93fZ9NyrfU637s+FvvYbBLvZG3MzohSPNIazv/cwuv3fPh6dzpJ2r3HelyBwQPfbDoCt1lA2xUpkubPMfmnwrcNu5C0PM/cby09CcTlmrr3YypqxG40GiewA/vKMw3Pff9RY6yAfSBr1QCLXeh4PVAdN/JzXbVD0RQC33RfipK1toL50luK5CbEEVtlWbNZ70rpBEBH/fzYH2yvRl83dvLtjIh9I5zKPWQyW/Fy76iTm46tzNBkKIpW0SM/6Hz5Isgzvq/n1wCRz1aisqDfvGGELU1+UL91hxzig6F4YBO55TOQBMDjuu+xeJFHtoszC9PlMoB0Ja1d5d6oRDw16m20YyYUC+ypz5eO4Mh0uHRaPtRi75iKJsrDIIIWIe3N+YdlDPJ08i25Zoo2JHRslJBbqJrIlBdFUl09LTtCafj4v2FGGlf5QfbBvQRFuF+/TNqLQ3Tt+NredvzHDP5rXebnf80nLMR9vRt/qxKYQB2+gwYMHtq/5mAAo9kB+iRJIo1UCiKHwoveIJDcCHeV6e9KXiuYd50CEhFicynAYCyOHF/RkS2B7tIESzYD65mVuHf3WTOtN8GQClZfe3Mn0XecEzKcplthubBH1Fl2KaJghmIvGfPqXTVAo8MoXtLJyEbxYKzfmdmawzBQoq1avUCRUA2fk0BAV3ItZXpM2Z2vHk5mp9U8PvO+Mw3KhU/bl7xgSPrA+usFxPCtnhRl1TOrvMCYTOFctE5r6oOxbIavgE7P91u3C/lK/MY+8eHfRCsRZa62bIw8dqalg/gv+xK4C0EUmNQm+F0qttEYkwnX5M0Zsbb8Lk3O1HjGEGnl4M/baKxJhyUWdMawt69oQ141eVWPZ2cAdYeaQZ5ca6b2EqS3GgpMmSCIEWoi73ZCleSCB1Pow37+MWKDpKYAneyinbBv9rQSaJ5RUiHbKD1hr3mj77++Qnqds+KC2zAB2ySyzWcV9lRRirLgOjdNHjz45cnH22/mYCr0Z2bLnClxVDZjyPTI07+TQna644obzJS2WG0PUU2uT+qaRYBg+5feS0mcqoWLVL6DSJI0tPwmzkclm87kFsPSNLyIvY3odC+ktNlfANLZsBoS6SNd8EAo9MXtX+AL5Sbay3aZVhPf1/0T9/PF+gana2MxOdgiRMCbHLOgKUQFMbJbrhV3A7I7pbIQL7aupujoG6ezQJGusk4VXOX4CLylCKMiNmPsXTak5fUsoDuQkS3E2/GP4tWb0kuznWnVqJ/FJ2pmAXv7LpXqRqsnAQb0BP6RX56jvSuKxukJHcxQqWFh9p3RN8eQ= 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)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:36.5199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39632c70-b82a-4cab-e7a6-08dd1ff1335f 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: CH1PEPF0000AD7F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7703 Add pm ops support for SoundWire dma driver for ACP7.0 and ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70-sdw-dma.c | 92 +++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/sound/soc/amd/acp70/acp70-sdw-dma.c b/sound/soc/amd/acp70/acp70-sdw-dma.c index 2c01f60cf3b9..183db176725f 100644 --- a/sound/soc/amd/acp70/acp70-sdw-dma.c +++ b/sound/soc/amd/acp70/acp70-sdw-dma.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "acp70.h" @@ -128,6 +129,29 @@ static const struct snd_pcm_hardware acp70_sdw_hardware_capture = { .periods_max = SDW_CAPTURE_MAX_NUM_PERIODS, }; +static void acp70_enable_disable_sdw_dma_interrupts(void __iomem *acp_base, bool enable) +{ + u32 ext_intr_cntl, ext_intr_cntl1; + u32 irq_mask = ACP_SDW_DMA_IRQ_MASK; + u32 irq_mask1 = ACP_P1_SDW_DMA_IRQ_MASK; + + if (enable) { + ext_intr_cntl = readl(acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_intr_cntl |= irq_mask; + writel(ext_intr_cntl, acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_intr_cntl1 = readl(acp_base + ACP_EXTERNAL_INTR_CNTL1); + ext_intr_cntl1 |= irq_mask1; + writel(ext_intr_cntl1, acp_base + ACP_EXTERNAL_INTR_CNTL1); + } else { + ext_intr_cntl = readl(acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_intr_cntl &= ~irq_mask; + writel(ext_intr_cntl, acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_intr_cntl1 = readl(acp_base + ACP_EXTERNAL_INTR_CNTL1); + ext_intr_cntl1 &= ~irq_mask1; + writel(ext_intr_cntl1, acp_base + ACP_EXTERNAL_INTR_CNTL1); + } +} + static void acp70_config_dma(struct acp_sdw_dma_stream *stream, void __iomem *acp_base, u32 stream_id) { @@ -476,13 +500,81 @@ static int acp70_sdw_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Fail to register sdw dma component\n"); return status; } + pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); return 0; } +static void acp70_sdw_platform_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); +} + +static int acp_restore_sdw_dma_config(struct sdw_dma_dev_data *sdw_data) +{ + struct acp_sdw_dma_stream *stream; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + u32 period_bytes, buf_size, water_mark_size_reg; + u32 stream_count; + int index, instance, ret; + + for (instance = 0; instance < AMD_SDW_MAX_MANAGERS; instance++) { + if (instance == ACP_SDW0) + stream_count = ACP70_SDW0_DMA_MAX_STREAMS; + else + stream_count = ACP70_SDW1_DMA_MAX_STREAMS; + + for (index = 0; index < stream_count; index++) { + if (instance == ACP_SDW0) { + substream = sdw_data->sdw0_dma_stream[index]; + water_mark_size_reg = + sdw0_dma_ring_buf_reg[index].water_mark_size_reg; + } else { + substream = sdw_data->sdw1_dma_stream[index]; + water_mark_size_reg = + sdw1_dma_ring_buf_reg[index].water_mark_size_reg; + } + + if (substream && substream->runtime) { + runtime = substream->runtime; + stream = runtime->private_data; + period_bytes = frames_to_bytes(runtime, runtime->period_size); + buf_size = frames_to_bytes(runtime, runtime->buffer_size); + acp70_config_dma(stream, sdw_data->acp_base, index); + ret = acp70_configure_sdw_ringbuffer(sdw_data->acp_base, index, + buf_size, instance); + if (ret) + return ret; + writel(period_bytes, sdw_data->acp_base + water_mark_size_reg); + } + } + } + acp70_enable_disable_sdw_dma_interrupts(sdw_data->acp_base, true); + return 0; +} + +static int __maybe_unused acp70_sdw_pcm_resume(struct device *dev) +{ + struct sdw_dma_dev_data *sdw_data; + + sdw_data = dev_get_drvdata(dev); + return acp_restore_sdw_dma_config(sdw_data); +} + +static const struct dev_pm_ops acp70_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, acp70_sdw_pcm_resume) +}; + static struct platform_driver acp70_sdw_dma_driver = { .probe = acp70_sdw_platform_probe, + .remove = acp70_sdw_platform_remove, .driver = { .name = "amd_acp70_sdw_dma", + .pm = &acp70_pm_ops, }, }; From patchwork Thu Dec 19 05:48:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914498 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2049.outbound.protection.outlook.com [40.107.220.49]) (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 650CE218589; Thu, 19 Dec 2024 05:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587506; cv=fail; b=apGEzfkOjVztuX+oWZm2cmvri6KmGtv4SCiCshFe9NfzZKGyhrjMh47MB0sMynfmYsHjJqxlEN5IZ0SfIwx75BSavPJKh1yr1doDIRD1ujEgsy/UA+JwcKcs8TdQsxI81q6k4CcytdYccXFVj4Oo/CpxzKMhKf0I3nzVvXqq4z8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587506; c=relaxed/simple; bh=AB6y6aUGKAIcu/7XQQX9E2MkkO8GRA/yMdNiZrdQ8M0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sCzS4i/r0IeQmEl0gvVJ5Tepgz9wALulop1+ABT35I7ZYoB1CrAsrfzDHjirlgDlU02iRQ7JMnEgB2RN/bRaFes5+S+tuzPPWmkBFx5Syi+YFXDERnCQDv0piFo/FJBXjBYbQPgApEAvNxGqxXsj58SOSbrxOPVHdeKk+x+kj28= 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=OaDVN5CG; arc=fail smtp.client-ip=40.107.220.49 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="OaDVN5CG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mMYVPucyyE/LOECddeDgqUIDAjEbal0kFl1fq/fvCqHH400Y0HAEYOJ+7CCzo/Uq7uNP9DFspx+03TPDTkrSWn+imwsL2N4eHpacGEySSrOtW/jDB7lzJ+gbX51LeNyfUVLBQ1t+4Y5HAj0xu4JaZOl/OOykXBWVItxI3we499dNgW+Ieihf92hBoaK3vcEBXhXri1PH24uKM4hfH/NWZrC3/Rg25HmC79PjefuO8v3Ugo6TPsLtFlC2vnTxNJ6ZeMVXkJS2ESIDJ9zVw0T27wHVFIrzbUPOP532v+Pe/krTiXburHl0CIvEvJ8/CY9wzkeNaVSwTtrAs4iU+Ywm0w== 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=hV+Tox7gKmYWATNT5Lh70sD5S3ZwApVIAEgawlfLhPY=; b=enVTINtNsG3XeHwk8py6Q9OAGBfZgBK7wLoacU3nSs7FIKfy722G/9CmKFVdGeE2vfO+QVUASaFefxiQ28uW4Zft8OSlTpJYVkWsUg+qYIFdvgEKxc+AfrzMdwDOXaWBBbDpxSv0QWFlVB2q8SPOva0w2l3uUhrBooSM7LkI8rLMGZfvyNLnxAYaoh17WlF99rEPH0Rnu2g78H2XMxBL8ZwzICFWl5TRpYWkgDd9/rtxeMqlhsL06f76ZUP75cAHiIcUkT/qAIc6sJsjq1toPFRxWm+7/A7k41iwD/kV2wjzoVbNz+Ux2iKqhkhoAw4pr30XBgleh1OP6ZunHnpegw== 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=hV+Tox7gKmYWATNT5Lh70sD5S3ZwApVIAEgawlfLhPY=; b=OaDVN5CGOWdrs3S09oNDdkcP5xNMNDOgRCzNVZMR3Y1uXQCGRucCLDOsvNEFPc1UHd2Z+xYze4aoksLxNgCjFvUjxZl8oya4ELEa3TXf1cEZTDbJtQ3rzQmSOcNU2KH9VZFRoVUv7pZAUOBcaAtB582dkxSYgKJ82yTexX5OmVw= Received: from CH2PR18CA0056.namprd18.prod.outlook.com (2603:10b6:610:55::36) by MW4PR12MB6778.namprd12.prod.outlook.com (2603:10b6:303:1e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:51:40 +0000 Received: from CH1PEPF0000AD81.namprd04.prod.outlook.com (2603:10b6:610:55:cafe::47) by CH2PR18CA0056.outlook.office365.com (2603:10b6:610:55::36) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.24 via Frontend Transport; Thu, 19 Dec 2024 05:51:39 +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 CH1PEPF0000AD81.mail.protection.outlook.com (10.167.244.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:39 +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, 18 Dec 2024 23:51:36 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 15/21] ASoC: amd: acp70: add acp driver pm ops support Date: Thu, 19 Dec 2024 11:18:51 +0530 Message-ID: <20241219054857.2070420-16-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD81:EE_|MW4PR12MB6778:EE_ X-MS-Office365-Filtering-Correlation-Id: 25f1d138-9ae0-4dba-6719-08dd1ff13563 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: lpzUXEugqxl1p8WS8kC2/2N1MhOUr5qKVBbAA3wSQcmuBG2QwNeFXs5tCE/5oGhFSG+RNuvKEusSyUIi973RyQ5DWwCHTIM4du5/MCskfZiBpyEBR+lznq2kvhF2hOvje9mfdSP01zzP5X83wcAiJg/oBLcQMBKDVdqO2GnD3VwKJXB47PIPAbjgfZ7SRrBZ9doTvara8Wd421nAv6SRy4xHlHKgCVOufXWKb79E+q3q2+7yoxywTUCZsj0LSrXdwX5X5GCxAFoPkfaLkKup6DzI3jK0WD6bEvku4GTTYZZq9mfFRyBFp4LjBdKU2r+36+YhYLmBApIvDzYQOYBDCU3HHzID/GK2c3uKstQu7nJ2yPYZQglov1CULQNIFs7LlQTr4/QG9A2YeX5qjkle5dfHLhim4qzPFVShgASBOncyPuhpbDr3L2Nm0sDZMiaQkgkFwGu2o9+pQ7/YrjHF9cdhcZd/M7o8ia3pd5u55pkGQfW9c1habtHrXYLmHSBqaMdHMKXZPzPR8+ue4VgUiKPG0SeCZaBWz6YINe3u8n50ZXvjaH8HoQ2wVCeZ/NpO17aC7TfYbMAJrNEshfWgGev/IprX+dwhYRcR4S9z1diySSvdhMrld6CjFjT8WpcSeXbFlX3ZXKSSvSA0sWr6c1culizQBGC5Ilg870wpRjQJPWJfvGEEgTAQuhNpiunarJ4jQtNKZQT0KcE+dkbxNVKn1g3jk+2B3nzLrcR+Bg0kmzUQHb2xdZlnc4iTd9jortXzadid9iEk7XSsGm+fE7UimQFRCu71URoWNUq1K4kNnp3KlgEq1QbW262M7N9jdiPeBA4tgnfqmGEEVqnvZvj71Acz1/r4KuxMnaQYPxlhKVyqsrIgbmyCKqIMLBxtxRSjtsFrJ5oaMSFQ5x/SfzNJvngWRGtbI0h+UHZGFjIpNgXAzRe275qijc3T8CkntQXyMDuWSMBAzKYEvEKsmD/wRtpyHG3M+yaeiabNdXFNUKZVoR4vyznbEx9N90d0hrtRbb1/dzZhlslwgX57OTlZcoEonG5/MWx1ou6ElU8RFcNpc9M4MNvYaOnlaTiPdZ9+BX6Y1VkilBJDrunxPm7gF4Gz7VeAh+BYcdYxFBkbASTOJHlSNMbCxl4jGHlws0bz3ID/Bvpreq3+TLPkgHXEBGAcwcoc4RPr7W2Ivw6ge+23aVJA2buTUu8zmaNgFf1TL8a+0Pw+pb6M4mZE/qWCs9E0OICiiEiUxEhHCXGT0VcTcbSlUiXiREcQa7BSpaEsZ7Nk0Iehv67hId8SIqYafeLMLAEfswXuwEVGE03gcBqrUEkPetJfQMihJ5zY1SmvrBLLerDu3CoM5ERwp6OPiOsM5m3krJZFNvYOPCoMrWpgOOa6JxaWGPZaaEZGk2OukbjT2lCuRm7IlyWfrcxAHLdRrlem62gEoiAhCR58pG6OO/k5wUcKJ9c9QxIfBxh9gqg4HCh8LoELelWRwaWliVbPyICyFZ9QHiOWKng= 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)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:39.8983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25f1d138-9ae0-4dba-6719-08dd1ff13563 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: CH1PEPF0000AD81.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6778 Add pm ops support for ACP7.0 PCI driver. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 4 ++ sound/soc/amd/acp70/pci-acp70.c | 106 ++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index 1d8e670264fc..1b5661a86352 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -60,6 +60,8 @@ #define ACP_SDW0_STAT BIT(21) #define ACP_SDW1_STAT BIT(2) +#define ACP_SDW0_PME_STAT BIT(26) +#define ACP_SDW1_PME_STAT BIT(27) #define ACP_ERROR_IRQ BIT(29) #define ACP_AUDIO0_TX_THRESHOLD 0x1c @@ -247,6 +249,7 @@ struct sdw_dma_dev_data { * @is_pdm_dev: flag set to true when ACP PDM controller exists * @is_pdm_config: flat set to true when PDM configuration is selected from BIOS * @is_sdw_config: flag set to true when SDW configuration is selected from BIOS + * @sdw_en_stat: flag set to true when any one of the SoundWire manager instance is enabled */ struct acp70_dev_data { @@ -268,6 +271,7 @@ struct acp70_dev_data { bool is_pdm_dev; bool is_pdm_config; bool is_sdw_config; + bool sdw_en_stat; }; int snd_amd_acp_find_config(struct pci_dev *pci); diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index e732a680c092..3cca18612ef1 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "../mach-config.h" #include "acp70.h" @@ -554,6 +555,10 @@ static int snd_acp70_probe(struct pci_dev *pci, goto de_init; } skip_pdev_creation: + pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(&pci->dev); + pm_runtime_put_noidle(&pci->dev); + pm_runtime_allow(&pci->dev); return 0; de_init: if (acp70_deinit(adata->acp70_base, &pci->dev)) @@ -566,6 +571,102 @@ static int snd_acp70_probe(struct pci_dev *pci, return ret; } +static bool check_acp_sdw_enable_status(struct acp70_dev_data *adata) +{ + u32 sdw0_en, sdw1_en; + + sdw0_en = readl(adata->acp70_base + ACP_SW0_EN); + sdw1_en = readl(adata->acp70_base + ACP_SW1_EN); + return (sdw0_en || sdw1_en); +} + +static void handle_acp70_sdw_pme_event(struct device *dev) +{ + struct amd_sdw_manager *amd_manager; + struct acp70_dev_data *adata; + u32 ext_intr_stat1; + + adata = dev_get_drvdata(dev); + ext_intr_stat1 = readl(adata->acp70_base + ACP_EXTERNAL_INTR_STAT1); + dev_dbg(dev, "ext_intr_stat1: 0x%x\n", ext_intr_stat1); + if (ext_intr_stat1 & ACP_SDW0_PME_STAT) { + amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev); + if (amd_manager) + pm_request_resume(amd_manager->dev); + } + + if (ext_intr_stat1 & ACP_SDW1_PME_STAT) { + amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev); + if (amd_manager) + pm_request_resume(amd_manager->dev); + } +} + +static int __maybe_unused snd_acp70_suspend(struct device *dev) +{ + struct acp70_dev_data *adata; + int ret; + + adata = dev_get_drvdata(dev); + writel(0x1, adata->acp70_base + ACP_PME_EN); + if (adata->is_sdw_dev) { + adata->sdw_en_stat = check_acp_sdw_enable_status(adata); + if (adata->sdw_en_stat) + return 0; + } + ret = acp70_deinit(adata->acp70_base, dev); + if (ret) + dev_err(dev, "ACP de-init failed\n"); + + return ret; +} + +static int __maybe_unused snd_acp70_runtime_resume(struct device *dev) +{ + struct acp70_dev_data *adata; + int ret; + + adata = dev_get_drvdata(dev); + writel(0x1, adata->acp70_base + ACP_PME_EN); + + if (adata->sdw_en_stat) + return 0; + + ret = acp70_init(adata->acp70_base, dev); + if (ret) { + dev_err(dev, "ACP init failed\n"); + return ret; + } + + if (!adata->sdw_en_stat) + handle_acp70_sdw_pme_event(dev); + + return 0; +} + +static int __maybe_unused snd_acp70_resume(struct device *dev) +{ + struct acp70_dev_data *adata; + int ret; + + adata = dev_get_drvdata(dev); + writel(0x1, adata->acp70_base + ACP_PME_EN); + + if (adata->sdw_en_stat) + return 0; + + ret = acp70_init(adata->acp70_base, dev); + if (ret) + dev_err(dev, "ACP init failed\n"); + + return ret; +} + +static const struct dev_pm_ops acp70_pm_ops = { + SET_RUNTIME_PM_OPS(snd_acp70_suspend, snd_acp70_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(snd_acp70_suspend, snd_acp70_resume) +}; + static void snd_acp70_remove(struct pci_dev *pci) { struct acp70_dev_data *adata; @@ -583,6 +684,8 @@ static void snd_acp70_remove(struct pci_dev *pci) ret = acp70_deinit(adata->acp70_base, &pci->dev); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); + pm_runtime_forbid(&pci->dev); + pm_runtime_get_noresume(&pci->dev); pci_release_regions(pci); pci_disable_device(pci); } @@ -600,6 +703,9 @@ static struct pci_driver ps_acp70_driver = { .id_table = snd_acp70_ids, .probe = snd_acp70_probe, .remove = snd_acp70_remove, + .driver = { + .pm = &acp70_pm_ops, + } }; module_pci_driver(ps_acp70_driver); From patchwork Thu Dec 19 05:48:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914499 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) (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 8FFC12185A2; Thu, 19 Dec 2024 05:51:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587509; cv=fail; b=kXB9pkVXH+YYG6HidSHkRt3LrziS1KVvPENNeZ8u+eeMsJAFzI3ndEEQHl914Y8INL9RDrKDrJVYiBLyQspf3fccx8j7nq/i8juh5Czz00Qz70uuJFaLfbojCEyxK7WkTZJk/JHwxWJpq/+MysOXwjrOPAmkfWHqeuVWob8Cvz0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587509; c=relaxed/simple; bh=wzVCup4MVAPobHeJGNtLM3i76G1xDvTQJ99/cXq9le8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j+fHkDxgtc+AU+1hlXfIvJBLRMdpxgqiHuTMurJcWU45z9ObcWKwecFkXa1D9rubkTIKWBTpx2MqEjbEzu21KbFRnpJ2cM6UgIDobcf4t96fQ4cBKjvGELY20Rm0l9qI5M/zlTg68m4xspDEtoRl+ny3o12qgBbv0j5WTDcQlHA= 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=ZL3LDHcc; arc=fail smtp.client-ip=40.107.220.64 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="ZL3LDHcc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JuS4dxWK2/DmdrrmuyYqG25ENm3+d/5uSU655o3ELLxUZHcBxm6getkaMkAkFbc638C76Tg+0dj8IdKRc7Hvn2RPYllMllLkILDUvkX/n0NBPeM7yVgVB7wc9Avllw/8ldXax0nig3vUD1k9jLs5EHQVVKjH6yKrWoh+YvDDSGvB0LFgaA81MXSw2eFdjrxHTgrM7Swg10DArrAh+5Nul1FANrtD6iWNwWc3u37DosQ5lfPzlWJtKih2YJAQXtd+xN9+hShGdHMiEl7xMQWPSz519IFgxawY/2X0mg+DO2/Kt8oftjNmsUadb7qxM3mnrYejO4lpIuJYAoGL/ZFTuQ== 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=TjlAW49wi2tNNZoBp6lCS5APDiL4ygZwnhzoEAl2RHU=; b=yOP59F0jyjMUgVbG6jn1/ZM0b2RnssIBEpMztvJwgtXZzctmTVb4n6TSHX1zEH+2MnhrLfRHM0jA0Tg4d81j7YlAszJ50p5S5+oD5BpVP1TY6vln+f2Oa49m/WBgYVbL4wXhOnJcMDgOjYQIz97n+8MfpMAdyyTb4lXvpUOnnfJFZsmhf6AZx7Jw8suuE+MfI5iynNUJxnHL3IZZJUHwCYNpkbJDUZQsbRr1k+Pcxo81DRot71rjbAKl6JhbmFm7GZHcEnZcZanRrUJnuiMTz7J1UpXFIhv2TYYFuK54FTIv5XTuVVmL5Y3PxhDbtZ1/BW7KXXQnE56XUZTWggI86g== 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=TjlAW49wi2tNNZoBp6lCS5APDiL4ygZwnhzoEAl2RHU=; b=ZL3LDHccrfr+GAgMzykyurkQFsw+BVqiMQ8KsW94pPBzKSPrJuxkHL/B6utWaXGElPePz5nLQSw3exWEwnm5OAsojy+DreMYy0u229nLLkXEgd/Bh49pvNcqgqxquTzff6VdiemCYE2gJcJKKhOnvpC0K1UHF6zVkortwX+VnRo= Received: from CH5P222CA0009.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::25) by PH0PR12MB7471.namprd12.prod.outlook.com (2603:10b6:510:1e9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 05:51:43 +0000 Received: from CH1PEPF0000AD7D.namprd04.prod.outlook.com (2603:10b6:610:1ee:cafe::4e) by CH5P222CA0009.outlook.office365.com (2603:10b6:610:1ee::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:51:43 +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 CH1PEPF0000AD7D.mail.protection.outlook.com (10.167.244.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:43 +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, 18 Dec 2024 23:51:39 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 16/21] ASoC: amd: acp70: enable wake capability for acp pci driver Date: Thu, 19 Dec 2024 11:18:52 +0530 Message-ID: <20241219054857.2070420-17-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7D:EE_|PH0PR12MB7471:EE_ X-MS-Office365-Filtering-Correlation-Id: 145257b2-712c-4543-48e3-08dd1ff1378c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: bAja6xqb7UzeMti05PG97mAK1zEvGaoA++U2nnIQcWX93IiYtr7dCfWFt3RPR9L+A2BY3KWBkHQAQgIpDUsSDCLVlXqs8YIbTX5Yt5tvSBn/vMmRoxAgjj9KLZpE2+jdW88MylVF+LnIDDsdFg077pUqLGpctZtyDKYL+22R2NLjqAWS++BIwt3KWh5UgZe2PAnS/eh20NXrCLLxodpLGxG8SJudyYdjXnJ1H+5Q3yF+pYc5AdQdRyJ7TkrRLKIa5noUIZM8qSgMz+Dv0N7oPvPSeFzXl4Kxfcloz+RzctwdTmZs7WtxSa5LhkCL9zbZ//7lPak+POENKWoBo5Idduk1dbEsruNc+r64FdTKPTL9aVQJWKTb36DiT42ESJ9SHbDq/A8UeYPhDGTUvCY7ArZRjYUKPcbN+4fARMvKNpwH4U+M6GA6G2CyiLop8Z97nVhW+4otw7nfZUjg1l2gKLeNmLvxmKcWh1XyNC/737BBPNpfGwR1S26WLulj8wsrCZr8OIOb40LQv/1AUtqLQRSpBmmMH2oiEOcvpUAG0E/JfRB1yozg0Me29Zgo7d2W9vQryoBwZb1GAwOP9b3U+3PEESX385VuF08vgAthBzZ1ENI6/CsyJ+6YYg8e7E/6AasUChDV+TwWvx5PP5qPM7nrZwzJzlHBaXtKBsUIX6ABlPcOoLinE4CYdb4teXsHF8WEuNDpIQKtzmk52r79PgcfHFrCNqwoNZryVtZPyOLAtqMFNu26gzm6eYF+Goa5BN2zqgU/mI4snT+0yvq21c7ZGKW8LEUdqg5H+1mudNWv4BTDpsFx/V1HJ7B4r+Ao99m/IGUJbpwstugHgCx9fKMqEn+fULmPC2ay5l066vPkB4PSNjisE0jR7DZIqwOiuac2KuzcY6CqwgFoOKNhzBZvn3JgisiV/Hea4fkmPPCXPKl0bEnuLQhITuK0d4jXIztHhBsfl/uvpC1K5xq/fK2wA+WK8p1xW76GA7ezGYRKUGRwFRIiMhqDOLArHjVPxDzDsgZYPcgHFqIz+Rz6PM11UXAxu9WgJDlSSA56SblzSAT3/jec6542wjtVSyq0Oz9vw3S400IsOUKOnSCBSdZl/blaRdQ/inwHIFooqVO7oc+VjVd4ajLfh0pL3vNZ2g/lmqmjgX3EsCODO4Lw2ZH0hg5gZl5L1MhviQkQWusUfQb7zzEBAaaE8DLm6R9vmU3SiFPz4YuUS0RhhJJ4MPdq4kh0N9kJHtlbjax1tjxjf6kX+ezxe0A5iem9L8Sr2MHb0OWcQutW4C81uFMZFhADd9zRo8ArOJIVB2F89z2wayxKoQFymdLzx8+Dim5Q3n57RpxCpNwoOjxxg3nNRhFz+zo+PC73bfAUij85QOOlCnfItMMYEfDHzlkg4/+8kij6OcwRdpsGVqRl/uh+FHwM1zgD+UJYEwsTt59MFGwh/rHkBJB+l76g+Nhh5ljFQx9EzCbhz2M8DS/LuT1jTO/96SeeKOClgqUHr8RaalA= 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)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:43.5060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 145257b2-712c-4543-48e3-08dd1ff1378c 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: CH1PEPF0000AD7D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7471 Enable wake capability for acp pci driver for ACP7.0 & ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/pci-acp70.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index 3cca18612ef1..5e0f7bb68eb8 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -555,6 +555,7 @@ static int snd_acp70_probe(struct pci_dev *pci, goto de_init; } skip_pdev_creation: + device_set_wakeup_enable(&pci->dev, true); pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&pci->dev); pm_runtime_put_noidle(&pci->dev); From patchwork Thu Dec 19 05:48:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2078.outbound.protection.outlook.com [40.107.100.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 3B38121882C; Thu, 19 Dec 2024 05:51:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587513; cv=fail; b=VyN6nQ4cMLYFi9Q+bYHjc9OgWkGmZJrmoyBqYxAnQ0gRlu8X+7AXFkm2HQOOPopjatNcbtAC4uxfVz4WkeEYOgCgt81Mn7eq10A5QtIFTRTJZte/lyZMYeKc6w29gPTtvSruGNcbM1+OzghSVw6mEqNgdKAnrut3tDq+3jFqT98= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587513; c=relaxed/simple; bh=jp0i3G4vkrmLXB2QNH1rP0c51KJsRozHriVIW2r5lus=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mRWIC885Lx4Ds6X+qpfr9775xaQLJDapSePvqU+QpOCcftxItw+7uNBjNy3+XdPHw85vNP09ZvpYmccqV2sP4GvZReQTB+Sk+feqMnTiRSshbaUfZ4GYFSncU1s1+rsX4O0FN1aDwD7xsVMorGU4ruRm7KXsgZsKyR1aPHgHWiA= 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=HEGB7JKb; arc=fail smtp.client-ip=40.107.100.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="HEGB7JKb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hW7c2jUkc+8MxUM9Qy7AKMDQCWUaadyvF62XxMvQf+olLCyFEkUZ1Hk5joQ/sDonxgUX6EnkwBeQ9dpk8aUMIi22J9+YA8PGC69Th+kp8yrgiH+aru07ThKKeZur4OH/iBJLRnY7ZyhbhN+KjiGREu6qchEe4Q0bC7B1YoeLFC72FY+D77g2jVsIQPfDCDA8ReWO8il8cet1ZZR0GSplD7nH1F8afaCcbMa4V7uySFItTwtPhQ+GFD5nmMMfd3LDFSnJmo7nxgGqG5RWeLYZCBPTD/u8Y9b1DOsQL1jySejy3nmz+ZsxYt4Rj5AauGP5tdRQ8UzjnzHH2nBUddHYqA== 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=TraM2FYo9IztrRMluX7qFCVgeINcrtGiWt4k6mE3Y14=; b=pB+o8O3ds/J/kekfrraaUhYZSC+MScjcZ65ewVxZj+XJYBM6jEQYu03HgVxEutFU5r5nybYTjxNV8FYubx876mdOJrb+SLsXc9xfQeogtL+CIf/jKTa2CW6JVYdLlWoOP0cnVrAWCa2OUl340swIys3L7UVs4O03gSK3vc3iwiCVNod9Zq4mtjDa9/PzmFt+SGtkU+xHDj5G/wz1GRPFi6QP2qUFydEOB1Ys9tPtLBNXhbWBk4vG/TJFURCoXxJ8sV22zrzjWPgBpNVy9dLBSvtc+B6RCF/F5Gbqv9vuh5QAnHfi76opTi6NRNY/bi9Yla0ftbv59Llo7T6I7L6/hQ== 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=TraM2FYo9IztrRMluX7qFCVgeINcrtGiWt4k6mE3Y14=; b=HEGB7JKb8/xMZM6wpFB7rccNj2YQGXNB4/oraHNLNAsL2f/48FJpmV93E1hA1eOf8rutKapuGW2p5tiO3gkWxo3B0GWUU4+MOf4ze9vagCYUzqZFG5BP4O1XVg9+XVdMPhkDC0pUYa19ENl6HjC5aJ9I6QHNN7W/EIMvQcAmFog= Received: from CH5P222CA0006.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::27) by DM4PR12MB6541.namprd12.prod.outlook.com (2603:10b6:8:88::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:51:47 +0000 Received: from CH1PEPF0000AD7D.namprd04.prod.outlook.com (2603:10b6:610:1ee:cafe::b2) by CH5P222CA0006.outlook.office365.com (2603:10b6:610:1ee::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.25 via Frontend Transport; Thu, 19 Dec 2024 05:51:46 +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 CH1PEPF0000AD7D.mail.protection.outlook.com (10.167.244.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:46 +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, 18 Dec 2024 23:51:43 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 17/21] ASoC: amd: acp70: add soundwire host wake interrupt handling Date: Thu, 19 Dec 2024 11:18:53 +0530 Message-ID: <20241219054857.2070420-18-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7D:EE_|DM4PR12MB6541:EE_ X-MS-Office365-Filtering-Correlation-Id: 81897ee8-9161-421c-f5e8-08dd1ff13980 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: uNrrNtu2DYAsEU/Ru9cxzzigHZ96xIqKpVGpXTeEcn1uxoxaVMktdXScql3lb1cn+rJxTANS//1X+2X96HyqUC5+aVrNB9UpQmQKjw3Hq6HuFg+3TAtP5YymEAUv68eW6LdV7rVP3iQHPTKBXl42aNUafxOPhB6U21vjB0O0XyW6dbAxEhY4V8ILrvbQdmKk4bAWtAABf0MUI1j9rBQ7lwnQnFH7eLJ5xKEXnjlqM7qpMDqEet5wdnJ2kQejGXAx3C4LHSL8VSr/96s2//gPqkq+fMZ9Wlxb9FdnFzb6NCOAdVdvjGbzFCSqe6k2QVIOIfWHihsdMXDXtzbmzZsZGnBYBB5LDnbMzDjdpHTU9ppusIvm5Gr4dIPy66Zj2X318Hid1TfckWwMsvSVGiVRt3zkmibk0M/IiLaa56Wwp39L3jA+SOwPNwg5nyaEvSd9/RuMmtxYJL3Yik9wAqYVYzYKK8W1n1eKKt97xx706vYyxUbI1saUc8u94J3whIXmOOAoIUSGjx9W4PWvk62n6XZobTxEx8uo93IWE8W9/aMFRMqS2m7mRYtl2SKzs530J8QdrW1g5jOScSMywl9fvJ6kia4LGIK08xosWOdnUl4IGI22nX+RMMwiwJgbJQQN0D3t1skP6bkailrZGtbl90eyNoU1P33XFEi93ndeatQFX4k+RL7olIMWBfaeYMaB8kUhWIc/5z8HaGbF5n0baXaAVpzEhxg6BV/WINiTfxHGgRW+sG8a5n7e/5GksTz9IAXnMxINo8eQ1Km8ogQY7DJuK7ikcJe1E0PnYhkEuwSrzrLbdpAY1EtRR9ZqqShHqylxILPq/XtQiXu1eT43+BuBg8UWws5RyRwEaKT/LVCKXGvwjjxDn0sS2rX40c+A47i0cQDlWLHMP37ELMyxHGK7zkAQH+hfqVabzro7dQBPgZP0r0UA9C1QukJ5p42VGZZ6/uHI/TpVNEkgWqsp6ZHxy56m+V72LcPLYcDZGOkOfgePFQ/zKw0k7pEHH5nRca/LfL/UaU40hfQlh+xfFxI68Gh+Vw93EcyWcFsWXVJRi2RAeX0gTH0PRqi/X2HDXOsGdIgUagvIxJ+5T+KqauoZRmPPFNlIPF3sc6hvKV0I9dhXMTSHk/bp/3tWQ8Xa1nvOlbzcxIqEcTC6cCPLXmugFe/tgiddTZyJnvF7UinL2OmdmMvVTzQse27RQjg1hb8u2XP01BxEZkvdtHcnJHQ7KLkHkmwePA7S2zxkiBC+3jqkswTlFKeP4jKmCXzuPhOVlZtrhKRON5Mdka4PtCuBLzXqUKAJkr4w9JN/bgByLc9iMG5ms71VIyEavodsH7x28zD5NmhYUuYVjDoRjLIc6VqxO/vx9UU1Y09OtBrilg+TbBfgvYKEwbOGY2Ywk5/EIe8KCLQfWltwg+WIQZRBz697HFL/JeBOxZ6YStww1TNy6nlm9vq4//kR/lc//sAUpd7H9Ht3lyrLYgh5KKj3efEd6RPxU2P+vG3wYSc= 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)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:46.8029 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81897ee8-9161-421c-f5e8-08dd1ff13980 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: CH1PEPF0000AD7D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6541 When ACP is in D0 state and SoundWire manager instance is in D3 state, If SoundWire wake event is asserted, Soundwire host wake interrupt will be triggered for that SoundWire manager instance. In this case, ACP PCI driver should clear the host wake interrupt and queue up the runtime resume of the SoundWire manager instance. Add code to handle SoundWire host wake interrupt in ACP7.0 interrupt handler. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 2 ++ sound/soc/amd/acp70/pci-acp70.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index 1b5661a86352..9774db1ac537 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -60,6 +60,8 @@ #define ACP_SDW0_STAT BIT(21) #define ACP_SDW1_STAT BIT(2) +#define ACP_SDW0_HOST_WAKE_STAT BIT(24) +#define ACP_SDW1_HOST_WAKE_STAT BIT(25) #define ACP_SDW0_PME_STAT BIT(26) #define ACP_SDW1_PME_STAT BIT(27) #define ACP_ERROR_IRQ BIT(29) diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index 5e0f7bb68eb8..6884e8516a2c 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -169,6 +169,22 @@ static irqreturn_t acp70_irq_handler(int irq, void *dev_id) irq_flag = 1; } + if (ext_intr_stat1 & ACP_SDW0_HOST_WAKE_STAT) { + writel(ACP_SDW0_HOST_WAKE_STAT, adata->acp70_base + ACP_EXTERNAL_INTR_STAT1); + amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev); + if (amd_manager) + pm_request_resume(amd_manager->dev); + irq_flag = 1; + } + + if (ext_intr_stat1 & ACP_SDW1_HOST_WAKE_STAT) { + writel(ACP_SDW1_HOST_WAKE_STAT, adata->acp70_base + ACP_EXTERNAL_INTR_STAT1); + amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev); + if (amd_manager) + pm_request_resume(amd_manager->dev); + irq_flag = 1; + } + if (ext_intr_stat & BIT(PDM_DMA_STAT)) { ps_pdm_data = dev_get_drvdata(&adata->pdm_dev->dev); writel(BIT(PDM_DMA_STAT), adata->acp70_base + ACP_EXTERNAL_INTR_STAT); From patchwork Thu Dec 19 05:48:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914501 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2080.outbound.protection.outlook.com [40.107.94.80]) (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 360592185A2; Thu, 19 Dec 2024 05:51:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587514; cv=fail; b=GXaIkvitA3WYODozRHwao3S4qvapbq2G7tJuaCLLF3lLknzg2Yr3FyMcLtY3rkRWaFTGyoHShc9lNKuLPbfWr65jBhU4xTn9fXaO+wB8WOwkwCVU0mziyJKXB35yfzzXY27TYUTLAKqjW65rRFxEJTQVJ2RAIuLiNudihgmsFs8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587514; c=relaxed/simple; bh=R5Ixdu4Gyx1Ft7b7Hpl7LzEjeRVBmjPD91i3py8dBdU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A4PZ3luEjcUKM+qFmqAD8zwqsnV0/7KL9Fcu4/LrbWycjP+f7Y7C1ReOa5notjlrudb2FjoIe9RYl4rcqIE7BEl1j8o2U/jx/5spifM5piHcEniycytBSiQEe6msVX+feioV5w7IbVLz6uVIrOpOahR6owGGTQfRmUhbkLMRCOQ= 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=eHzS3Nb/; arc=fail smtp.client-ip=40.107.94.80 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="eHzS3Nb/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xhohv64xbdIRME+xLUrNbwD9+GtRlx0DzxYdQy81qFuj8btlS05SL219oQCqUUcIZnWNjYuMlfZSa5j8PKoh3883INdmF2gZev/Ffjy6j3dRlnCMKvXNdi1NSaYmGfF5fHOzUxs7DXIg1hgj+1i6MtK85bigyzePll0NRjUVOb4tmNAvnlcteJvIfVZ4yTlUo6my40K5Oa4RYmHOwthSetZ7uA38GTvCS71qIYKdHZ8uHXw89U+YnYv6EGi8Fz0bHZZcm/O4Ozu19YaNXqCx2VdNOZS5CFJBOKh7esyOTmGOIJMBXrn/KRYuihtIGC3Sp+Apa4nf07t0FBhJw10sEQ== 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=ehpkWakawdp//S9miNwMpuezp6lub1O2CYe7mBijSrU=; b=JpiNcAPzOOww2EUaN56Hrf2W1T52cqMhQqYeldjo0tZ+dvPnimF72Ya2YaZpdJuZFsXcn9vn8uDImukgLzDkPp/GIjNa0SKZAzEXtRSrJYPKpn+RjbQ6mUWHWV4+3KY5/pRe7BIHgZOoRgCjoEttIPAmByK1qjyTR2U0bQ2j90BARcdGXktM3QuR3jqgPoBnsOpenTImfbwQLJfgWWI/Y6Op7FsT4ryXIigMvQJYU7mk20PkmH8UQQbIWlY11Xu9kmLYiinob+VCJFDp2w/I8E1M13GMSeZTEwcKw58Hz2e2qQb6Vf26HUi9fmv+/SoOu8TTDfj/sr22Tm4SEcj0NA== 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=ehpkWakawdp//S9miNwMpuezp6lub1O2CYe7mBijSrU=; b=eHzS3Nb/qgPqOS11DA5YCOGkmei2CgATl4bgTr6GmUGDegSUEbSwCIOzUwBF9xsuU7s1hzeZLwdzHQiHqt/gT1YFqvr0HXpxz3uswoXS2OFY30iZW5T0YYSOm8sU0k9UCRy9xPA60pUGeC3Kw8jH7ANXDvBmLbEzINqawN0KHsY= Received: from CH5P222CA0016.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::23) by CH3PR12MB9079.namprd12.prod.outlook.com (2603:10b6:610:1a1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:51:50 +0000 Received: from CH1PEPF0000AD7D.namprd04.prod.outlook.com (2603:10b6:610:1ee:cafe::29) by CH5P222CA0016.outlook.office365.com (2603:10b6:610:1ee::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:51:50 +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 CH1PEPF0000AD7D.mail.protection.outlook.com (10.167.244.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:49 +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, 18 Dec 2024 23:51:46 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 18/21] ASoC: amd: acp70: create a device node for soundwire machine driver Date: Thu, 19 Dec 2024 11:18:54 +0530 Message-ID: <20241219054857.2070420-19-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7D:EE_|CH3PR12MB9079:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b0c4b79-1867-445a-5481-08dd1ff13b67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: ixlGu/iWyZLiSgru8C5g/wayfVxopRGw5GLWRVEuZ31pQJPabPZPn8uSLRwrulCmgrjLWh9I3Bqhel9pmOujE5UPYrM/1gjUAWVOeErcUoRqjIPpWMUcbLo4r4eGP5Lypwt1N9eNhsfXeUJU4metBG8xY/IRn3yXd1BvKQLaMMiouZzb+h5/JUawkaWB64PUlDHP/M7f4OxdWf9YJzkxi5DXsITkdFvP+M33p7aMvATaewzVah0WPusr0+ZznI3V7g1OgG1mRpYbgP4BNk77XbyPDtVzHUWq94v2YB+6tGwISXDaod6qrTXBfHxhNlQhxyQPwhykAL4cO76xa6M576f5Jo1nr8jjhyXEhyiUL63O6eyXgmFz7ao5N/VlCg6ZNQSUCtpaOuNHfCtQ7Wckq85YMVz15YlyxQ9KS0nvjNivwi04gxDJTXqNFjlMWuWyvnKYORF830YYmmcWPCzBNFNzpkW/79M4fXpjRm7NJZt5+a5TN3Jo2UsnEDnfFzk9mLrIWo+zSZNUzvIpttxcKUbUccplJrYYM7vHW1aR4WUaGbBQr6Cr7u138I2nRu3I3b9XxALKuD+a8n+pd/9f4ktp5uqu9R19as8268iqvQfsZ0NmorJWHhiFBYZJSIyaTTpk/suepopqPOrWRA9tScrFVSPuwfnbhZP/P1jStS7Z5XWaBgAYrbX+Ac1Bs5qHIpneJqZeMdJegUE4fYVsB+tHdzSDQRImQGp8+IZngE7VC4VIqmaPI6ObRdXtpXJbJeZTIvlrKPtjm3kakizg6ZBDMlWavOZqqj2rmV3xOhLhy8HdfZMM1XTxIC4DmXT5HtyjBQ1TVJyQKYoE6ZVWNnCorao/TSvK9GpWtt47tEbFUvYmOC49KFxuuNoKCNOaDpCag2EwZJwm2YyeT8j1SnBoVBHA+csadJrrz7T8o7R3vTy1hHlVl/AzTbF84d5yr5iW4PJDPE0DsLQRYvyspXCcmXmEnSKnl3c1iPR1eT2h723WBI8xJx32IgRxJIuVw0R5ZdARCoThSENEvAYsX31qEFUftktPdvg/1tE/mNXKYKgT0E/waReuocjUvZyy2CsKvb77oUJ/AZCjCmecZOnMY6JN27RyH8g+IOKuWAWoDgIzFTq+xMv6lkN6oqY3XXgXgWf8bNUGVSI2CBTeDdowr68bw0wYW+53XiDFceS3MxLjgsNNtLOqrBdPLF/Fzo2aTjJtKxToF0VSHmjtyXh300mFdd1UOUCGfcGcg2l6gafOfBMXAayVMfJPEHeiU4FF5fsK2ypQwLn3HJG97n4XUaIxsuZD5gsENsBY9SAUgf/5Q1w4O50zeod3jPAgVjpgjQynFr7yJm47krgcyPbDiitLcDF0uJJK+8U4cnsreDmY6GLB/w+ZAOp7KMHW6WhTdK6pc3YbIT2LyucFyPdntocPCHHAZkYEN8Hp92B2xWKDJ9RUDtOZ1PmfWKf1x5IJROfmNJzUq3+BN6Uw41AQ1GkTonvr6OPpMkcX/o8= 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)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:49.9904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b0c4b79-1867-445a-5481-08dd1ff13b67 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: CH1PEPF0000AD7D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9079 Add SoundWire machine register logic for ACP7.0 platform to create device node for SoundWire machine driver. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp70/acp70.h | 4 ++ sound/soc/amd/acp70/pci-acp70.c | 72 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/sound/soc/amd/acp70/acp70.h b/sound/soc/amd/acp70/acp70.h index 9774db1ac537..c7dec130f27f 100644 --- a/sound/soc/amd/acp70/acp70.h +++ b/sound/soc/amd/acp70/acp70.h @@ -239,9 +239,11 @@ struct sdw_dma_dev_data { * @pdm_dev: ACP PDM controller platform device * @dmic_codec: platform device for DMIC Codec * sdw_dma_dev: platform device for SoundWire DMA controller + * @mach_dev: platform device for machine driver to support ACP PDM/SoundWire configuration * @acp_lock: used to protect acp common registers * @info: SoundWire AMD information found in ACPI tables * @sdw: SoundWire context for all SoundWire manager instances + * @machine: ACPI machines for SoundWire interface * @addr: pci ioremap address * @reg_range: ACP reigister range * @acp_rev : ACP PCI revision id @@ -260,10 +262,12 @@ struct acp70_dev_data { struct platform_device *pdm_dev; struct platform_device *dmic_codec_dev; struct platform_device *sdw_dma_dev; + struct platform_device *mach_dev; struct mutex acp_lock; /* protect shared registers */ struct sdw_amd_acpi_info info; /* sdw context allocated by SoundWire driver */ struct sdw_amd_ctx *sdw; + struct snd_soc_acpi_mach *machines; u32 addr; u32 reg_range; u32 acp_rev; diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index 6884e8516a2c..ae19187fe695 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -317,6 +317,42 @@ static int amd_sdw_exit(struct acp70_dev_data *acp_data) return 0; } + +static struct snd_soc_acpi_mach *acp70_sdw_machine_select(struct device *dev) +{ + struct snd_soc_acpi_mach *mach; + const struct snd_soc_acpi_link_adr *link; + struct acp70_dev_data *acp_data = dev_get_drvdata(dev); + int ret, i; + + if (acp_data->info.count) { + ret = sdw_amd_get_slave_info(acp_data->sdw); + if (ret) { + dev_dbg(dev, "failed to read slave information\n"); + return NULL; + } + for (mach = acp_data->machines; mach; mach++) { + if (!mach->links) + break; + link = mach->links; + for (i = 0; i < acp_data->info.count && link->num_adr; link++, i++) { + if (!snd_soc_acpi_sdw_link_slaves_found(dev, link, + acp_data->sdw->peripherals)) + break; + } + if (i == acp_data->info.count || !link->num_adr) + break; + } + if (mach && mach->link_mask) { + mach->mach_params.links = mach->links; + mach->mach_params.link_mask = mach->link_mask; + mach->mach_params.subsystem_rev = acp_data->acp_rev; + return mach; + } + } + dev_dbg(dev, "No SoundWire machine driver found\n"); + return NULL; +} #else static int acp_scan_sdw_devices(struct device *dev, u64 addr) { @@ -332,8 +368,36 @@ static int amd_sdw_exit(struct acp70_dev_data *acp_data) { return 0; } + +static struct snd_soc_acpi_mach *acp70_sdw_machine_select(struct device *dev) +{ + return NULL; +} #endif +static int acp70_machine_register(struct device *dev) +{ + struct snd_soc_acpi_mach *mach; + struct acp70_dev_data *adata = dev_get_drvdata(dev); + int size; + + if (adata->is_sdw_dev && adata->is_sdw_config) { + size = sizeof(*adata->machines); + mach = acp70_sdw_machine_select(dev); + if (mach) { + adata->mach_dev = platform_device_register_data(dev, mach->drv_name, + PLATFORM_DEVID_NONE, mach, + size); + if (IS_ERR(adata->mach_dev)) { + dev_err(dev, + "cannot register Machine device for SoundWire Interface\n"); + return PTR_ERR(adata->mach_dev); + } + } + } + return 0; +} + static int get_acp70_device_config(struct pci_dev *pci, struct acp70_dev_data *acp_data) { struct acpi_device *pdm_dev; @@ -570,6 +634,12 @@ static int snd_acp70_probe(struct pci_dev *pci, dev_err(&pci->dev, "ACP platform devices creation failed\n"); goto de_init; } + ret = acp70_machine_register(&pci->dev); + if (ret) { + dev_err(&pci->dev, "ACP machine register failed\n"); + goto de_init; + } + skip_pdev_creation: device_set_wakeup_enable(&pci->dev, true); pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS); @@ -698,6 +768,8 @@ static void snd_acp70_remove(struct pci_dev *pci) platform_device_unregister(adata->pdm_dev); platform_device_unregister(adata->dmic_codec_dev); } + if (adata->mach_dev) + platform_device_unregister(adata->mach_dev); ret = acp70_deinit(adata->acp70_base, &pci->dev); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); From patchwork Thu Dec 19 05:48:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914502 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2042.outbound.protection.outlook.com [40.107.236.42]) (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 0486721661B; Thu, 19 Dec 2024 05:51:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587518; cv=fail; b=N/GjsO3+RGuWXh2VmwPqbC16/ReKKc3wgoeLzwitZ8qbTE19nYafEKAPlMrQBdHAcwMKJE2OCnEa/TMVdPXm7ooeMFJe/wjktSSkZcAXMEEqPvv/ZRriowVOCbF/kVVsXS5d6Ykk9FHSLZFg8hsn6sjjJs1dsjXXMmkLhiWMuqo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587518; c=relaxed/simple; bh=lVgX+fLvSP85L2Rofn2ihdqZpltVmekJ++lM5pRSmPw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZAW8+FEy702/J16Uhm2vlNo45e0HegLI4X3rhl7Cg3tN5JBb7DZqnv85iIyHi+ctOZE3GWiQz0ouqlezPz/45Nz85KhL8BCelqaVRqib4IZjJIpD/MxC9HRDtHuVSWFSDDB+slVCLuglJhJWzaRhwQhh6nBsTlK7GGBTSoDIbDA= 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=Tva90utN; arc=fail smtp.client-ip=40.107.236.42 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="Tva90utN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sYYnTLbzvwlvWmTG/NRI/oMD7mzX8oYvbFIw3OXCkKWk0jX7+3MoQNU75jUyM86596VybuRmRMhDV7RW0eDDz9zyfarIzmZje0Hkfhk91T/k6CFpL4PSAt7d8ncFEapIK9XRqZv7j9I+s54XZpiCpVF8QNbwwr+rF7zvmx2WBxVAZbT7aP4QWNvfdX2oHIKrYUh+zaVbzw/nTtQLDNZ+StulqTTnY3sOpGQiY3VashJu2kBiFR6+bVKkZP4veJkiZ8/a7NmmsQNPMxOAd8YA4g7HwEGvcQttwL9DLw7cZF2WgPsYD/bmlwyfVjVvn+gAzxoO6WrcWvfU5Um4ZpCzaQ== 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=z49mm4VSqdNYZlWWFiAkMujUb4pyfyf+byOBPncwc4s=; b=dWfb/wf2YaoGUpBzhSiDKlEWqoweU2z99nPAEFUdE/jDwEWLuj5DRvhIJnx7pIaPmFAFVAD2+BG4YpgXjweiasP39Sru9DTTHhKvNg6IBncp1KmPyidUC48T0UZ5FoJavawUz2yv+ai4GrUi+gmowzpciSsfvki1/64mw5WkJITWMHcIML+HkuKEELIf2kq/+v1EmWBvq+kXEdrQ6UsgG5MaLrSsW+aL/mzE5WSVXjOI/5oz+a8m3MHjv4+NZzPzm4zsxclaGD84ZXGM5yJjBDBrwmInCcSa9dMH9ABwiAaEVykDIkJuXvOHlHsk0jh4fl9ANtT6xYmCB8w7YiWqTA== 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=z49mm4VSqdNYZlWWFiAkMujUb4pyfyf+byOBPncwc4s=; b=Tva90utNccBbOpGLqKVOIW8zLd20Yt3N0b17+pAk+mBhqs1YEf60O8R2M5HNjqyOoSzL5WKVlCzT9DOAL6Ibp5gb9CGxi9BBid8voJsLTU3GgHtOQwh9jyD2DY+W1hvlPoidUiSj1rdU3ZdAPdoJrkbVwRaeSGM1RVVaidq3RPU= Received: from CH0PR03CA0003.namprd03.prod.outlook.com (2603:10b6:610:b0::8) by SA1PR12MB7442.namprd12.prod.outlook.com (2603:10b6:806:2b5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 05:51:53 +0000 Received: from CH1PEPF0000AD7E.namprd04.prod.outlook.com (2603:10b6:610:b0:cafe::81) by CH0PR03CA0003.outlook.office365.com (2603:10b6:610:b0::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:53 +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 CH1PEPF0000AD7E.mail.protection.outlook.com (10.167.244.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:53 +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, 18 Dec 2024 23:51:49 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 19/21] ASoC: amd: acp: add machine driver changes for ACP7.0 and ACP7.1 platforms Date: Thu, 19 Dec 2024 11:18:55 +0530 Message-ID: <20241219054857.2070420-20-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7E:EE_|SA1PR12MB7442:EE_ X-MS-Office365-Filtering-Correlation-Id: 12526e4e-284f-441e-3162-08dd1ff13d6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: aWC16sjuIubuElrDywsZETAs2gwiXWYqY2krv/MDSfK5M9+lbRm+FxmgUjYa54INaane2CD16mURxP1mP1A8ntRVtRObD8HBnkkf/pTGC2rrtKYX3bjjDdRC8zBvS8C/ikoQbrYpk96x7DRVWUIIegcDbcimrsHINSoxt0xazHdXvqDeZavbvoxhk0g7mxiZ2ullRYc4P+vCmUSJmk9X2lNa7QzxpFo9vn13D7j8qJTFeDIQC2v98l3cd5p2gF8n71/ciTv1cKi6N+WkTQLCm/mHmuRCgwxDyw7y0LPMLvL4j58Q7hT1KOeoaLqOqTjOMbFKIv+J/fPJ4VRJaGDek6vHxlr+pQSe/V8elkcYb/576IaO/m0uWtwiLa6ilC+irqnWARKrxQNx/fYxz+qVA4yuBIu4yTsNuSK+3ef5l6rwYmt61+DfRLXsc3+SJ+YZKS+2D3PVnsWiTX/BTrwbFItKo3VfuHPZ7bHy19/oCfxO9/qTpahysIQWfXDHIhR/2ycWDRFozIjeC4pcaYaWyEMi7d0vx9yxs76cqcXYRmX8YzB45iJNv7mo4Md2DTIq2fenYFbfjpicrwtSda8YlTlryAfhXM/2iQjM9fzz0Z4TXY/HoYZVQpM8zOd1kB5IhtozootyJ91CPygHu4aH8xeC5qzeQAEKIEuD6TrVz9Ys7+qcqDTSEmzlv5JQjKESzqKjlCsbgwNOE/3EjunASIAJYYxH/1Na8hhkKFe3IbleHgY6iqxiMztRb8+DmOtEM4Pbb0bEuHHceyCctgmjOA6Fv2QJEcHsoWVYvXPj9aFGdZ8oak14Eh2lWUskYu7BYdzyeTEof5x0zEHoGqjtD/LAzGzjrzE2oRnBa/Rx60W95fgxrlle1Q+eMIJNRnfW3hQzgFHHVQ/9gUR8cdBgUXbXp3F9BS7EJUzaqU1Z1DdwhVampdHxHAj5HHz9PE8f1hv/OXoXDVt14NtJ+PgfMqDJdEbAZjSsE6qE1yTiDaIiu8N8wFtrbiPXT2Gqysb4m0x+qyvQ7HdRR2iF3IFYzB+U8vBKhgQe4HFArk50F6CruZTiBoUKDoriBgaXBWfw/KkEIt4t6EK3nUUxrrMC4c6tKltPRFaS5p3mQnKvoVifK5q1pCBn3BsFdpkzv6+ACkrczs8jTpMKHlSRphZ6o6ZxTi1/I8x6IlFq33xPPccrqDuNT/G7CA2zp2j8XJv8dU024qnVmIHGDqb0+qOh7VqsQVMMKPKL9fo8jtRAzMUImbWwo3FUn4YwrBDpGCAKho0fgOAqClIOuR50bng6RUP6i9ZjbnBIJEIumuAZVWkkxtQtSck7xVW+nNbOGp6HOKurXMnVBs2IEy+eVToX+9wMyPwDc0jXqqrN8DRYpk+u2B/jOtQ/WnW4FUrbjwwTqF45tVPEjZbJLs4dlxVcTA20zlCmk6+SxrcLm8YVEh4zt+DkyXOGgDi4qIkJQbLXe/gd1vN85I9dCCbL9yXNDrQrVJsw7o2mD8DF92NXMLs= 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)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:53.3752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12526e4e-284f-441e-3162-08dd1ff13d6e 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: CH1PEPF0000AD7E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7442 Add SoundWire generic machine driver changes for legacy stack(No DSP) for ACP7.0 and ACP7.1 platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp/acp-sdw-legacy-mach.c | 16 ++++++++++++ sound/soc/amd/acp/acp-sdw-mach-common.c | 34 +++++++++++++++++++++++++ sound/soc/amd/acp/soc_amd_sdw_common.h | 11 ++++++++ 3 files changed, 61 insertions(+) diff --git a/sound/soc/amd/acp/acp-sdw-legacy-mach.c b/sound/soc/amd/acp/acp-sdw-legacy-mach.c index 9280cd30d19c..e27093d80cc6 100644 --- a/sound/soc/amd/acp/acp-sdw-legacy-mach.c +++ b/sound/soc/amd/acp/acp-sdw-legacy-mach.c @@ -122,6 +122,13 @@ static int create_sdw_dailink(struct snd_soc_card *card, if (ret) return ret; break; + case ACP70_PCI_REV: + case ACP71_PCI_REV: + ret = get_acp70_cpu_pin_id(ffs(soc_end->link_mask - 1), + *be_id, &cpu_pin_id, dev); + if (ret) + return ret; + break; default: return -EINVAL; } @@ -223,6 +230,10 @@ static int create_sdw_dailinks(struct snd_soc_card *card, case ACP63_PCI_REV: sdw_platform_component->name = "amd_ps_sdw_dma.0"; break; + case ACP70_PCI_REV: + case ACP71_PCI_REV: + sdw_platform_component->name = "amd_acp70_sdw_dma.0"; + break; default: return -EINVAL; } @@ -269,6 +280,11 @@ static int create_dmic_dailinks(struct snd_soc_card *card, pdm_cpu->name = "acp_ps_pdm_dma.0"; pdm_platform->name = "acp_ps_pdm_dma.0"; break; + case ACP70_PCI_REV: + case ACP71_PCI_REV: + pdm_cpu->name = "acp70_pdm_dma.0"; + pdm_platform->name = "acp70_pdm_dma.0"; + break; default: return -EINVAL; } diff --git a/sound/soc/amd/acp/acp-sdw-mach-common.c b/sound/soc/amd/acp/acp-sdw-mach-common.c index 6f5c39ed1a18..e5f394dc2f4c 100644 --- a/sound/soc/amd/acp/acp-sdw-mach-common.c +++ b/sound/soc/amd/acp/acp-sdw-mach-common.c @@ -59,6 +59,40 @@ int get_acp63_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct dev } EXPORT_SYMBOL_NS_GPL(get_acp63_cpu_pin_id, "SND_SOC_AMD_SDW_MACH"); +int get_acp70_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct device *dev) +{ + switch (sdw_link_id) { + case AMD_SDW0: + case AMD_SDW1: + switch (be_id) { + case SOC_SDW_JACK_OUT_DAI_ID: + *cpu_pin_id = ACP70_SW_AUDIO0_TX; + break; + case SOC_SDW_JACK_IN_DAI_ID: + *cpu_pin_id = ACP70_SW_AUDIO0_RX; + break; + case SOC_SDW_AMP_OUT_DAI_ID: + *cpu_pin_id = ACP70_SW_AUDIO1_TX; + break; + case SOC_SDW_AMP_IN_DAI_ID: + *cpu_pin_id = ACP70_SW_AUDIO1_RX; + break; + case SOC_SDW_DMIC_DAI_ID: + *cpu_pin_id = ACP70_SW_AUDIO2_RX; + break; + default: + dev_err(dev, "Invalid be id:%d\n", be_id); + return -EINVAL; + } + break; + default: + return -EINVAL; + } + dev_dbg(dev, "sdw_link_id:%d, be_id:%d, cpu_pin_id:%d\n", sdw_link_id, be_id, *cpu_pin_id); + return 0; +} +EXPORT_SYMBOL_NS_GPL(get_acp70_cpu_pin_id, "SND_SOC_AMD_SDW_MACH"); + MODULE_DESCRIPTION("AMD SoundWire Common Machine driver"); MODULE_AUTHOR("Vijendar Mukunda "); MODULE_LICENSE("GPL"); diff --git a/sound/soc/amd/acp/soc_amd_sdw_common.h b/sound/soc/amd/acp/soc_amd_sdw_common.h index b7bae107c13e..9bedccfe25a9 100644 --- a/sound/soc/amd/acp/soc_amd_sdw_common.h +++ b/sound/soc/amd/acp/soc_amd_sdw_common.h @@ -19,6 +19,8 @@ #define AMD_SDW_MAX_GROUPS 9 #define ACP63_PCI_REV 0x63 +#define ACP70_PCI_REV 0x70 +#define ACP71_PCI_REV 0x71 #define SOC_JACK_JDSRC(quirk) ((quirk) & GENMASK(3, 0)) #define ASOC_SDW_FOUR_SPK BIT(4) #define ASOC_SDW_ACP_DMIC BIT(5) @@ -38,11 +40,20 @@ #define ACP_DMIC_BE_ID 4 +#define ACP70_SW_AUDIO0_TX 0 +#define ACP70_SW_AUDIO1_TX 1 +#define ACP70_SW_AUDIO2_TX 2 + +#define ACP70_SW_AUDIO0_RX 3 +#define ACP70_SW_AUDIO1_RX 4 +#define ACP70_SW_AUDIO2_RX 5 + struct amd_mc_ctx { unsigned int acp_rev; unsigned int max_sdw_links; }; int get_acp63_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct device *dev); +int get_acp70_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct device *dev); #endif From patchwork Thu Dec 19 05:48:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914503 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2078.outbound.protection.outlook.com [40.107.92.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 303C7218ABC; Thu, 19 Dec 2024 05:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587522; cv=fail; b=M/OPWgDl72+F62WDJYJdcqFkBhP7S3E3qexJWooa7hdoJ4e5L9/DQMoGyh81GjR9jQofQCQSiSceQs0nOOzvDNX1ywIbi+bgI8rr6rB6ZStoEk1GfvrySxHXMJZgeNTxKkCA0CINkBPydf6DP19mMH/Lw9EX8zXeHdkhE9Xnmt8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587522; c=relaxed/simple; bh=U25s5aLwhsk2zL5rhOQf47JvTFjNh9sb8AGIQ+y1nWQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N/VodvuoIEEa21jVoUy9gdVtJGWH5UjFRXG9owT8msARoNzKzX3J44Cq/f3SfPuwRtq7mWyoJMBxzhtAb2j5BnlSQpmxIR9ilXNrBJIAGmEyf0yLag2qXuvNwL8P9B3o9PhP419dAaWZW0XOn+BvQnshUwMOikDcZQfIiEe56eU= 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=UIEFf3Rp; arc=fail smtp.client-ip=40.107.92.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="UIEFf3Rp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LUdDue1gnvcGP3xxunoKN8eh+vHzcdHxJkozTGtLrzcu2/YRmJEHRAQxSZKYnkSGoUC98wLh3atJcHaSvwV1C/QCLryl9G4YRknGOBMnK+96vMs4dBRkbQpwYg53zGWxQScXpYOFog+EO3wM4bwcIOVRd/+K2nViVa3FukptRM6DztaQMrIG5dgahNkQiS0eqzh624CJK8YquGr+VT+AcoFqxZ17kdjOmEW3U6m8Qi7MYZ59IIS3fveMmChYEf1r+KLXo/v+SgzXDsRPelMJZj03vVFH48n39s496LKTGxhBk2BNgP4DiEs7p3/PmKl6mOF2Ahnu6HcUuy1FpMxlyg== 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=5yvbuQE68I8CQBgTrrOyNfrUCUGPIKT7pMLZcWnPxk0=; b=cCEf50f/shlZbKAcyQzr01BIe4XBzkSBAhQMJBlRAsrnFqYlBagy00ezhBjAoku1m6O9bNlPaNAX6Jgulpl3r3cqmfixgCTVgY4wRr1E+xFBwurlCaKkhfXe4tGl1aqQxgqz/eEfo6PIabElhCLiilCTd7pWHUW5YAQA5iuu+Ix7DZ3JP4RNqv/KnWdX5SpdyGIIGV2tQ9TQ75IPYXG9XVTvf7XWdIJ2YCZSr1UZFoBEbGgGoVpi+BS8W2jURphv8BtkEwU+BHCS6y7mRT7f9yU5wpCoseANqRTiFKLBRAxfqgOk4N9MCWN1yWWJZ2yXfgBI1ICFZlJM6k1CBxFhsQ== 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=5yvbuQE68I8CQBgTrrOyNfrUCUGPIKT7pMLZcWnPxk0=; b=UIEFf3Rpnr3RtKpMVcfX4mJnce+cyxJm/Ar2qg3d4pN7fFjf6LjGc8l9z7nqZOxPfVFxQwlgO9WJ8zDTHM/9thM1GBhd8TaF264yAc2p12sJu/bJoO3kYNkhbL9Za4xe0K1xGDJwHQrlO3d5KgAVGIpFugBPF7/F2RAFd6PxSIk= Received: from CH2PR18CA0048.namprd18.prod.outlook.com (2603:10b6:610:55::28) by PH0PR12MB7861.namprd12.prod.outlook.com (2603:10b6:510:26e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 05:51:57 +0000 Received: from CH1PEPF0000AD81.namprd04.prod.outlook.com (2603:10b6:610:55:cafe::a7) by CH2PR18CA0048.outlook.office365.com (2603:10b6:610:55::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:51:56 +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 CH1PEPF0000AD81.mail.protection.outlook.com (10.167.244.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:51:56 +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, 18 Dec 2024 23:51:53 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 20/21] ASoC: amd: acp: add RT711, RT714 & RT1316 support for ACP7.0 platform Date: Thu, 19 Dec 2024 11:18:56 +0530 Message-ID: <20241219054857.2070420-21-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD81:EE_|PH0PR12MB7861:EE_ X-MS-Office365-Filtering-Correlation-Id: 034f671b-d096-461e-bfb7-08dd1ff13f74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: FMA61LdIr4NNQmVuuNTc8BhuNZygYvTm7S72oSBfCxLtUip+XCCEFFqGufOqHMsx+VVZDnZ7FwUY1FrPMk3uU3CbKt6S+oAhPkWIV5k53UDXipz7dzFA3YwQ9idO2KshIMmACXdL/DUsm2+gx72hCo/W4o+etK7mBRDZIv13AZ94+RwfYwUa69r2LDhTkPLDOe07EdVNjLDp+twZjCKqyx+jF0nnklxeCFyC2oMAXBAnWJ8Zpx29SJCEP24ytUDMkJ6neoJFQ0qtKcu/dKikw2bGkGNvoou9B+gjnrh/a+LzRkAWWM2sREwq3f/1MxJ9uVbhc/9MfWfYBl90ABeubZke4plo0/zFgR2UmX74TRnrhefnbDUFyD8IVFGalvHHUrCpExi8w3sPJmWbMhPD5ImkpT+ORz25DO1a+1WfG0GcuysKW7BmD1B/GCrbt+OO6abQkxT/5w198btAS5e+Yguxpwhv5w1IkbV8+oiKjO7+6eMZyfiC/k/8SzjVXFuCwSVIf0HD2fEcZTZn+i7JPs+8KwgmJkiEgLJV3eBEwL4IG+YNZGOPxstnnie+hor1trGC+UwmOlU44kvjkhYiRBI0XGqEklZodsq6vHKPBi7hmbWHNeU/ZgfRxm8i93mR5ZuVlngZyFcAQ9HgXE/Yh0cvh9rjjL1IYs3P9O8KmA5TQvNuNteMKs4/gvpX217leO12bHiK0m9dzfwne4K5pvKC1wCfjQ2GEC+1hJI6FB1wnLYWF2a6+Jkn8vjKjRu7gwQmQWjJK25mnlro2YXZm86zvaHXjbUI4VK4d1QXIePvhP4asXQ9Zqmk0kvQShd2AJSDhsz519n+nYjaXFGHYW98NsteoVtWioy2GQx72qeXO8t5MyRtEBT1MizjkcxkBdGKeu2fzpygOLyZ3+7VU3EXzoZgq1mAqiR9q/0K+D6MPti18e/19gKJuLQ1JIxnmIcuC0vM9ua3wuHZ1zbWmrd0h29eiMBfFLOwR5RcPfPBeWE5drL5e9WziWznEMWYH73VhT+/F6hk6jt7eL1dCIE2h17UwLXslEOQ7+cvrJuLvPho2n8liK4mqOjp3JncOJJ+w7Km0IRTTJci/MPLs0CJywTpJMl2HsjAMr5WghRJLheFshE1zQ8wvm4FGieqHBttUkkq+dLqGt693dBwsxXZc1b6/4i8YYrIuDTlwYWiOPOdbzy/Aw1qeCGdoarij8h4Y2wTrGUvTY4pNSDPsLeQcwRA8iGctcD8VxIky8khiU3geybkNSpdB3P8QqpPrdz6H7A4RJYyzP9K1gyZvL5DUV5B1KdUkhwGVShIyx4SouBSNJh+CCQ6kztPmPe2VqhvnAFIjFR6H7oWvK7ukCIaElmXPrvWJfByeXBlUgxcJp4dJTWg1s4Lxlvl6VPJUBeHApTHsQdp/rqsDM7bRUc4P09LjChISsWungJ/BgGLQ2FnJsTBJr05lInAbOqA16eThSPpqFF+duamfhKLCHvhHOCw2RfenEaQ3xKPDTg= 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)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:51:56.7892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 034f671b-d096-461e-bfb7-08dd1ff13f74 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: CH1PEPF0000AD81.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7861 Add support for corresponding codecs on ACP7.0 platform hardware configuration. SDW0: RT711 Jack SDW0: RT1316 Left Speaker SDW0: RT1316 Right Speaker SDW1: RT714 DMIC Signed-off-by: Vijendar Mukunda --- sound/soc/amd/Kconfig | 1 + sound/soc/amd/acp/Makefile | 2 +- sound/soc/amd/acp/amd-acp70-acpi-match.c | 88 ++++++++++++++++++++++++ sound/soc/amd/acp70/pci-acp70.c | 1 + sound/soc/amd/mach-config.h | 1 + 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 sound/soc/amd/acp/amd-acp70-acpi-match.c diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index 57743bc4fcea..de55fc7642c8 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -187,6 +187,7 @@ config SND_SOC_AMD_PS_MACH config SND_SOC_AMD_ACP70 tristate "AMD Audio Coprocessor-v7.0 SoundWire support" select SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE + select SND_SOC_ACPI_AMD_MATCH depends on X86 && PCI && ACPI help This option enables Audio Coprocessor i.e ACP v7.0 support. diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index bb2702036338..7c75892e678b 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -22,7 +22,7 @@ snd-acp70-y := acp70.o snd-acp-mach-y := acp-mach-common.o snd-acp-legacy-mach-y := acp-legacy-mach.o acp3x-es83xx/acp3x-es83xx.o snd-acp-sof-mach-y := acp-sof-mach.o -snd-soc-acpi-amd-match-y := amd-acp63-acpi-match.o +snd-soc-acpi-amd-match-y := amd-acp63-acpi-match.o amd-acp70-acpi-match.o snd-acp-sdw-mach-y := acp-sdw-mach-common.o snd-acp-sdw-sof-mach-y += acp-sdw-sof-mach.o snd-acp-sdw-legacy-mach-y += acp-sdw-legacy-mach.o diff --git a/sound/soc/amd/acp/amd-acp70-acpi-match.c b/sound/soc/amd/acp/amd-acp70-acpi-match.c new file mode 100644 index 000000000000..1f30adb6c02a --- /dev/null +++ b/sound/soc/amd/acp/amd-acp70-acpi-match.c @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * amd-acp70-acpi-match.c - tables and support for ACP 7.0 platform + * ACPI enumeration. + * + * Copyright 2024 Advanced Micro Devices, Inc. + */ + +#include +#include "../mach-config.h" + +static const struct snd_soc_acpi_endpoint single_endpoint = { + .num = 0, + .aggregated = 0, + .group_position = 0, + .group_id = 0 +}; + +static const struct snd_soc_acpi_endpoint spk_l_endpoint = { + .num = 0, + .aggregated = 1, + .group_position = 0, + .group_id = 1 +}; + +static const struct snd_soc_acpi_endpoint spk_r_endpoint = { + .num = 0, + .aggregated = 1, + .group_position = 1, + .group_id = 1 +}; + +static const struct snd_soc_acpi_adr_device rt711_rt1316_group_adr[] = { + { + .adr = 0x000030025D071101ull, + .num_endpoints = 1, + .endpoints = &single_endpoint, + .name_prefix = "rt711" + }, + { + .adr = 0x000030025D131601ull, + .num_endpoints = 1, + .endpoints = &spk_l_endpoint, + .name_prefix = "rt1316-1" + }, + { + .adr = 0x000032025D131601ull, + .num_endpoints = 1, + .endpoints = &spk_r_endpoint, + .name_prefix = "rt1316-2" + }, +}; + +static const struct snd_soc_acpi_adr_device rt714_adr[] = { + { + .adr = 0x130025d071401ull, + .num_endpoints = 1, + .endpoints = &single_endpoint, + .name_prefix = "rt714" + } +}; + +static const struct snd_soc_acpi_link_adr acp70_4_in_1_sdca[] = { + { .mask = BIT(0), + .num_adr = ARRAY_SIZE(rt711_rt1316_group_adr), + .adr_d = rt711_rt1316_group_adr, + }, + { + .mask = BIT(1), + .num_adr = ARRAY_SIZE(rt714_adr), + .adr_d = rt714_adr, + }, + {} +}; + +struct snd_soc_acpi_mach snd_soc_acpi_amd_acp70_sdw_machines[] = { + { + .link_mask = BIT(0) | BIT(1), + .links = acp70_4_in_1_sdca, + .drv_name = "amd_sdw", + }, + {}, +}; +EXPORT_SYMBOL(snd_soc_acpi_amd_acp70_sdw_machines); + +MODULE_DESCRIPTION("AMD ACP7.0 tables and support for ACPI enumeration"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); diff --git a/sound/soc/amd/acp70/pci-acp70.c b/sound/soc/amd/acp70/pci-acp70.c index ae19187fe695..d873e90e16d1 100644 --- a/sound/soc/amd/acp70/pci-acp70.c +++ b/sound/soc/amd/acp70/pci-acp70.c @@ -611,6 +611,7 @@ static int snd_acp70_probe(struct pci_dev *pci, adata->addr = addr; adata->reg_range = ACP70_REG_END - ACP70_REG_START; adata->acp_rev = pci->revision; + adata->machines = snd_soc_acpi_amd_acp70_sdw_machines; pci_set_master(pci); pci_set_drvdata(pci, adata); mutex_init(&adata->acp_lock); diff --git a/sound/soc/amd/mach-config.h b/sound/soc/amd/mach-config.h index a86c76f781f9..fdf016a64bbf 100644 --- a/sound/soc/amd/mach-config.h +++ b/sound/soc/amd/mach-config.h @@ -26,6 +26,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp63_sof_machines[]; extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp63_sdw_machines[]; extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp63_sof_sdw_machines[]; extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp70_sof_machines[]; +extern struct snd_soc_acpi_mach snd_soc_acpi_amd_acp70_sdw_machines[]; struct config_entry { u32 flags; From patchwork Thu Dec 19 05:48:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13914504 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2053.outbound.protection.outlook.com [40.107.244.53]) (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 346C4218AC8; Thu, 19 Dec 2024 05:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587524; cv=fail; b=KTbZX6L0ygCQTPE/ptAqmpiLH3bap55R0KcMEid8cUbwjlcqpUhMbJSxBk3cwAedUnJgG7I4fMi6CzzaL50p5pDwiSZkCnFPKa3MZlUbIo3PYEDJ2BrYmhR3lY9Hwyw2IMSo1wwN7s+roht0C45Cr2dxN+/2H5uYVwQJdpBlqEc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734587524; c=relaxed/simple; bh=lqjIWZ+WJZcU8bKMLCcoJ/Hqz6Te8rCBswOU6/yglLo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dO73rIeu2TqoBDSPfIICsFUVnzyLkUj70uz4bYI6eK0uzgkN876TmXuV0BQdRtgSKJIdfE37/zlaUsyiMBpTPcLgoUIWXodqop56J+GB/bJhDv8kYyFb99tGJ6JsdBNDNAHj+7Kcvb6Axjaz6DZnva0bjgfWgpBFm6ucmbkGiwo= 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=3iL9hJZ3; arc=fail smtp.client-ip=40.107.244.53 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="3iL9hJZ3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Oi/3t4XgYXv73W/V4JtSmoctNY6Ep/W+lPEIhimPsy5lUFnJPgAElADzaFKBQooJwn1jFLxUTc9fDH5LlaZFYfZUeaERJoN/ov7cXpsEQ3qYx4kTcRplyL4jd/zYgWfN2SZ4VMLJQVpcku0DeujdG1Gtb8vNaOxim9WuM360t4GpVMuOfd0ddkphpDd6ZzEkBdpK/HY7YxyKanktTQtGV3uqC5wzpzqsvMiV5a27rGFfgd80GZ7mY6haoijmT0JIEVyxtP/v252zXJA2JV2+4L33yS5INmIhb7XfZ6LEvR0GSpmI0RMKkcdH4+FHcJu3nv/dTojAVsAyJaLso0d48A== 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=hhnJuXfdhb5iveqaaBpOujpDVIlNkFwQ+T3wchTIrtU=; b=cCaFqf1yYey1Lj9H3TZORVmu62bNJpdlntYD7m6t3f5jljl0XQHHasNYsSy+iAgv+QDEN1BzzWa1wQ99MWERezShbEB+ie6GN0t94MRl832pL60lzRnbh9kKN9uz/Whl0QQTqXsbdDR0iwxK4D1+JfHIvOkkIssp2gR3yUpFiPxdLuHIiN9TyMy1EIidiyP64cZ8s89oxzLD/SoVpZgN17fGgDcFJVICCznmj2vyYNVY94tl7GKo8m6ztGzOKAXlG59VqL5mE/6Obbd4U35ipBCAmkS0i79ttmOIqHw0BV4K/c48bujJQ2RpDKBg6Pe0nwIPZL9rhaqBg3kIcopHkA== 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=hhnJuXfdhb5iveqaaBpOujpDVIlNkFwQ+T3wchTIrtU=; b=3iL9hJZ3x7Nh9pxUW8wtLG8lB78XHRFANblFaQ8tGN29S1vcv2PFJfaXqyUal/nyuCq59CN4McGMIrwkOCLOZTa9zTlRIda+qJ78knTJjFAs0ljn+1Yz+zPA/X3V4NllwDfqifBEqj2FlxywIAY4Fm1FlMmndxD4DpkDjQ05Yi0= Received: from CH5P222CA0007.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::19) by LV3PR12MB9437.namprd12.prod.outlook.com (2603:10b6:408:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.13; Thu, 19 Dec 2024 05:52:00 +0000 Received: from CH1PEPF0000AD7D.namprd04.prod.outlook.com (2603:10b6:610:1ee:cafe::3c) by CH5P222CA0007.outlook.office365.com (2603:10b6:610:1ee::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.23 via Frontend Transport; Thu, 19 Dec 2024 05:52:00 +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 CH1PEPF0000AD7D.mail.protection.outlook.com (10.167.244.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 19 Dec 2024 05:52:00 +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, 18 Dec 2024 23:51:56 -0600 From: Vijendar Mukunda To: CC: , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 21/21] ASoC: amd: acp: amd-acp70-acpi-match: Add rt722 support Date: Thu, 19 Dec 2024 11:18:57 +0530 Message-ID: <20241219054857.2070420-22-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241219054857.2070420-1-Vijendar.Mukunda@amd.com> References: <20241219054857.2070420-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: CH1PEPF0000AD7D:EE_|LV3PR12MB9437:EE_ X-MS-Office365-Filtering-Correlation-Id: a2f648df-0c0d-4cab-09e5-08dd1ff14175 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: 7AE4hLxR+UmLZre5lAtUqldDHHumDRaT5wLMa95IDAePLREFhERYe/H53/yZBjCnoDkaulqc5ihsnj4JDNlSzTfJpRGU43EIEuXi4OVXI/lSW1jvZR5OgRz+OwBCFTNif/2+CoghATBX6mK2qKUl6efaXDemeQx8DeIrSN0xwsOsEuYMRshLHmpsL8fxuOKq6wM3oqZWRAXwb7LjOEtHS6ZFF09U8P8/At45RYN2Q5zCpXCcg1zS2ggl9a+eY+zhmqGr4oOTfLcZWpnaCbWXvW8MLJEzRtw1aVnhovgvUJRhVdaXKJtdxflzK5jdMnuMHZ6QMZfausxy0WqQAUWk4ZcXcM1jneNEhEejUuWc5V+FAnWw4MMZ3dazCMp79Y4lbs4+hdCSsYn9v5Kptxn/PNxBwyFAuO2Mieow1OtY41fefgzO7UzVIMjkHW/qItNpAYK5/zU20pWQvQY2+PRBud7yErmM6/ifdmYiwG4QIC/biWujikWxFVlX9jWiWFYms/bymSs9SlBt/wqQSO7QiU2eKV0wWv9LFng1M7D6oj/8Qih8wOyc/U4pSMMFvKrNxx2pqIqy9chv3sn5c/SU/tAn+3uhTxsRkwX79XRuqf0GIXpBjZhVgGkz+HS6GnevlBSOGXgIlzymegBtiDA/a1NHVS7t2BjPjpUC7HrAnsyJ0bHGFhee7g/WFz8mbPxX+A0yypWWdnqBX2NStUNi8J2TXcpPDGbC5qVK3UqOIYiD2K9NDS2u3BJAVT4vh1ao6Ii4SuAv/a/0pGqoPZDsVzEjONClITgn9eJ8NjL+hjOru2Chy6Wq0csEHuCRI34jkeztwMam5B3K91CLBXPdwLZopohr2E4GP2B5uityUXIqCqAKGw1ak7d3CQHY2Vg3s1Btq1tTaFhbjC88TmxWeTx11Gz6EmDFpfUs5XA3F9m8Uem005ytZgz6x+CV6bRgpg6R+b/NxiZtg36pVdBfQAn4wWVcMQH0Qko0UFIJ5X3M3zcvfYyYGaCxYWFVM1TIBSPSwDQOeoWi/71ftxaxWv6r8de90uPGKkNqsftMH02xls8JRX8MhDykRpWPjxCy3yK1SjcZ+NGD46KagrJfFw+ME9xQtTBJ6BqhNLDZ2zYtdLe9rDqZr+1l2E+6S4pM1dWgYJV0eB4+7tN+uqb7B2QyRenLVSdr1DxgkmMLXEVJeBHidAgjydYdWfMO2isLhgufhCCdIXxqujFu82Q0xRxR22SC1x5oMkyEYdK0vLOZUtoTVLBljaQi3CLtvXUQMb5OepGBBlllsK8T/t7HLapIM5dp4m/gCY+1jk2FUIgNFKf+Uq59dvv05e4rX2loJmefegZR/guWqxw1sKDeBu5LlOztY5V0nRq6W/6iYMAHPipKKIkyMrKI91gjYRAaPJ8VXnBCct9ZbvzpRbJReX3lcn4bAxwYs97qhXXWNlECu4Wv4QyZfR1XNgd0LI9QsCKwvnQPPW5PHhyymqmuF8YOxPiC8lo4U0O0rBOPFXY= 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)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 05:52:00.1309 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a2f648df-0c0d-4cab-09e5-08dd1ff14175 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: CH1PEPF0000AD7D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9437 Patch adds driver data and match table for rt722 multi-function codec on acp7.0 and acp7.1 platforms at sdw link0 for legacy(NO DSP) stack. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/acp/amd-acp70-acpi-match.c | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/sound/soc/amd/acp/amd-acp70-acpi-match.c b/sound/soc/amd/acp/amd-acp70-acpi-match.c index 1f30adb6c02a..d31b681b19e2 100644 --- a/sound/soc/amd/acp/amd-acp70-acpi-match.c +++ b/sound/soc/amd/acp/amd-acp70-acpi-match.c @@ -73,7 +73,51 @@ static const struct snd_soc_acpi_link_adr acp70_4_in_1_sdca[] = { {} }; +static const struct snd_soc_acpi_endpoint rt722_endpoints[] = { + { + .num = 0, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, + { + .num = 1, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, + { + .num = 2, + .aggregated = 0, + .group_position = 0, + .group_id = 0, + }, +}; + +static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = { + { + .adr = 0x000030025d072201ull, + .num_endpoints = ARRAY_SIZE(rt722_endpoints), + .endpoints = rt722_endpoints, + .name_prefix = "rt722" + } +}; + +static const struct snd_soc_acpi_link_adr acp70_rt722_only[] = { + { + .mask = BIT(0), + .num_adr = ARRAY_SIZE(rt722_0_single_adr), + .adr_d = rt722_0_single_adr, + }, + {} +}; + struct snd_soc_acpi_mach snd_soc_acpi_amd_acp70_sdw_machines[] = { + { + .link_mask = BIT(0), + .links = acp70_rt722_only, + .drv_name = "amd_sdw", + }, { .link_mask = BIT(0) | BIT(1), .links = acp70_4_in_1_sdca,