From patchwork Mon Jun 26 13:55:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112963 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7514747vqr; Mon, 26 Jun 2023 07:15:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MIDeLeVwNJ2XbGcorUpYWepNjLCnIAHN1QfYxxwEt291JTLaXNrQHO3LKvbycr8qxudxS X-Received: by 2002:a17:902:d489:b0:1b7:e49f:d with SMTP id c9-20020a170902d48900b001b7e49f000dmr7241429plg.28.1687788928202; Mon, 26 Jun 2023 07:15:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687788928; cv=pass; d=google.com; s=arc-20160816; b=ks1bDomshCHjh3CoC5LVCSjPQxFqgCDSxE66nyh1Cuc7d9yO/JDrnXzwwhfCtW2tI3 AwJPxRfr7luy6HDQPVxAq5AJKQxNuDfN1deNreiton9ym05tHnTuMnmP8D18AqKXR1ET lWn7eCDFjK6rbq+CF8793JqwB6onBpFLUUo3IJ8jN2qJUh3LYAWPOcHkCBKDYLmgW/kH AfK8m+LnBvfL0qaw5w4L7OzsIw4rcM2a7oU9eUr0CcfD1XZpixLqd0USsPpt9khKzqpw gebURXuGYTGNfHrMmvX/TQMemKXPZdlpOWM8ICdChbE+HGXrLNrluvu0f/e+4mbMjG2o svfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UbI9ILpD1hBLiPbajlJP+NSVqXaQBaSS6i31eqGeTZM=; fh=SCA/wmo0TWGujcYZlGkvVUb7OAcFKs3JstccNyBF+bU=; b=Zn8L+STMlHXljX/T66jsPNHbsxfoGPFt0LSjb9EJItbp8qko2pFXOLpb0KWTwhaVOt tIm2q+k0ri2yWBVT1yyIS6OSETSd/cBaHypYRVcyurpxZQX6ph2yPwOoXUGazypeQ43W l9z0wtjo4nehfqqwSYrakxi4F2yrVTHJe6RaBP4m1zeL+ZYALcpMy46TKWasthleLJN8 NE1BVj+vmBiFG+3i1DKqPSB1rn25IXyyU8Hyybtu2q6Iqupbd4GTmu+36MpLb+kEA/Dn 4PwX1RNDojenTWljZoAkd01QNqnu1/KkbkovMeYkq+Jdjx/+rEl9JxCFrZKHUGl3N6mO VIWA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=mz7IsXc1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a170902d2ca00b001b54013c021si5351780plc.529.2023.06.26.07.15.14; Mon, 26 Jun 2023 07:15:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=mz7IsXc1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230154AbjFZN4D (ORCPT + 99 others); Mon, 26 Jun 2023 09:56:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjFZN4A (ORCPT ); Mon, 26 Jun 2023 09:56:00 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16CC5DD for ; Mon, 26 Jun 2023 06:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CdUMZsg2ORrzlH+N5kdRo9rDNGQCu2vJgOPmbG5F0cF2rag6EmkMzU2chLu5TjbvFD7+M76rmqa44YKnRi+qpP591nAH/t7R6H6tVeVO2ON4kgp78L0ADwqSCTuExlN5TevYu9Lw3Lp289EvyB8A6l0ETEJ1pAvqSO69OVki4OXuQrek0LhSD01kRp5lVi9t4n/TzDT2rBP6+F2QDudVK9bBkDIigp6N8CJFzKoxhZ8Qgo1Ivjd+zqgVkfTNUaTnmtWDQhw8iSuspmyf5XatAdgrT+lc5kzqU7roIVwiaKsllnfEhiXslZxf4VDZ33S7o7/gG5Wjw5QS4NHp8DzmVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=UbI9ILpD1hBLiPbajlJP+NSVqXaQBaSS6i31eqGeTZM=; b=IbpZ46wMezSaP6o+IXagR7GRY6+mNKZi1sY40vZdQLGy4wWgHcax+o4NjasGmnpbvRHuk8/lmQctWcteI0EufkVIjMtLwlLadofa8B7Z8yYPM6EdmWuiIB1LE+rc01kxahOIT+M5VvHyWXeO0CH09RyTOsSPRggzVwxGLZD3aqOfR6to1aRKhgTxq2bBmSYFAk30pxgsHlo3f5/DYXSKiNVgH1PGS31yEiFMw9LhsYTpn+Yy13IySSVWPpjNR4n4tSgq6QmdywXC3ZCX5RlJgS3ER7j5uoN9iN4m7M1ntJ4I8bVtQHNEtPlN4Q8scrlbT0Ac2V6+Vwu31DbuZLHOAA== 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 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=UbI9ILpD1hBLiPbajlJP+NSVqXaQBaSS6i31eqGeTZM=; b=mz7IsXc1cUOwq3Gpl4qGZdMo17jXZPHrvWeuSYwOkDwWT65YdI/Jnt4doWeY9FNdhkLs0geWvT4kMfMBP8/9gxGAvwlQb9ES18sIiNGRForvUqysm/5nkELAhuTqKSbfwiK1cZ/ycs35CI4SkhlEcEigbXKgXjpiCDyriM5e/tw= Received: from BN9PR03CA0726.namprd03.prod.outlook.com (2603:10b6:408:110::11) by BL3PR12MB6595.namprd12.prod.outlook.com (2603:10b6:208:38e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Mon, 26 Jun 2023 13:55:53 +0000 Received: from BN8NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:408:110:cafe::c5) by BN9PR03CA0726.outlook.office365.com (2603:10b6:408:110::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:55: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 BN8NAM11FT034.mail.protection.outlook.com (10.13.176.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:55:53 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.23; Mon, 26 Jun 2023 08:55:53 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 06:55:52 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:55:47 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Yang Yingliang , Venkata Prasad Potturu , ye xingchen , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Nicolas Ferre , Ajit Kumar Pandey , open list Subject: [PATCH v2 01/10] ASoC: amd: acp: refactor the acp init and de-init sequence Date: Mon, 26 Jun 2023 19:25:05 +0530 Message-ID: <20230626135515.1252063-2-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT034:EE_|BL3PR12MB6595:EE_ X-MS-Office365-Filtering-Correlation-Id: 4abdf23e-36f6-449d-2ae2-08db764d0eb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vZZr7E908hnfIx/w/2c/k6CAn2m8Sdq0sFcjpJcz94waT752/MgJMIVeYaWfzgEfULb4N/P5iGwnCsz8Yld6GQvc9l8Jj1RWGmZmUoqstD7GWJfx8LoTgrAwjpgQfqh8cboyl0wSfGgCuD/oWL98gnXt/ODP4N9GhV39+EdD5Ntp5WwIXfs4L/41Z6Z6AUR67dvzy6mBDxu8Wpp7NUplnyVHdPmexfu4UHfD0pVyCIDmKyNMQtEXc6JcpO9LdHku/UKfLRa+PVvPNt1NOrquey3aeL21i0P5b1xYHcMI0V0YsA4qFHNbyXz9BnyjXo/EFAHa/gL2XmQ2bmJvD9p5WZVEJ9ERM8u4yDEoMlsBa75PGph1BWLRzhH82HhZWyZMc5y8QvX9Mk61C45YN1GOBwSkHcEaW2tIgb+fkjHsWi/yS/iLZvbPVLQeUziVB3PIJzRfhWgf3G0SpZXLfvMGhOYO2USvYh2L55ZT222yAiVw/GJBqWlsT3FSElQFK073X9iTFAl2cCKwMqls68UQAVH4ZmJR0xdjYoz44AIi0+PzyFSm9wsaTjunVg+nGhc6nSug/67NJowCVUJu3UV647apC/2W6Gh0BvJ/yyZ4PHJQbAK5j1tw0y5yWJWeWOPhAeDhp4Yt2il121v2wgUTXMNnQ86AO4/rzKrLA305BvmbZwUJ7KNdG61cnmKedyR7x0zNvEssTSbdfEpcrs3crcASZVAAhS7Ob5qDOEnuRl5sbpNZE0S+ssbPbBWJQfpdvhdLslytFW4CO7NR11YFUg== 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:(13230028)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(2906002)(30864003)(7696005)(82310400005)(82740400003)(356005)(6666004)(81166007)(2616005)(83380400001)(336012)(426003)(186003)(1076003)(47076005)(26005)(36860700001)(41300700001)(86362001)(54906003)(110136005)(478600001)(40480700001)(70586007)(70206006)(36756003)(316002)(4326008)(8936002)(8676002)(5660300002)(7416002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:55:53.3705 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4abdf23e-36f6-449d-2ae2-08db764d0eb2 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: BN8NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6595 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769774963054774131?= X-GMAIL-MSGID: =?utf-8?q?1769774963054774131?= Remove the individual acp init and de-init functions from different variants of acp pci driver(for renoir/rembrandt platforms) and use a common file to define callbacks and refactor the callbacks to support existing platforms. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/Kconfig | 4 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-legacy-common.c | 99 +++++++++++++++++++++++ sound/soc/amd/acp/acp-pci.c | 9 +++ sound/soc/amd/acp/acp-rembrandt.c | 110 -------------------------- sound/soc/amd/acp/acp-renoir.c | 92 --------------------- sound/soc/amd/acp/amd.h | 21 +++++ 7 files changed, 135 insertions(+), 202 deletions(-) create mode 100644 sound/soc/amd/acp/acp-legacy-common.c diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index ce0037810743..6a369e5d825c 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -18,6 +18,9 @@ if SND_SOC_AMD_ACP_COMMON config SND_SOC_AMD_ACP_PDM tristate +config SND_SOC_AMD_ACP_LEGACY_COMMON + tristate + config SND_SOC_AMD_ACP_I2S tristate @@ -28,6 +31,7 @@ config SND_SOC_AMD_ACP_PCM config SND_SOC_AMD_ACP_PCI tristate "AMD ACP PCI Driver Support" depends on X86 && PCI + select SND_SOC_AMD_ACP_LEGACY_COMMON help This options enables generic PCI driver for ACP device. diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index d9abb0ee5218..4e65fdbc8dca 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -8,6 +8,7 @@ snd-acp-pcm-objs := acp-platform.o snd-acp-i2s-objs := acp-i2s.o snd-acp-pdm-objs := acp-pdm.o +snd-acp-legacy-common-objs := acp-legacy-common.o snd-acp-pci-objs := acp-pci.o #platform specific driver @@ -22,6 +23,7 @@ snd-acp-sof-mach-objs := acp-sof-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o obj-$(CONFIG_SND_SOC_AMD_ACP_PDM) += snd-acp-pdm.o +obj-$(CONFIG_SND_SOC_AMD_ACP_LEGACY_COMMON) += snd-acp-legacy-common.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCI) += snd-acp-pci.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c new file mode 100644 index 000000000000..5b7000eae693 --- /dev/null +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2023 Advanced Micro Devices, Inc. +// +// Authors: Syed Saba Kareem +// + +/* + * Common file to be used by amd platforms + */ + +#include "amd.h" +#include + +static int acp_power_on(struct acp_chip_info *chip) +{ + u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; + void __iomem *base; + + base = chip->base; + switch (chip->acp_rev) { + case ACP3X_DEV: + acp_pgfsm_stat_reg = ACP_PGFSM_STATUS; + acp_pgfsm_ctrl_reg = ACP_PGFSM_CONTROL; + break; + case ACP6X_DEV: + acp_pgfsm_stat_reg = ACP6X_PGFSM_STATUS; + acp_pgfsm_ctrl_reg = ACP6X_PGFSM_CONTROL; + break; + default: + return -EINVAL; + } + + val = readl(base + acp_pgfsm_stat_reg); + if (val == ACP_POWERED_ON) + return 0; + + if ((val & ACP_PGFSM_STATUS_MASK) != ACP_POWER_ON_IN_PROGRESS) + writel(ACP_PGFSM_CNTL_POWER_ON_MASK, base + acp_pgfsm_ctrl_reg); + + return readl_poll_timeout(base + acp_pgfsm_stat_reg, val, + !val, DELAY_US, ACP_TIMEOUT); +} + +static int acp_reset(void __iomem *base) +{ + u32 val; + int ret; + + writel(1, base + ACP_SOFT_RESET); + ret = readl_poll_timeout(base + ACP_SOFT_RESET, val, val & ACP_SOFT_RST_DONE_MASK, + DELAY_US, ACP_TIMEOUT); + if (ret) + return ret; + + writel(0, base + ACP_SOFT_RESET); + return readl_poll_timeout(base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); +} + +int acp_init(struct acp_chip_info *chip) +{ + int ret; + + /* power on */ + ret = acp_power_on(chip); + if (ret) { + pr_err("ACP power on failed\n"); + return ret; + } + writel(0x01, chip->base + ACP_CONTROL); + + /* Reset */ + ret = acp_reset(chip->base); + if (ret) { + pr_err("ACP reset failed\n"); + return ret; + } + return 0; +} +EXPORT_SYMBOL_NS_GPL(acp_init, SND_SOC_ACP_COMMON); + +int acp_deinit(void __iomem *base) +{ + int ret; + + /* Reset */ + ret = acp_reset(base); + if (ret) + return ret; + + writel(0, base + ACP_CONTROL); + return 0; +} +EXPORT_SYMBOL_NS_GPL(acp_deinit, SND_SOC_ACP_COMMON); + +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index 8154fbfd1229..a51cf7f32f7d 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -106,6 +106,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id goto unregister_dmic_dev; } + acp_init(chip); res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL); if (!res) { ret = -ENOMEM; @@ -154,10 +155,17 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id static void acp_pci_remove(struct pci_dev *pci) { + struct acp_chip_info *chip; + int ret; + + chip = pci_get_drvdata(pci); if (dmic_dev) platform_device_unregister(dmic_dev); if (pdev) platform_device_unregister(pdev); + ret = acp_deinit(chip->base); + if (ret) + dev_err(&pci->dev, "ACP de-init failed\n"); } /* PCI IDs */ @@ -177,4 +185,5 @@ static struct pci_driver snd_amd_acp_pci_driver = { module_pci_driver(snd_amd_acp_pci_driver); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(SND_SOC_ACP_COMMON); MODULE_ALIAS(DRV_NAME); diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 1b997837c7d8..59b1653b8479 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -24,26 +24,6 @@ #define DRV_NAME "acp_asoc_rembrandt" -#define ACP6X_PGFSM_CONTROL 0x1024 -#define ACP6X_PGFSM_STATUS 0x1028 - -#define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001 - -#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 -#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00 -#define ACP_PGFSM_STATUS_MASK 0x03 -#define ACP_POWERED_ON 0x00 -#define ACP_POWER_ON_IN_PROGRESS 0x01 -#define ACP_POWERED_OFF 0x02 -#define ACP_POWER_OFF_IN_PROGRESS 0x03 - -#define ACP_ERROR_MASK 0x20000000 -#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF - - -static int rmb_acp_init(void __iomem *base); -static int rmb_acp_deinit(void __iomem *base); - static struct acp_resource rsrc = { .offset = 0, .no_of_ctrls = 2, @@ -180,54 +160,6 @@ static struct snd_soc_dai_driver acp_rmb_dai[] = { }, }; -static int acp6x_power_on(void __iomem *base) -{ - u32 val; - int timeout; - - val = readl(base + ACP6X_PGFSM_STATUS); - - if (val == ACP_POWERED_ON) - return 0; - - if ((val & ACP_PGFSM_STATUS_MASK) != - ACP_POWER_ON_IN_PROGRESS) - writel(ACP_PGFSM_CNTL_POWER_ON_MASK, - base + ACP6X_PGFSM_CONTROL); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP6X_PGFSM_STATUS); - if (!val) - return 0; - udelay(1); - } - return -ETIMEDOUT; -} - -static int acp6x_reset(void __iomem *base) -{ - u32 val; - int timeout; - - writel(1, base + ACP_SOFT_RESET); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP_SOFT_RESET); - if (val & ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK) - break; - cpu_relax(); - } - writel(0, base + ACP_SOFT_RESET); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP_SOFT_RESET); - if (!val) - return 0; - cpu_relax(); - } - return -ETIMEDOUT; -} - static void acp6x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -248,43 +180,6 @@ static void acp6x_disable_interrupts(struct acp_dev_data *adata) writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); } -static int rmb_acp_init(void __iomem *base) -{ - int ret; - - /* power on */ - ret = acp6x_power_on(base); - if (ret) { - pr_err("ACP power on failed\n"); - return ret; - } - writel(0x01, base + ACP_CONTROL); - - /* Reset */ - ret = acp6x_reset(base); - if (ret) { - pr_err("ACP reset failed\n"); - return ret; - } - - return 0; -} - -static int rmb_acp_deinit(void __iomem *base) -{ - int ret = 0; - - /* Reset */ - ret = acp6x_reset(base); - if (ret) { - pr_err("ACP reset failed\n"); - return ret; - } - - writel(0x00, base + ACP_CONTROL); - return 0; -} - static int rembrandt_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -303,8 +198,6 @@ static int rembrandt_audio_probe(struct platform_device *pdev) return -ENODEV; } - rmb_acp_init(chip->base); - adata = devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL); if (!adata) return -ENOMEM; @@ -345,9 +238,6 @@ static void rembrandt_audio_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - struct acp_chip_info *chip = dev_get_platdata(dev); - - rmb_acp_deinit(chip->base); acp6x_disable_interrupts(adata); acp_platform_unregister(dev); diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index f188365fe214..a73fd70171c1 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -25,20 +25,6 @@ #define DRV_NAME "acp_asoc_renoir" -#define ACP_SOFT_RST_DONE_MASK 0x00010001 - -#define ACP_PWR_ON_MASK 0x01 -#define ACP_PWR_OFF_MASK 0x00 -#define ACP_PGFSM_STAT_MASK 0x03 -#define ACP_POWERED_ON 0x00 -#define ACP_PWR_ON_IN_PROGRESS 0x01 -#define ACP_POWERED_OFF 0x02 -#define DELAY_US 5 -#define ACP_TIMEOUT 500 - -#define ACP_ERROR_MASK 0x20000000 -#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF - static struct acp_resource rsrc = { .offset = 20, .no_of_ctrls = 1, @@ -154,38 +140,6 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = { }, }; -static int acp3x_power_on(void __iomem *base) -{ - u32 val; - - val = readl(base + ACP_PGFSM_STATUS); - - if (val == ACP_POWERED_ON) - return 0; - - if ((val & ACP_PGFSM_STAT_MASK) != ACP_PWR_ON_IN_PROGRESS) - writel(ACP_PWR_ON_MASK, base + ACP_PGFSM_CONTROL); - - return readl_poll_timeout(base + ACP_PGFSM_STATUS, val, !val, DELAY_US, ACP_TIMEOUT); -} - -static int acp3x_reset(void __iomem *base) -{ - u32 val; - int ret; - - writel(1, base + ACP_SOFT_RESET); - - ret = readl_poll_timeout(base + ACP_SOFT_RESET, val, val & ACP_SOFT_RST_DONE_MASK, - DELAY_US, ACP_TIMEOUT); - if (ret) - return ret; - - writel(0, base + ACP_SOFT_RESET); - - return readl_poll_timeout(base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); -} - static void acp3x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -206,37 +160,6 @@ static void acp3x_disable_interrupts(struct acp_dev_data *adata) writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); } -static int rn_acp_init(void __iomem *base) -{ - int ret; - - /* power on */ - ret = acp3x_power_on(base); - if (ret) - return ret; - - writel(0x01, base + ACP_CONTROL); - - /* Reset */ - ret = acp3x_reset(base); - if (ret) - return ret; - - return 0; -} - -static int rn_acp_deinit(void __iomem *base) -{ - int ret = 0; - - /* Reset */ - ret = acp3x_reset(base); - if (ret) - return ret; - - writel(0x00, base + ACP_CONTROL); - return 0; -} static int renoir_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -256,12 +179,6 @@ static int renoir_audio_probe(struct platform_device *pdev) return -ENODEV; } - ret = rn_acp_init(chip->base); - if (ret) { - dev_err(&pdev->dev, "ACP Init failed\n"); - return -EINVAL; - } - adata = devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL); if (!adata) return -ENOMEM; @@ -300,17 +217,8 @@ static void renoir_audio_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - struct acp_chip_info *chip; - int ret; - - chip = dev_get_platdata(&pdev->dev); acp3x_disable_interrupts(adata); - - ret = rn_acp_deinit(chip->base); - if (ret) - dev_err(&pdev->dev, "ACP de-init Failed (%pe)\n", ERR_PTR(ret)); - acp_platform_unregister(dev); } diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 5f2119f42271..83c9a3ba8584 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -92,6 +92,25 @@ #define SLOT_WIDTH_24 0x18 #define SLOT_WIDTH_32 0x20 +#define ACP6X_PGFSM_CONTROL 0x1024 +#define ACP6X_PGFSM_STATUS 0x1028 + +#define ACP_SOFT_RST_DONE_MASK 0x00010001 + +#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 +#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00 +#define ACP_PGFSM_STATUS_MASK 0x03 +#define ACP_POWERED_ON 0x00 +#define ACP_POWER_ON_IN_PROGRESS 0x01 +#define ACP_POWERED_OFF 0x02 +#define ACP_POWER_OFF_IN_PROGRESS 0x03 + +#define ACP_ERROR_MASK 0x20000000 +#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xffffffff + +#define ACP_TIMEOUT 500 +#define DELAY_US 5 + struct acp_chip_info { char *name; /* Platform name */ unsigned int acp_rev; /* ACP Revision id */ @@ -168,6 +187,8 @@ int acp_platform_unregister(struct device *dev); int acp_machine_select(struct acp_dev_data *adata); +int acp_init(struct acp_chip_info *chip); +int acp_deinit(void __iomem *base); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); From patchwork Mon Jun 26 13:55:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112964 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7514905vqr; Mon, 26 Jun 2023 07:15:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68/wpmWRFoSqiUTtTr6dlZeIZojkXv4A0xlfv4WgfMOIw02qwGMbPUKTlvvoBshtAcTwb5 X-Received: by 2002:a05:6a20:918d:b0:127:b4d:551e with SMTP id v13-20020a056a20918d00b001270b4d551emr2980115pzd.13.1687788935848; Mon, 26 Jun 2023 07:15:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687788935; cv=pass; d=google.com; s=arc-20160816; b=MPMc8rBn1m3dmxfBPykV5SNQZGCn47gcTyX1ZfQV1b1i8ZnOQtz7Cf0v0EADkABp4a pTd7GPjvHLl/k86IR8VlIZTqaNT4GUnEExK5+4hwAebrNPlpWE2EJ0B5mz/MTswSuntp LAIiXeyXS1NT9iIP1TFCc7D7HR/Hlp5eqpxFm8iSc9hlm3hF471WeEx5L734cdJ/vuj+ Fv8d6zwu0Asb9YwwdeGe7JC1jZocBw+ZpgY0WgbHGly4MgHM8TPtsAZ5aqsyIGl6gDG8 gAbTbXhaBQsDeuVjuYhU2anApvU1XMGROp7wyna7SbZKr3/SEB1Ad2YrDMF/9J4mYR2F /evQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Mdo4IP/A/wiEj4Q8e+VleHB4YIhHhCP13+qmEsMKgSc=; fh=86Ge+Y+6tR+MHXY7EMI835RzOWrQWdFAoKSsulu9Ng8=; b=tWB0vmJK5cAlutp8cg8IeHYkRLmKpoh3vRJzSeYbtXDwQ9q5EoF4kuuCZ1W1Huxw+L 4xmIFy1ZtIBYx7LE4MU5ZxiL4zfOXGH4pmfkkpedJxr6PtuNV7N5f9dSgm3db4vYmnX2 p8VG89jY7Svdpx+sbW0Eh/G7FriBxmPgz+9yalRSa/PjYarMmmsEdfSGOAeyaCR4QVCt x4sh12QcU2jRVsrUQgMXF7Eqdy+onWdR0ohvnyj4oD96EQ1OwQMZyKPsBVTG/D/qfoHx eIacbhMaPGvFoABnGzSqpAQaH6ZzNsJVaq5h0wRhsTqmc4zZS8J7ltvt61oqbudZKHCk xgdw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=c4cdq+dR; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a056a00085100b00654355ac8a5si5152251pfk.56.2023.06.26.07.15.21; Mon, 26 Jun 2023 07:15:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=c4cdq+dR; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbjFZN4T (ORCPT + 99 others); Mon, 26 Jun 2023 09:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjFZN4R (ORCPT ); Mon, 26 Jun 2023 09:56:17 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2078.outbound.protection.outlook.com [40.107.93.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE29C10CA for ; Mon, 26 Jun 2023 06:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h9yObnqTc17dBl1iVRPrm59W/q3CYkwI4eHZ0iuthlzZcXuTqUt4HRrzQtJfgtRQSJ3UeLXgliG6xAH2E6saIchx7cL4mQ5Fo/jinPU8dzUsXiHHerIk91Lsvn7JWXGZ5wET9PsJjZlIk7nP4mNJjuGjUbPdSP88EGSVHG6c0L9OgBpdEvc2z9HnDeNHyb7ifM10Z5VQrq8Qq8Tj4NEuRB83XGsztXyc4KYCfftCPcQyEVoH8HsdKHiWxaDHZlBl8wemCT39rHM6Rd2IEJQpu8M0JSHER0ITwrmU7hhMyTDnQN2ASD4/ArDmUbaFvdWSl/BCeU3a2oTnjRFJsnhUiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Mdo4IP/A/wiEj4Q8e+VleHB4YIhHhCP13+qmEsMKgSc=; b=iofAaE86gMA/y601JoGbWvBo+OJP/gjgxM3yMPy6wZlcpSaDzuEGrwFeaJPA4IE9jzQt+vI+RXMqj3YpdxAFQdCyDABeUWgUoXrXVQDQxw9l40KyzmJLkoE8iNefYQjqO76LXpfHb/JLBfq+tLLJrySB4PsChR4ZohkefdDp0bIVmmgUSiMaBZ5YfVEPGqWurg95Kw9SEMQXO588ziDH7s4BFPTP4HD0L42SZExtmyCyLSZxEjWFK9pdqcMn+RwZHmjtQDkqjNt1yNE3ZpktXGqxmeLyGm6wtjxzZHYgY1Geej73pipV25jN8bgbSkjeGdt8rO0jop/IwFM3MnNCQQ== 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 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=Mdo4IP/A/wiEj4Q8e+VleHB4YIhHhCP13+qmEsMKgSc=; b=c4cdq+dR/FHLgVAzLJg4ySWnYIJTnKN9jP2ZMF82Q4lOb41dOTfsv2piLNTrZweqQEQ9jt+GKwM+UXvDYtVrzLAkkwsNRXLy2dg2AjaOs6GJalawww65y7rtx3bf++5VxaEvCzntWj87QoxigY0Ypl7hzRNUOhKuc/ezvRzAMyo= Received: from BN8PR04CA0032.namprd04.prod.outlook.com (2603:10b6:408:70::45) by PH0PR12MB5450.namprd12.prod.outlook.com (2603:10b6:510:e8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.21; Mon, 26 Jun 2023 13:56:08 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:70:cafe::bf) by BN8PR04CA0032.outlook.office365.com (2603:10b6:408:70::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56:08 +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 BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:08 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.23; Mon, 26 Jun 2023 08:56:05 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:00 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , "V Sujith Kumar Reddy" , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , "Venkata Prasad Potturu" , Ajit Kumar Pandey , open list Subject: [PATCH v2 02/10] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform Date: Mon, 26 Jun 2023 19:25:06 +0530 Message-ID: <20230626135515.1252063-3-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT054:EE_|PH0PR12MB5450:EE_ X-MS-Office365-Filtering-Correlation-Id: 138683e3-457a-435f-278d-08db764d17c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mnh7wQzzagLBE4QApXI+SE7xbrTkzSyKFK1106B+AmOF4jWhYP4w4e0stuf7dQmCNZ45qKMY21kNEnJr0+3HJzZubQde867pAx7cyLC4eTqWdkYCew6n3ZZGg/wxkepNqpu/g3crZ7Pk4pZTi/cafVIRItHj5MdWB7APM++lciQ/172P/mQ8uWsZAV4xQYsLVNE8m6jp/K0OD47pflFWzMW6phNWHU0td/PeOEES5VPRrTu+CMgMm7yNGZN0h/rD0wQOg4ymS0xidqHERBVo7Iu3pY7KARqB9ou0uvsFuj5+PzLxwRHmAC2GQIHYNIkwYOEGy5ka5ytuGPnQcAgktHWO7EnpPcJo8TQ5uSKldhpIjx/vWiWs1BTo+UmwUXYFmFZZhnW8e+7lT3YSRjMYHXnFUiCnKGpszoPSq34jzrjOGirRE5U0zH7WwIEIlBKwYpdbraczBnFOqs0tP8dd2OH/44gkT+/FOEmiAjyXuN7V4pE6lNBfyPzzhyc8aVnuGamDPaoSLwehQJUIacS3apf0RWIZGO44TcNrNRsJZj3KrGTU922S8xxgwVbQDX0w2pDY0umWNIC3P3ppDzlZxk2G1gnip1975ucQA3mS5SKuA3DE84WkvEPU6i59PT56QMZu1zou8lQHHxXkWPLxMyn0cDqFxK/Eh5Rf85uALkdsIPKvXzIdme4fhe+tRi+1L4uziLsriz6IU748aDbsgvbpYqD+rd2v65D5/FJMgPZ3rM9OnbKn15F1a74td8l/TSkBy+oSm4cyrtUm7Zu9nQ== 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:(13230028)(4636009)(136003)(39860400002)(396003)(376002)(346002)(451199021)(36840700001)(46966006)(40470700004)(110136005)(7696005)(478600001)(54906003)(2906002)(26005)(186003)(1076003)(82310400005)(316002)(70206006)(8676002)(41300700001)(5660300002)(70586007)(8936002)(81166007)(356005)(36756003)(4326008)(40460700003)(82740400003)(86362001)(36860700001)(47076005)(83380400001)(40480700001)(336012)(426003)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:08.6141 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 138683e3-457a-435f-278d-08db764d17c8 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: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5450 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769774971236190307?= X-GMAIL-MSGID: =?utf-8?q?1769774971236190307?= Add acp i2s master clock generation logic for rembrandt platform. Signed-off-by: V Sujith Kumar Reddy Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-legacy-common.c | 19 +++++++++++++++++++ sound/soc/amd/acp/acp-rembrandt.c | 26 ++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 3 +++ 3 files changed, 48 insertions(+) diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c index 5b7000eae693..4302d8db88a4 100644 --- a/sound/soc/amd/acp/acp-legacy-common.c +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -13,6 +13,7 @@ */ #include "amd.h" +#include #include static int acp_power_on(struct acp_chip_info *chip) @@ -96,4 +97,22 @@ int acp_deinit(void __iomem *base) } EXPORT_SYMBOL_NS_GPL(acp_deinit, SND_SOC_ACP_COMMON); +int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data) +{ + pci_write_config_dword(dev, 0x60, smn_addr); + pci_write_config_dword(dev, 0x64, data); + return 0; +} +EXPORT_SYMBOL_NS_GPL(smn_write, SND_SOC_ACP_COMMON); + +int smn_read(struct pci_dev *dev, u32 smn_addr) +{ + u32 data; + + pci_write_config_dword(dev, 0x60, smn_addr); + pci_read_config_dword(dev, 0x64, &data); + return data; +} +EXPORT_SYMBOL_NS_GPL(smn_read, SND_SOC_ACP_COMMON); + MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 59b1653b8479..82a1bf2ddfc6 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -19,11 +19,17 @@ #include #include #include +#include #include "amd.h" #define DRV_NAME "acp_asoc_rembrandt" +#define MP1_C2PMSG_69 0x3B10A14 +#define MP1_C2PMSG_85 0x3B10A54 +#define MP1_C2PMSG_93 0x3B10A74 +#define HOST_BRIDGE_ID 0x14B5 + static struct acp_resource rsrc = { .offset = 0, .no_of_ctrls = 2, @@ -160,6 +166,25 @@ static struct snd_soc_dai_driver acp_rmb_dai[] = { }, }; +static int acp6x_master_clock_generate(struct device *dev) +{ + int data = 0; + struct pci_dev *smn_dev; + + smn_dev = pci_get_device(PCI_VENDOR_ID_AMD, HOST_BRIDGE_ID, NULL); + if (!smn_dev) { + dev_err(dev, "Failed to get host bridge device\n"); + return -ENODEV; + } + + smn_write(smn_dev, MP1_C2PMSG_93, 0); + smn_write(smn_dev, MP1_C2PMSG_85, 0xC4); + smn_write(smn_dev, MP1_C2PMSG_69, 0x4); + read_poll_timeout(smn_read, data, data, DELAY_US, + ACP_TIMEOUT, false, smn_dev, MP1_C2PMSG_93); + return 0; +} + static void acp6x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -228,6 +253,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev) acp_machine_select(adata); dev_set_drvdata(dev, adata); + acp6x_master_clock_generate(dev); acp6x_enable_interrupts(adata); acp_platform_register(dev); diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 83c9a3ba8584..96bd87290eee 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -187,6 +187,9 @@ int acp_platform_unregister(struct device *dev); int acp_machine_select(struct acp_dev_data *adata); +int smn_read(struct pci_dev *dev, u32 smn_addr); +int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data); + int acp_init(struct acp_chip_info *chip); int acp_deinit(void __iomem *base); /* Machine configuration */ From patchwork Mon Jun 26 13:55:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7515915vqr; Mon, 26 Jun 2023 07:16:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Kda3N/uX5AHOKIHwY7VN5yBHKdjbzze1j5YUL45zYoq4UraaXyiJ02HN6QaC8hKrZWH16 X-Received: by 2002:a17:902:f7cb:b0:1b7:f99f:63ca with SMTP id h11-20020a170902f7cb00b001b7f99f63camr4451534plw.34.1687789013451; Mon, 26 Jun 2023 07:16:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687789013; cv=pass; d=google.com; s=arc-20160816; b=l52U493ZCu0XGjBv67FEU5xYHSGSAI4W38/G9Je49B77uZ0kUqEnlMsPxQg6d0htLS L/A+XNjLBbIBMbdySz0hKyzOgNAsIXETLEe9buMfSRTT4VeiTHoovQ3eqZkiKbQ6bObF rpkSMBSzsWd5qk1XDr94RZpT1ipJUhhwj0Qadx+hoRsoDdBUeT18aTG8jeh+q4lbK+I0 F8sqdn+I0jVp9qU+l7yktwEP7QAHg2XnfheFM80EGWysoZgz9fyy0FJZ+sNZQl289mQT ieSH36YlNcTg25s1nXrqhBQXrw6VcsLcmmKYB7Vdosb5B686ybkewa1wK3XiYN/XMbyR VVaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nZfTcuyRz0GAm+oLVWQWD9MJakVXKdCxvNhux3VcJ5o=; fh=5Od8mdHlnXoG7nSqrx9C0Be8aBZRCt5L+hBPJ9iYmmE=; b=q7nl4yQcFwfAB47gM7jZNsNJimpQHYPCd3b4uRuydK5iK0Sx4pyrxnViVoNABkZQFe b5SPq1hozq+s2HVTLHMT/SywKpuIZBCAo0YiUYN0bhCcQd4qekyyQqoekFAeJAY8ea7C ptc8ALnlDwl8gLxKJP5cNWAJbk9GOG1PgkL7X4pLlC8WIYAVDCOvsidEqexacwiAA6zx aurxYMc9nEF2eClKlbwmu0MXTlNnTMPrrznAQJjK/oK8Hnn1kcQa2w91mdRxXEVj7mjh dUtYFoQKgDcRomS/dLCs0y4expUYFd0XiRll+jFqzPJaeIRCgL/0BD+/sixCmGB7JxYt MZaw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=VgGfDsRi; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902e74200b001ab06251f98si5197027plf.429.2023.06.26.07.16.40; Mon, 26 Jun 2023 07:16:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=VgGfDsRi; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbjFZN4t (ORCPT + 99 others); Mon, 26 Jun 2023 09:56:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjFZN4k (ORCPT ); Mon, 26 Jun 2023 09:56:40 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF0410EB for ; Mon, 26 Jun 2023 06:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O+LY1Ykl5CWAdNAs9NFwBk+qmN0Sz8G3XKyT829eI/6F88TKJmHPbD7QNH6RsjIj4zJmXiJNd4hFDRkLLo9jjiSw0kuZluGwH2AXzHB/KnR+hEX/Tlf69etAhp1DBvdpWdV+d54gFpVLzyFynBfPYWKmMGuZ80QXsnBAwDpbgJ0uzNA4v8CxVlajxnA6JCKG0DlBQqiUCATT426aEKvEBOgVDnBBYTMUPkuZ97983TffN1KCSCL5RkS9cGP9HCm3GOpJss4lWotweJAcGej14mNmdYkgGp3q8luRf4wZjjEA2lrT9w7oHlynUuJmEiwotfED38RiQtPDRlwq65wnRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=nZfTcuyRz0GAm+oLVWQWD9MJakVXKdCxvNhux3VcJ5o=; b=kiO0nyejWa9JOEyJpJyQ2ab/VyPpNCy4XxFbnd1BsXAUBe90+uMe/hpISIxAy3ewKyuyQ+6xuhEOJvz47YlSGiWnhaGVsmKRhaQoxJ/YDLgQbmy31o6zVrTd8nD1DGgz2/zWl0zADferg4yghoowUTFPr2kq12kTmZp2CLapAPj1qNsbQu0ZxttbtrIvR+JTcVbdFNBMuX0sZ3pm6V4djGA4CfBd5qEM2Z69ACNg5su3y/LOY1unrwWlLY1fzzkCIYlnpzXWh00JOh8f8jOQwqw/1Pehq4kELKmXB2FeRKHxIFoF693vh7JErDzW52SSiHMMCe3IuatuX35kAoj37Q== 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 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=nZfTcuyRz0GAm+oLVWQWD9MJakVXKdCxvNhux3VcJ5o=; b=VgGfDsRi6DqSeonkNQKe7gzcEqX8QMIhIHHtUGPWVTgThB2WFcFWCrnw21Y9x9fQwvSFUGFVjKPFVMmrjIyzSkSxHR92BRZmJoB/nvnT70ySpbgMtAStFZcs9ClNeJAVebk9kop/b+xjLkJME6H5DGaLxORNNOC9ZyBU7sMWGyY= Received: from BN0PR04CA0009.namprd04.prod.outlook.com (2603:10b6:408:ee::14) by MW4PR12MB7000.namprd12.prod.outlook.com (2603:10b6:303:20a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 13:56:21 +0000 Received: from BN8NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::69) by BN0PR04CA0009.outlook.office365.com (2603:10b6:408:ee::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56:20 +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 BN8NAM11FT035.mail.protection.outlook.com (10.13.177.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:20 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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.23; Mon, 26 Jun 2023 08:56:20 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:56:20 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:15 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH v2 03/10] ASoC: amd: acp: remove the redundant acp enable/disable interrupts functions Date: Mon, 26 Jun 2023 19:25:07 +0530 Message-ID: <20230626135515.1252063-4-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT035:EE_|MW4PR12MB7000:EE_ X-MS-Office365-Filtering-Correlation-Id: b4fea4b4-bdd7-45ce-a977-08db764d1f05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hr1mbeauK4LhD4Af51EiMs0vjxBP5tjVj6MW3LGqanwDHllNIzG+NLdJ4SiDbLIcKm7aDEv+LIQ9Oig99U2KzrxKrKflQwDUR3rNG4oy36kuD0/AWt0elPqoS5uN2LRy+VddiaMROU//zPQ/DHHVkWGKDjc6bD5sFViCiIqr6rrC06CplBJREhlzzMNsD7b3P9pv+fSO8VYmtDzxDKQjwciDTZuItinnvykv/3nnwoWxD7m13cBVsM/6F8KddjhACXWJ2WWS6EHYWdSWHN60Ct35ePHpkicmNNqBCOaMOrRc52Jz4npjvZqip+Ggsb/MlKfz/xhKCV48hVEIlKU/0laKtfQ8P2HDG4KTmvGudba1XwawU4Dhwh782Sy+R2tRW0UYVD8W83mvLFp6Jh7iTIWkF+SDgd1+x/RABTRi8+6mk6w/d8Gz0y00CMUY+mLXpP8aZDnRIip2yD+UtfFudbL/RWvPRBqTu+RDKrYhnBDyRzb7Lv7R4iwHnZ/wb3PC45neSPVZAzkoXXsZF2MWECnYgE5ggEPcz61sH5YY84iyeyJvaekIeur9xxzydBT00uCbvjyoV7EQl6JWCMClrH3PyqBeNRUIacEEFV2LVc+Z3ARDZKehH7eVX1iVgOVXSQ7OIovIdVlibtDFmVejRy/xw5dCxC+uK6AqELtcuPLJQFMy9X5SBjki0w7nOyj608Jw4cWhjdG2926P5+0G4sDPsbU3k/UGONiz5rWFRbCIaVIdepgnsCUmFE2e/XbJtp3kQ44QCvfH+Q1SQc7qaQ== 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:(13230028)(4636009)(346002)(396003)(376002)(136003)(39860400002)(451199021)(46966006)(40470700004)(36840700001)(36860700001)(82310400005)(47076005)(478600001)(6666004)(54906003)(7696005)(2616005)(426003)(110136005)(83380400001)(336012)(26005)(186003)(1076003)(2906002)(5660300002)(70206006)(40460700003)(36756003)(356005)(4326008)(40480700001)(82740400003)(70586007)(81166007)(316002)(86362001)(8936002)(8676002)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:20.7612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4fea4b4-bdd7-45ce-a977-08db764d1f05 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: BN8NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7000 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769775052516373775?= X-GMAIL-MSGID: =?utf-8?q?1769775052516373775?= Instead of having individual acp enable/disable interrupts functions for each platform, implement common place holder to handle the same for all AMD platforms. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/Kconfig | 3 ++- sound/soc/amd/acp/acp-legacy-common.c | 21 +++++++++++++++++++++ sound/soc/amd/acp/acp-rembrandt.c | 24 ++---------------------- sound/soc/amd/acp/acp-renoir.c | 23 ++--------------------- sound/soc/amd/acp/amd.h | 2 ++ 5 files changed, 29 insertions(+), 44 deletions(-) diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index 6a369e5d825c..3aca8109475b 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -31,7 +31,6 @@ config SND_SOC_AMD_ACP_PCM config SND_SOC_AMD_ACP_PCI tristate "AMD ACP PCI Driver Support" depends on X86 && PCI - select SND_SOC_AMD_ACP_LEGACY_COMMON help This options enables generic PCI driver for ACP device. @@ -40,6 +39,7 @@ config SND_AMD_ASOC_RENOIR select SND_SOC_AMD_ACP_PCM select SND_SOC_AMD_ACP_I2S select SND_SOC_AMD_ACP_PDM + select SND_SOC_AMD_ACP_LEGACY_COMMON depends on X86 && PCI help This option enables Renoir I2S support on AMD platform. @@ -49,6 +49,7 @@ config SND_AMD_ASOC_REMBRANDT select SND_SOC_AMD_ACP_PCM select SND_SOC_AMD_ACP_I2S select SND_SOC_AMD_ACP_PDM + select SND_SOC_AMD_ACP_LEGACY_COMMON depends on X86 && PCI help This option enables Rembrandt I2S support on AMD platform. diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c index 4302d8db88a4..45a45d002915 100644 --- a/sound/soc/amd/acp/acp-legacy-common.c +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -16,6 +16,27 @@ #include #include +void acp_enable_interrupts(struct acp_dev_data *adata) +{ + struct acp_resource *rsrc = adata->rsrc; + u32 ext_intr_ctrl; + + writel(0x01, ACP_EXTERNAL_INTR_ENB(adata)); + ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + ext_intr_ctrl |= ACP_ERROR_MASK; + writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); +} +EXPORT_SYMBOL_NS_GPL(acp_enable_interrupts, SND_SOC_ACP_COMMON); + +void acp_disable_interrupts(struct acp_dev_data *adata) +{ + struct acp_resource *rsrc = adata->rsrc; + + writel(ACP_EXT_INTR_STAT_CLEAR_MASK, ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used)); + writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); +} +EXPORT_SYMBOL_NS_GPL(acp_disable_interrupts, SND_SOC_ACP_COMMON); + static int acp_power_on(struct acp_chip_info *chip) { u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 82a1bf2ddfc6..ea3d4aadc8e1 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -185,26 +185,6 @@ static int acp6x_master_clock_generate(struct device *dev) return 0; } -static void acp6x_enable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - u32 ext_intr_ctrl; - - writel(0x01, ACP_EXTERNAL_INTR_ENB(adata)); - ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); - ext_intr_ctrl |= ACP_ERROR_MASK; - writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); -} - -static void acp6x_disable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - - writel(ACP_EXT_INTR_STAT_CLEAR_MASK, - ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used)); - writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); -} - static int rembrandt_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -254,7 +234,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev) dev_set_drvdata(dev, adata); acp6x_master_clock_generate(dev); - acp6x_enable_interrupts(adata); + acp_enable_interrupts(adata); acp_platform_register(dev); return 0; @@ -265,7 +245,7 @@ static void rembrandt_audio_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - acp6x_disable_interrupts(adata); + acp_disable_interrupts(adata); acp_platform_unregister(dev); } diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index a73fd70171c1..1899658ab25d 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -140,25 +140,6 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = { }, }; -static void acp3x_enable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - u32 ext_intr_ctrl; - - writel(0x01, ACP_EXTERNAL_INTR_ENB(adata)); - ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); - ext_intr_ctrl |= ACP_ERROR_MASK; - writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); -} - -static void acp3x_disable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - - writel(ACP_EXT_INTR_STAT_CLEAR_MASK, - ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used)); - writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); -} static int renoir_audio_probe(struct platform_device *pdev) { @@ -207,7 +188,7 @@ static int renoir_audio_probe(struct platform_device *pdev) acp_machine_select(adata); dev_set_drvdata(dev, adata); - acp3x_enable_interrupts(adata); + acp_enable_interrupts(adata); acp_platform_register(dev); return 0; @@ -218,7 +199,7 @@ static void renoir_audio_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - acp3x_disable_interrupts(adata); + acp_disable_interrupts(adata); acp_platform_unregister(dev); } diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 96bd87290eee..0d8c0febbbfc 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -192,6 +192,8 @@ int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data); int acp_init(struct acp_chip_info *chip); int acp_deinit(void __iomem *base); +void acp_enable_interrupts(struct acp_dev_data *adata); +void acp_disable_interrupts(struct acp_dev_data *adata); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); From patchwork Mon Jun 26 13:55:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7516402vqr; Mon, 26 Jun 2023 07:17:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6JBTLmWptZRQgTZRwj+ryQUw7pfGDFrbE+fsq8YzokJPvBFpQTdvFn4erjRxVzxM9wl1f/ X-Received: by 2002:a17:903:1212:b0:1a6:b496:4053 with SMTP id l18-20020a170903121200b001a6b4964053mr4501384plh.59.1687789052426; Mon, 26 Jun 2023 07:17:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687789052; cv=pass; d=google.com; s=arc-20160816; b=JDHif6afn2qJm5Eoxhs0zeHau/xqaisUbGXhyq7e9gScQW02HzOE13SGfbg3k8u5o7 0hK1M/ugqaK5COmp0UKwEvT3tMzDRJ2rQv6HZxs8hf6g0D6AgaHlvtAUZOouZW9otuqM ptnSGXd1M6J1UfQv7t7Ej55hBAvvdSEUJ2TjMyNuPbvCTGW3Ghu2OPD47IK6Y2q1w4Hx 9YGTDheCKp+Y3c8cFs5DYfwgy6qbGUT/6Y4WSeYbMR/5c4sU4cnElNHaonTrmaFk3YwE qAbWlwfnf39e0kVzfVcUe+o8JPcOYO1YzCwSn7EuOnd1zAr9llo6akWPPIA5XQ39q/w1 Azsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hbVU5i95L+F96yzyH8AkG3KPRyncqMw9WwG59ejN4eU=; fh=mIlVJwcNZYXkrgZkJFhIpPaPEAAhuzak7YJbU9lRKYU=; b=PEr6ger+F6Bj1fhtB/ygxL5meKG1t8qxRwf/uTPjVkCi4dnLYsknVKyNbFzuripIfK VUOhYDVbzeMDuv3mIyz1io5Ba0b4gAQ1j8g2lmSHHHu6GLXJQ1DRIGbSH9MagzEyBaPI QPTU6PpldxNT5yv9ZNGEPTsZzhuzSZB1VLnKcU/1Qu3TzwKzIxDkukmi8P+wZ22nfj0f mo/EA2F+lYGg4NbuYiU+5abfsYa1kq2vZtaCNAuLZwcrUJ2te61iWbl7qy8Hvz+/jp/B nQNj+wHrIequja5DJNsmDaXL19zAi8nVibX3V5D4fPKVOCkUhi2/uf+lbBFyHJj3iRHw wl3Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zMFuxtkc; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a170902cf0600b001b024322547si5166350plg.577.2023.06.26.07.17.19; Mon, 26 Jun 2023 07:17:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zMFuxtkc; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbjFZN4w (ORCPT + 99 others); Mon, 26 Jun 2023 09:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbjFZN4o (ORCPT ); Mon, 26 Jun 2023 09:56:44 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2046.outbound.protection.outlook.com [40.107.243.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2037110F9 for ; Mon, 26 Jun 2023 06:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j0rEA/uEfed01/Gt7XdBcSA9QvbPhuyrvPdp9Fai05Htdjn7lEkHqAzvKXBxIG5EMQNK56o1c6IBAas3EQnH+wzFwst2Iv4uR0NdeEzIrcD7HnJZDr6eyjkLQw8wfivHQgrO0+3RHxJuogWIMKguteaIcLikk/ke5Sg46qPdjd388JTWsIdNbRGjdfaW/pWMx2glGfcw3djtYQeUsw8uDET1pw9hAJLQ6fKwYONCqlvbj06L1YwH8LZjwTjoKx+AXyGVCSw8ZS5WUAUp9cQf+LHYSAQaKXYrx59xjWbd8wnxcpZIYH4xeStNaZsVP/AON03Up0yBXF/k1SHZ2/Uttw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=hbVU5i95L+F96yzyH8AkG3KPRyncqMw9WwG59ejN4eU=; b=irMsr8P28rbZ1KnPd/ut6akUHtq3X7fQWpoVPRR89172gyb8j5o+fEAy7LhWClS7HLvc2zDHvbtqifivgkwzq9Z4NVygLlBqih7duY8X8z9enEgWzjI6xhhHyJHKn9UljG/fFHkJWWIuwaGgtThmMFPVhtn4oEuxTtVPwLwPKgH71O7ncdzhixdg/Gyo2klWWS8h1hC5KFtcFr/JuSb6LYC7O6qgSqZUEZWdS1bWyE2vFUQFvDcFmUp9ks4rdKQuTqp0Nnvngr3LtBE71obKkXZQ5edwgvbLWuOFHdKDHJsP9wBmCPK5DecA0jfZMAD3md+VAU42D6lywLFvo341jQ== 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 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=hbVU5i95L+F96yzyH8AkG3KPRyncqMw9WwG59ejN4eU=; b=zMFuxtkcytX5vpg4vUJaq+24htUOcJY8wDnpfgVriBKDoDEHywLq5WNmiIM8PfPUQgyn363a7PgdXYnS212YnLxFmuNZXlOalbGRC+U/lguoT4bmj+prc3JQBq19RLuk5TF0J6zh4NlU3sX6xQ/gKkRqP2ETejw1o3bIPs+dP7I= Received: from BN0PR08CA0008.namprd08.prod.outlook.com (2603:10b6:408:142::30) by DM4PR12MB7669.namprd12.prod.outlook.com (2603:10b6:8:106::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Mon, 26 Jun 2023 13:56:29 +0000 Received: from BN8NAM11FT071.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::3e) by BN0PR08CA0008.outlook.office365.com (2603:10b6:408:142::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56: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 BN8NAM11FT071.mail.protection.outlook.com (10.13.177.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:29 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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.23; Mon, 26 Jun 2023 08:56:27 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:56:27 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:22 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Yang Yingliang , Venkata Prasad Potturu , V sujith kumar Reddy , Claudiu Beznea , Ajit Kumar Pandey , open list Subject: [PATCH v2 04/10] ASoC: amd: acp: store platform device reference created in pci probe call Date: Mon, 26 Jun 2023 19:25:08 +0530 Message-ID: <20230626135515.1252063-5-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT071:EE_|DM4PR12MB7669:EE_ X-MS-Office365-Filtering-Correlation-Id: 45658931-7192-4756-8d14-08db764d244d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VQVKZb5cOHQx+w6Ojb4OdSYjbGqV93WzWsKwN2P44YlopULLfx54ktc2PO4ZiK1dL70meuo/U5Ryf7iLumpBcaOC/m+95/uLQItEHcROgNYYNEWX2KBXPC/atO2LsIR8s0KabvDTkJ+GR8RAVcm6u8nCvTjHASpS51NDq3J3ZRqhf9pQaashgQkD8k7n5QK7l7c1FKe2yCLpnBDlBl8jbxqxsKslbIDZQTyVCEZeTTWaNdkoGnt/LpvBDGtvCl4t3m+GCM74E6a371pI1o3lKkNKpbh9zE47c0jSH1IUe8H/mJ6EsdjtAXQtayQfDaKiK48iBItMYw/ouH5qC4xvPJdGQyJ8ToWuAkNERJMT1rSQ4+RriznlWXesQI2hTCjt89CDU2Q7EYhf/IvXds0aZItaF9UC6oKoc1Wj4aCawEvft4E9aSu7BYZscLQ7Bfdq+lNNsUtxOsT33KtQegcbVuYgLtkV8XIjFJXlCig7e4iiUd91EV75UXek2TdDDpMIcXVE5RiRYbJck/UNfQZOB+jIrIhpSkcGmkkbATaHWPhwQ8JCNGQXAk40tNI7qMQpjgV3hjvN3XL/GBAeBI/bleLHd9nMjfkp3O4N6Jm9r5fEgbbTM/uNdIb5lIgAsF9pLjBeXJOPjkHgJ79RTLFNciMtI7hFV1BLd4rywfR7VdigOL03PS8+i6bBHVuNcBcH687/NiTEuIwxOe2KQLLwRfGZDf5Wgvgc8OXLbrr2KpxROOzx9fLW+MhUpbMls4jZE/1Nc7xtKlx8zKbgBt0gbA== 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:(13230028)(4636009)(376002)(136003)(396003)(39860400002)(346002)(451199021)(40470700004)(36840700001)(46966006)(36860700001)(82310400005)(47076005)(478600001)(7696005)(2616005)(54906003)(426003)(110136005)(336012)(83380400001)(6666004)(1076003)(26005)(2906002)(186003)(5660300002)(70206006)(40460700003)(36756003)(356005)(4326008)(81166007)(82740400003)(70586007)(40480700001)(8936002)(8676002)(41300700001)(316002)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:29.6209 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45658931-7192-4756-8d14-08db764d244d 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: BN8NAM11FT071.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7669 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769775093027512030?= X-GMAIL-MSGID: =?utf-8?q?1769775093027512030?= Store the platform device reference created in pci driver, it will be used in restoring the interrupts during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-pci.c | 2 +- sound/soc/amd/acp/amd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index a51cf7f32f7d..4fedad1b740e 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -140,7 +140,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id ret = PTR_ERR(pdev); goto unregister_dmic_dev; } - + chip->chip_pdev = pdev; return ret; unregister_dmic_dev: diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 0d8c0febbbfc..f53613216397 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -115,6 +115,7 @@ struct acp_chip_info { char *name; /* Platform name */ unsigned int acp_rev; /* ACP Revision id */ void __iomem *base; /* ACP memory PCI base */ + struct platform_device *chip_pdev; }; struct acp_stream { From patchwork Mon Jun 26 13:55:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7513875vqr; Mon, 26 Jun 2023 07:14:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7u3/sX95XDA5Vin41uWh75sU414vQKM/o1TKgczqdgNcaosIijx8KVvlJehPlvvpI9AL5R X-Received: by 2002:a17:903:4091:b0:1b1:78ba:f350 with SMTP id z17-20020a170903409100b001b178baf350mr6828276plc.46.1687788861696; Mon, 26 Jun 2023 07:14:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687788861; cv=pass; d=google.com; s=arc-20160816; b=LDgFz0N2iwX7tunDNnc1AMpPSpCS99qyQzfB18mCGHxq9GjjoH1xa0JsON034HQyZG BrUJ8z19ETpXr8znpBt2A6sLd6Uhy4sjTOGSaHXk44J2ePlHmqhibO9CvWQ7HCKhtIEx TE8eytYxXk+vjdm5t68aw4jdf2K0UW7JK9iLUpQvMDMOJqkeaduIsf2pkZDvJmfFzOL9 Hi7rtY6CltRn7dMW25/hPJbTXPZ5IMoXYc06y4Le0Bx7eU2VcJ3Y7IswvfV+REUsiR8p Z2ZVzmFQKj6pNvhH/fG2pITJ7ZTP2lyg/T3GbxAJX0xhgCio7rpQArMjGwCy8vIamKCu Nedw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BdPaERuCtjsdY/S8TxeN4zDOW7M7MUou1Je8PsF8w7A=; fh=Q8fy+hU6RA5wtrfft4SKXaHnX0x/oWAoSkGngw2f5/c=; b=kiFIhIhtnxFDPTyM9lX9YCsWDyBCNn5fL4jJukzcHn8xA98zV71/N7ePOxZNOpb2Xq lHlKcVs7ojU/tTFn582lYBL7N5NBliUQrz0AN/GfqnJIsojkQeSt2tWdtQIIvQkSrRhI SGyTzgScG5vYWesrrqeSv6NnbU8tINPCrxELhMVgTLjUg0Vm9efsjj9Z9VJqO9Ud6Xly qJexVY7wzt1ZSYY4YpOaq5NBs/3+o5q3RJUX3TDj9NdPamzuxTfhaOgMb8elZ6qnv7Tu zhjnJyGbhOPON2B/fNadCWbNwv1/ifMq+ry7JYRM3n0LQzCWUldud0Ez/vgksxjCOpi4 iv2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xKyd98YT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a170902f64900b001ac6d4e1d72si5142393plg.149.2023.06.26.07.14.02; Mon, 26 Jun 2023 07:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xKyd98YT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbjFZN5G (ORCPT + 99 others); Mon, 26 Jun 2023 09:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbjFZN44 (ORCPT ); Mon, 26 Jun 2023 09:56:56 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54ABD19B2 for ; Mon, 26 Jun 2023 06:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lpixx9zlQD9eE5fsEseDfTnFCZPb5F0/y2V1HLA6pDEfiVmhwC77wb2Yhqc83mW4XrxWaCks/i3uLCamcJg7DvTUjYKq079MykTN0+DEptzKdIvM76jNZfLs+KU5k10y5xRkUS4lWPM0kZfrOu0WkS5GhLxM7nw2g5Bjfs+P66XYhtEpfZQ89qbVGus0oiM5fQw6UzuX1S3uT5zIvU++nO5fVpahqqW1Y7eDvPFQSG4RrcH6WkC5ADKRii5VQfkyLw+CSiODhvzZcJhetg2uhlx9BegmWNBkchlIH3MlgC+9tOtRqL5Hd5ijeRW6NdMdnN9rgU4PQu5SWEGCdbJHkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=BdPaERuCtjsdY/S8TxeN4zDOW7M7MUou1Je8PsF8w7A=; b=f+dKPC28H0TefZQ1Kp0vPc9Dd660w7m82FFHWfqBJjErXeI7WAJj+DmbZSmVJIHc5BypOVVmnIT+80x+5POTECkYZklUyvT795or10EAjSuL+KID0ltOrb5SJIZONhHNKO7CDkQiunXOCd8i5O8zh5IYdjh0ykcGmdU6Pe/CJa4fAojvcwRnjcaKfG/6qF/WxgP/LzYg9x1duicIV5od9zRSJ4q4MYN6ff83TXFST3Ow6rsuIhxdii7B4Y6Kq8TceY/B4el/m8bdxT66L4DQGKmZZR7hbgngwT2bADCMcHH2jzxOOgaZh3FQ7itBRcbl9bUBynOgtgOKZAwY+yNHoA== 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 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=BdPaERuCtjsdY/S8TxeN4zDOW7M7MUou1Je8PsF8w7A=; b=xKyd98YTUUL2ZNOdPxjWC8S3CIBHC1E4K9KsSqU7ifxQp+mgT3/5mzxYTN5OUX2jOt+DIwoWHQqZNNXyhUd3JCZsLKNsTpg4M9UFmtU6vYthOw4gfTlS5T736DcT6K95T7xFBVPbaezpOWi//g70YKn4zBibPbiUS3OZGd+cFP4= Received: from BN9PR03CA0782.namprd03.prod.outlook.com (2603:10b6:408:13f::7) by PH7PR12MB6395.namprd12.prod.outlook.com (2603:10b6:510:1fd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 13:56:33 +0000 Received: from BN8NAM11FT098.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::d2) by BN9PR03CA0782.outlook.office365.com (2603:10b6:408:13f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56: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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT098.mail.protection.outlook.com (10.13.177.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:33 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:56:32 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:56:32 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:28 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Yang Yingliang , Venkata Prasad Potturu , Claudiu Beznea , ye xingchen , "V sujith kumar Reddy" , open list Subject: [PATCH v2 05/10] ASoC: amd: acp: add pm ops support for acp pci driver Date: Mon, 26 Jun 2023 19:25:09 +0530 Message-ID: <20230626135515.1252063-6-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT098:EE_|PH7PR12MB6395:EE_ X-MS-Office365-Filtering-Correlation-Id: 239b0479-60cf-4b9b-8364-08db764d2686 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fRdGlBTMh8froZlhVTklVewoNvUrJlRBUiozhdJh/M6YhssBOOW8UHSJ/C/B3Z5YjyatPTOTqP+o8kqN7CGKe14dAKGQ+sNyCccu6wnt9+kk6J8ZDD6N3AHg/BmxOoZoQ6EqJr3u6q7faD2djbPxDM3V6OK0uW/s4OhTaRN2oWTeGTXd+UoeFPNuRh8XOPQPzbVDgzgrasU6NNngCCizEqkUXsEPR1OGEI47qiRHidcEtjcW5JBb8tJjaTh3fNbB5QnwOaIXlem4JOljE1AEAVO/AvDruLhSS/tnEg4A6xMt0W7vQMzCsODaLFcBaEtU6UnMQOzJUnwXzqfZY7lvkzeeCmxT3oECIYrZv4FWWectgA3Uv4ZPKbuW23/pKzMzPHV0UBpMPVEqStU+13SqyLJwvRDqTTYiTOxR/uHMVLhMkCrrx21jZLgLA3snPhJQPdbgRwEGA/rM0fMUDPT2ioh6dWaiZBo0SNP+MUEj/D2DupaV7oGzFrrjr3Ws7/mDQHBK7Tnr4YOAVNwOGuqMvUvBgicoF0Eus/KygkIRrbgtfjwphwIS6Uf5IVl1b7LhBsLMYvX22FqmO0KcmgVxg1dFOS1e18x3fdslBsiN5X66l2G6k11q3AI5ipH8+Brx20MTQaRQxETtkw3nvbKS+8dqphZZ3PfxYfB7VHkt0LIL3pD5j+WJexO+tTxLXFfw4GdTzR9QsNObHnojL1rN8CmiClynunsBJCSAaYoJKoCgZzcAXpW6IZV7JGGOPbB2ht0RYVBAJxGHM2dGoFkj2w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(2906002)(7696005)(82310400005)(82740400003)(356005)(6666004)(81166007)(2616005)(83380400001)(336012)(426003)(186003)(1076003)(47076005)(26005)(36860700001)(41300700001)(86362001)(54906003)(110136005)(478600001)(40480700001)(70586007)(70206006)(36756003)(316002)(4326008)(8936002)(8676002)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:33.3497 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 239b0479-60cf-4b9b-8364-08db764d2686 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT098.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6395 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769774893454581790?= X-GMAIL-MSGID: =?utf-8?q?1769774893454581790?= Add pm ops support for common acp pci driver. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-pci.c | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index 4fedad1b740e..a32c14a109b7 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "amd.h" #include "../mach-config.h" @@ -141,6 +142,11 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id goto unregister_dmic_dev; } chip->chip_pdev = pdev; + dev_set_drvdata(&pci->dev, chip); + pm_runtime_set_autosuspend_delay(&pci->dev, 2000); + pm_runtime_use_autosuspend(&pci->dev); + pm_runtime_put_noidle(&pci->dev); + pm_runtime_allow(&pci->dev); return ret; unregister_dmic_dev: @@ -153,12 +159,49 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id return ret; }; +static int __maybe_unused snd_acp_suspend(struct device *dev) +{ + struct acp_chip_info *chip; + int ret; + + chip = dev_get_drvdata(dev); + ret = acp_deinit(chip->base); + if (ret) + dev_err(dev, "ACP de-init failed\n"); + return ret; +} + +static int __maybe_unused snd_acp_resume(struct device *dev) +{ + struct acp_chip_info *chip; + struct acp_dev_data *adata; + struct device child; + int ret; + + chip = dev_get_drvdata(dev); + ret = acp_init(chip); + if (ret) + dev_err(dev, "ACP init failed\n"); + child = chip->chip_pdev->dev; + adata = dev_get_drvdata(&child); + if (adata) + acp_enable_interrupts(adata); + return ret; +} + +static const struct dev_pm_ops acp_pm_ops = { + SET_RUNTIME_PM_OPS(snd_acp_suspend, snd_acp_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(snd_acp_suspend, snd_acp_resume) +}; + static void acp_pci_remove(struct pci_dev *pci) { struct acp_chip_info *chip; int ret; chip = pci_get_drvdata(pci); + pm_runtime_forbid(&pci->dev); + pm_runtime_get_noresume(&pci->dev); if (dmic_dev) platform_device_unregister(dmic_dev); if (pdev) @@ -181,6 +224,9 @@ static struct pci_driver snd_amd_acp_pci_driver = { .id_table = acp_pci_ids, .probe = acp_pci_probe, .remove = acp_pci_remove, + .driver = { + .pm = &acp_pm_ops, + }, }; module_pci_driver(snd_amd_acp_pci_driver); From patchwork Mon Jun 26 13:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112965 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7515491vqr; Mon, 26 Jun 2023 07:16:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XoNUiqzacTwF1QXmjfaaK1iqxiAJRSC6ZKrtxgCwqnjxlFwREZgLpdfLblRpnJzchm6lm X-Received: by 2002:a05:6402:1507:b0:51d:9461:a5a with SMTP id f7-20020a056402150700b0051d94610a5amr3391859edw.5.1687788983305; Mon, 26 Jun 2023 07:16:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687788983; cv=pass; d=google.com; s=arc-20160816; b=xAb9ypU8ZnG57YaT4/3FtAzBIFZCtqLovGTKrxuTe7C7Ya3LDTU9SUhPjhawpZCo9P lEGVd/7xL8PRjdKUK3XSVEbI9fjvsNSfBBUCPLGiGqoakX9nkct1v7U40PK97Eotx/Pq qYQYHPGYuQOcfZWAO/dMpKX3WU/BJUqHpN6Cg0tt8VH8ifq9XaO0knCdOE6Xu8jpuYvP GQO5XeJRDPv0vYzxTdlg36Pvnd6AxBHvjc4pdCMZ/OTO9Xj3aU6kXGlTPzrAPEh6vOYJ ujF6XI62lOvxxnNZB1a9hohGrJ21gfzDO8WRWX24A4MyGrYf/VTLT2Y3S0hO6We5MMET sYQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; fh=jwGyvZPrPZQuPTJQDh5jRLIr3GoouyaMZopym/Bkivs=; b=SgZjxkc2rJwsQdznpK25WqNFxJiWTMIKSX9tfaF/1oNxVfmXmUWf9bxiH1FgbjpXWR BEKPWTkRODdOIuA1juxc/Vo/56mDBstS/ppJ2tOOi4qhDQOLdel6xmpfMzOfUz3jXmxg ogSlzdoZVjZmygSmvrK6ftrLyOrP0IKm4EnH9xunjaSfk+dbNGH2TRiU9dOv2ab0ZX6j 6e4bqLvI2gjUJWKfmJfNNMQTepHHOlGuHxJPYP8gzT80Eb35okci7Jg5BGuXUPiSvvj0 th7guL8+U64lce9yTlr3QpWBM4dQ+hDoyVRDKvZgcxeQz6jzmDjd9JzqtxHndg+NKMg7 jmvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SKefDmv6; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l22-20020aa7cad6000000b0051bec072038si2555334edt.260.2023.06.26.07.15.27; Mon, 26 Jun 2023 07:16:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=SKefDmv6; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbjFZN5K (ORCPT + 99 others); Mon, 26 Jun 2023 09:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbjFZN5A (ORCPT ); Mon, 26 Jun 2023 09:57:00 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2060.outbound.protection.outlook.com [40.107.223.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1745210CF for ; Mon, 26 Jun 2023 06:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YB9LEs5+gmXKFYcPPXFCztbRhUfvHDIMCrVWTqqxZDEm4Rst7hSmMCcCgmU+ajhp+loWBXCx6hCDxg+84WYJodkFiaQim8kUKGRN/8FBcvDcKIrfVGNy0eYEXIdCG3JSD5a307VUvfKcwWKxBnqTFt3xMuKnSXJNisu+GeHI5KMzB5/kin+xdLEgnldNdp/48n5pp9ioTbd+HrvsGKs+z0PHS5shOwcCuTavnbL9eiCKbfAwOtCA4LKHrmLpX13CvLcGRAwr6MPMqSa/qE455Dj1y3NryN5em2ZxCZlQ6kkf9vQHH2xUD9hKtA5KUCVSvAssZi0R89e0/R/U0FWXKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=KHu21pEXGMhNGbc6BU92zsWAaQqJsgmHkAw4SHBfvo+XPwb0/ajQp7dOD+45gLwAUGKThWbt3qFCWgD5U5RYvQHvW837Mh5nfuRGIFMp388ICZqEw7EkdtnYANYXG9URjxCMFN8Ua/uyS4ALGOnvDy9MhrnvgavXHRWP8YCERZMZZohzfKeydetDZa4BIPHbUpBp0kQSxI72P2MzbNm7pzO1gNG4N8bCW0UeUPSwOy3h5FhTLCzDAz/y4Tem8aD7kQUy819bQOwd6nHF0Besx2YrXxPZOmhP7s6bq0XeRypbMrb+ei888hO119HZ/kAjZcmBKqWYPeMN1ylaL+w53w== 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 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=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=SKefDmv6osAYaMgB2MJJ8/BM9e0c/wsE2eBa0lkWp8bFRyqsQ/SQvOuUlqd7/5JFDBM4nv6WfeHbEHtyVrQReIoHul5XNMiaRZ8el9kXIf9VN+KBIxmlG0kRaRIzmdmrcNa5UOAJzsX9v4OWLqa/NtmPu0L8XQkrR4/QtwQx3+k= Received: from BN9PR03CA0273.namprd03.prod.outlook.com (2603:10b6:408:f5::8) by SJ0PR12MB7033.namprd12.prod.outlook.com (2603:10b6:a03:448::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.27; Mon, 26 Jun 2023 13:56:39 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::22) by BN9PR03CA0273.outlook.office365.com (2603:10b6:408:f5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56: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 BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:39 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.23; Mon, 26 Jun 2023 08:56:39 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:35 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH v2 06/10] ASoC: amd: acp: store xfer_resolution of the stream Date: Mon, 26 Jun 2023 19:25:10 +0530 Message-ID: <20230626135515.1252063-7-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT024:EE_|SJ0PR12MB7033:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d4f708a-aa21-4a09-b93e-08db764d2a4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GyyH0thC/rAgLXinZviIpvsyrkb8aRgvFaQpdZgpAUX0afw16uAjj9FoINpBrP4YSmo0zvmwtiunzdoDnShyxxUv/aN/cKxSB2AFx4mI5GOPg7nWA70wd5XnTtwyaWD2bWVaGM+Ybki5nCWP8JP6VgNZOqgsCY9a3Y/A6vXOnXLozX5/1xyL4cYj/JUnSO6e0q7m7HxNJ2ItwCFlkCEkQbLzFUuMc5QwGyWln1HO61YUWrugUgRn18JFKM+gnixwv2LN1MVjVE/TCHZ5kBKElFnH081EB4OWZS0C1+0JFdYccsXgtbd1UGDjKnXMpvUvjvEFV1GYlVVT8iKfYP7W34ht0/h4MJ5hGW6hW592gMQ/cDBsIeqepU6Ne8WaeiBlo1H2mrLn+qWW9O0+qNftkaPPc/MHOpUUiKThpvXrBft4AFex6X+rQGoXfcjOXLxvrCxKknbOyrjUptw46VEKOTk19A2I3bOW65y2w8oDH8OVEVpIGOm+8H9r6Gq9sLlNgPGzdIOa2NoMO4/XK/qRTSaCE6RAzWpKHljV3i2HnkQh7IWoNkZ/xvTto0vhgda9KbYVvIIl0hhgbZ77uoCwR+Q2Pyra3adeI9DTRth+3YcemSpH1SO5rhgYk+svupDpynGnyGOzJleO7ttP01iDjh6KTQF1/HMgua+dJl5wxTUV0mmPfd5x8eVpXo3Xq3QYGAvQ/OsxCJGD8b7ePF4aRtzpKnEqM22sEv25U6WrZlwP0DNLs5i3d0RjGZbciJ8QIoOIYm+rVlF6Gcz1wLytMw== 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:(13230028)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199021)(40470700004)(46966006)(36840700001)(2616005)(2906002)(40460700003)(336012)(426003)(1076003)(4326008)(26005)(186003)(316002)(70206006)(36756003)(70586007)(40480700001)(356005)(82740400003)(6666004)(81166007)(110136005)(54906003)(86362001)(478600001)(36860700001)(41300700001)(47076005)(82310400005)(7696005)(8936002)(8676002)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:39.6687 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d4f708a-aa21-4a09-b93e-08db764d2a4a 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: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7033 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769775020699812343?= X-GMAIL-MSGID: =?utf-8?q?1769775020699812343?= Store the 'xfer_resolution' of the stream in private data structure, it will be used to reprogram the xfer_resolution for the active stream during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-i2s.c | 2 ++ sound/soc/amd/acp/amd.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sound/soc/amd/acp/acp-i2s.c b/sound/soc/amd/acp/acp-i2s.c index 09b6511c0a26..09dc5f2c0bfc 100644 --- a/sound/soc/amd/acp/acp-i2s.c +++ b/sound/soc/amd/acp/acp-i2s.c @@ -149,6 +149,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_ dev_err(dev, "Invalid dai id %x\n", dai->driver->id); return -EINVAL; } + adata->xfer_tx_resolution[dai->driver->id - 1] = xfer_resolution; } else { switch (dai->driver->id) { case I2S_BT_INSTANCE: @@ -167,6 +168,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_ dev_err(dev, "Invalid dai id %x\n", dai->driver->id); return -EINVAL; } + adata->xfer_rx_resolution[dai->driver->id - 1] = xfer_resolution; } val = readl(adata->acp_base + reg_val); diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index f53613216397..38c152c6c8c6 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -166,6 +166,8 @@ struct acp_dev_data { struct acp_resource *rsrc; u32 tdm_tx_fmt[3]; u32 tdm_rx_fmt[3]; + u32 xfer_tx_resolution[3]; + u32 xfer_rx_resolution[3]; }; union acp_i2stdm_mstrclkgen { From patchwork Mon Jun 26 13:55:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7514245vqr; Mon, 26 Jun 2023 07:14:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5yd1Z8FadyZ4IFcrhfK5hUSCDWjoXfzSvydbO8RyLI7x8iEDWwTlY5KWHtKf8rW9HQR4Rf X-Received: by 2002:a05:6808:23d5:b0:39e:bc7f:20f8 with SMTP id bq21-20020a05680823d500b0039ebc7f20f8mr31461377oib.51.1687788892118; Mon, 26 Jun 2023 07:14:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687788892; cv=pass; d=google.com; s=arc-20160816; b=HOEWyliYp8OrbEJNeMKMxUrbjh3U63lvb77Jn+vViS/dPO/lCnpKktJrOz3g5firJP zzn4OnS8qJHUQxotqOVgU3FbpkNk2GYB/rHjux/EWKxKpF9K6GhUYD2sMIjLQwfwuKo5 5GSAR9aEe2mTDktLz7H5K+X2PklDLHlGZOJ4PvuWSQDha6agRWeWW/xkaV7UJZvWugvS YFGpV1RrtgnXHIfajZAbFv0eQyoJOoi5ryIlPh8HatQmIp60yenA0ZzBXPQjl9ZSLQij crsnt+T8OgrHJ02ioX1tQoFxtHC9GkeQXfQcS2BCYyvFGGkEImLnIvfR/iRZI2IF36es T2tQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pOnJef8syakP4Nd9/X35rupQoVDOYtVqpnltYtSmxW4=; fh=jTp+cL46oQxxBRkvlj7PEXkgoSyLS5v21LkxxRVnFaw=; b=bN1MjIc1iLN+49LEQwGV+gp1tRBsfXpyRfROq4AdvRgcsAWvNFgfiiDd5Xg/fRI4nJ nEkF80r5GtpLCvuS/8LctRUIzQ1qshdkQZCV4cI/nnMuL3SkLoZFdeFFxL6Bi7YViubR b54PIwOGoruDJbBtZcRJiprAvk5hy+u0gFEyBXDP+JPe9zW43rAFqoZUBB9MX/8oxJWh zM799TF/EsgVCAfq29d+2DYjt5TON+wWeY36a4xfgAO21dkZMOgrXOSbeoP//rB8qvKN hQjDnyTaDmzCICqDquUzpPLotG8xnkxjwxn2B1ErsURvwr+DhinFjfbfEJ8dR9yFZc52 rh3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2AUZp0au; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a17090ae58a00b00256976ca96esi4859985pjz.126.2023.06.26.07.14.39; Mon, 26 Jun 2023 07:14:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2AUZp0au; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbjFZN5U (ORCPT + 99 others); Mon, 26 Jun 2023 09:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbjFZN5E (ORCPT ); Mon, 26 Jun 2023 09:57:04 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2052.outbound.protection.outlook.com [40.107.237.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0F8810DB for ; Mon, 26 Jun 2023 06:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lJIV+PLdpKIsF6yVM/wJhhUQ2PcsqWcmUmjZgsnZCnqoZy/cGVabkR8QWTVrjXBFyWUDjhirmaMVJt96b5mD2j6mrIpqJnixNaZ3D3Ys34h7vdlyjonDshEp+YskpZ9g+hW/RU2X92hdy09CvbrXxIq86XE7QylkDIpJqnBQOvA+e0aTVfIEX7WjZmf7wMXUfTLvAFjFZKtkPn83xoi4ckMOrgkGIx6K4hJd+zGLum3/6AbAcaeF1OABlbBMtyLLcHwKU9xcwlLcfKRMrxZ8RBlUH5f6oGU+tbkjp/vBBOzAHw9mBgUfY3oZHhTrRBttTYcNuekq+l8DhmBh1ELUQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=pOnJef8syakP4Nd9/X35rupQoVDOYtVqpnltYtSmxW4=; b=ZsJhGOJeQlOGSnWZgc/iEGMUB4xlX1+JMcAXTILZrRYcsmJEuFJBFWpjTnUwKhYsl5jc6f9dD53shk55nHRhJHfSpnZZCsWlTOBCtimM0N2vmwQ19kFHPJq12wmh3AFjqU4urf47e8lTYY0QqqKFkl52iO7uwVisWCM/DE2lt5ocRFESHbHWaPrn9qt3jHueBwzfm5Vk8M9NVn1Q7mKTP3auckmQUyMkd7JqEbLwWLr8sxrnVAasU3TJLOS7ocByrMSfBo3HfZVzUGF+dYH/y4D9oEYmYT2Htk8/ZBNGnVJxo0O+1hOJy7kd4tSsIBBPQnZ51gO+LJa+YMRqZVQt1A== 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 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=pOnJef8syakP4Nd9/X35rupQoVDOYtVqpnltYtSmxW4=; b=2AUZp0aufShz/wQHrVDYkyvfz59KdkWAc9UaXQlFGhyyexo9DtIBByWTi3v3rWTy+u4TcL/WoFeS0lrZuXA2WyDCUvzoeNbHIg9nh7Q4C1XrEcyNgB+gDhuf++b8+UUYMunx8A3seEWJY7/KKXdrmWNuTk1Se0+EDD8+MwNlpXo= Received: from BN9PR03CA0402.namprd03.prod.outlook.com (2603:10b6:408:111::17) by DS7PR12MB8420.namprd12.prod.outlook.com (2603:10b6:8:e9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 13:56:45 +0000 Received: from BN8NAM11FT110.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::17) by BN9PR03CA0402.outlook.office365.com (2603:10b6:408:111::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56: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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT110.mail.protection.outlook.com (10.13.176.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:45 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:56:45 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Mon, 26 Jun 2023 06:56:45 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:40 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Venkata Prasad Potturu , V sujith kumar Reddy , Gaosheng Cui , Charles Keepax , Claudiu Beznea , Ajit Kumar Pandey , open list Subject: [PATCH v2 07/10] ASoC: amd: acp: export config_acp_dma() and config_pte_for_stream() symbols Date: Mon, 26 Jun 2023 19:25:11 +0530 Message-ID: <20230626135515.1252063-8-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT110:EE_|DS7PR12MB8420:EE_ X-MS-Office365-Filtering-Correlation-Id: d96855de-db05-4974-2ec2-08db764d2de2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: thK4D01c3ay9AeLhleXhOFW2SPc3eR7fE9K78oLrxTwd01y3f5kTeT3mdUmZ/Ig2GpfmApn56u0jCRsNi65Vx4SLqC7Shicsc+Zi3yotE6DMY5yxUAoMd8ZP11woQ2mv9jPr0/6Zbzy52dWcVJaI3sJk1JIUZPzl9FvbIEHF35TnAfSGunM4jl8HRqqPRRkcnXEkRj+A7u4J8M2PXtPC545lCupvtcZhWIIuxIlhJrxrYuipyAEY2047oWW42U5zlTyyoCUe66IJXV0C1xBGl2KPTKzbPJ+XpAB8IRfHKV0SPkD2UdveamHdYkXKC4jAlLMNeudxZ77LEAL4l2K72vahZzTSnIm00oIH5RPgaYIy9L7Ow60wqFByKS+Q06NMhBpoTZl1q+Ev45o+XXOJCMeTUXyPaD3LvOu62YCDSGjPQieg8C10BSQOEVOVXMIh11YdOb8vus6nIxHtQHjHJUdQi4l17RnvE1rpGfDo5NiIZGyuOg4wZiOWjjf0hd7hIHnmooD26agmfG+tB3HxMFUJxNd9LzNSHLUhtXOOJkC8TB/CvuqZ+0wuVDUfWnXb5zBDYTahjWB3U6cmohz/BD7WGBtt43gO2j3snmSGsRzG/KNckhED8on0VVR8uzDm0WpRTLoFuyC+sqqtjOwOCf3nXv/OJe+7JNdd/XhKVnCV7w+CbBByStDMf7qISw+cYkVnOpNcCpDoR3AQOadqgPGfpF/u7NHve+6zidFdk2A3c9J9VIjICE/D+AuPRRir3hLLTM4Ksy9+Ey7rs2T+ZA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(376002)(136003)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(47076005)(40460700003)(8936002)(36860700001)(8676002)(5660300002)(36756003)(82740400003)(81166007)(356005)(2906002)(478600001)(40480700001)(186003)(6666004)(7696005)(54906003)(2616005)(86362001)(110136005)(26005)(1076003)(70586007)(82310400005)(336012)(83380400001)(426003)(4326008)(41300700001)(70206006)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:45.7101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d96855de-db05-4974-2ec2-08db764d2de2 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT110.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8420 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769774925153308308?= X-GMAIL-MSGID: =?utf-8?q?1769774925153308308?= Export config_acp_dma() and config_pte_for_stream() functions. These functions will be used to restore stream configuration during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-platform.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c index f220378ec20e..f516daf6fef4 100644 --- a/sound/soc/amd/acp/acp-platform.c +++ b/sound/soc/amd/acp/acp-platform.c @@ -127,7 +127,7 @@ static irqreturn_t i2s_irq_handler(int irq, void *data) return IRQ_NONE; } -static void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream *stream) +void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream *stream) { struct acp_resource *rsrc = adata->rsrc; u32 pte_reg, pte_size, reg_val; @@ -143,8 +143,9 @@ static void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream writel(PAGE_SIZE_4K_ENABLE, adata->acp_base + pte_size); writel(0x01, adata->acp_base + ACPAXI2AXI_ATU_CTRL); } +EXPORT_SYMBOL_NS_GPL(config_pte_for_stream, SND_SOC_ACP_COMMON); -static void config_acp_dma(struct acp_dev_data *adata, struct acp_stream *stream, int size) +void config_acp_dma(struct acp_dev_data *adata, struct acp_stream *stream, int size) { struct snd_pcm_substream *substream = stream->substream; struct acp_resource *rsrc = adata->rsrc; @@ -168,6 +169,7 @@ static void config_acp_dma(struct acp_dev_data *adata, struct acp_stream *stream addr += PAGE_SIZE; } } +EXPORT_SYMBOL_NS_GPL(config_acp_dma, SND_SOC_ACP_COMMON); static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_substream *substream) { From patchwork Mon Jun 26 13:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7515728vqr; Mon, 26 Jun 2023 07:16:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ74UjwY5U2k0CKjypWWcSLzVqTUmVKzBjkHDT3UUw8oa4zPofqn1DNtxOU2mdLyF1K+vcPa X-Received: by 2002:a92:cc52:0:b0:345:a0a8:2850 with SMTP id t18-20020a92cc52000000b00345a0a82850mr5341244ilq.3.1687789000683; Mon, 26 Jun 2023 07:16:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687789000; cv=pass; d=google.com; s=arc-20160816; b=jMkCtArqE69/bfv+52yvwUji3GPQb5YvNAf6sX6vBjpWAwxHvNb785XOqVZOiAWWX+ 3Ii6Ze3RCSaWStbohSfAeP4uw/Gmf3+BTlbriWa6DBeAz3ujMRMHwZDcktakKPY5PXev RvMVA4FM/FGjL4+/rXkeq/fR/u1LJ63S/d9YDi1zlpfj0wifpJYrk8vLGGJxOL7cF2hZ ZTWG6bM5OOca5CUGeb++pIipNHa+nZ0hxC/s0eZCPOBBb/8lMHU+SmubvHd2i5o3vFzb M7AJLpkZl86hsF1NsvQ6aXNCfrW2ELIsF1nu2eLx+R55bE+3kWsLFbbVbHw05lKXm+VI 1MTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RuC/p36abO8JEZCdYis01V1LLwMVRik6s9LS9KgnaLE=; fh=jwGyvZPrPZQuPTJQDh5jRLIr3GoouyaMZopym/Bkivs=; b=Y/Hx7xK5Nx5/v/e6KkgEnWSobIJ6M0ugq33iuwt2M4xBD/Gsic5Aw6xIqe+2AhP1v0 065aI38Fo9V7RrcXC1FBh0HjjDPT1/aSi0NCBTQ1h9CJHqZoaKSVTmb5GqA/MW+fN2sb PKZH/ote5a0PsGzIVgV6/jqbdufFrHSRlcazdByBxVDJNpunKxWx+P4u5JD/4tJz+t1t PUCyAGwUO2MzCi+nreg7OH8VX+KZHndT0XK3b55MIQoboFG8mNR8dnNu/nN57rg7FkXj +ySSqya+q3pKe92s4rHEPYfcrVyWJS8FuInuXdBDUVM9YjMJxX1U5e4fi+Gl2gyV30Fp MjDg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="aNaKnx/n"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a6552cb000000b0055339136a7dsi5115917pgp.883.2023.06.26.07.16.28; Mon, 26 Jun 2023 07:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="aNaKnx/n"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbjFZN5d (ORCPT + 99 others); Mon, 26 Jun 2023 09:57:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230356AbjFZN5M (ORCPT ); Mon, 26 Jun 2023 09:57:12 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2084.outbound.protection.outlook.com [40.107.243.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C0591BC1 for ; Mon, 26 Jun 2023 06:56:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c9eK5LL07BuOxoyATovV+/cbIEeb1gIVABJkRy/9fsP1Jnid7+ur73nT029kwnBsocBoXAKdrqh11pe4JIXaIjvXT36Ws6yNxWksWw2ymOAXcUxrU7jQ4P2I5c0iGFcgYeY826hAyl1/U9paTPPavKUhOF6/6nu8JlRQNngN3MJAzhX1EPZjgc6DASlqQz7KzYvoxQiFcPSEd4zGtdEaCf2l3VDE8Njzp+wcTX0O7XDcY8gPYl9QhlVbWQtOEhZ14m0KdtuBzS+ZFLH2bBPlSVCSKFtK7O0t22JBoJR6h4WCioZyFTJLRGDv26Bm1bIBvw299Zskd41stOL6Ol/prQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=RuC/p36abO8JEZCdYis01V1LLwMVRik6s9LS9KgnaLE=; b=G9NW7VBHdz1WtowoIymLsjAGRoTxqAZ31d8Vt4Ma1+ctfEyqRf0UsWXOpyIFc0GVysuueSuime8WPlgqe2cKmZkml1weO35gQ+uD3iZAMKvGI3SClP2Sc1qZqQwuKeYG8UAD2184NHPCCBx75ogpYdaY/YdYMLqfKTmkmX8G3g3x0r9og1dRinl7olNwyI7dpk5iHJY97VSRKudC5grA+ar+m9/rEHFVRR8bZbe6KcvN02TXBVlgEAr8Yt/7yBL/5K9g1wZ9ZfmQMHtk7uHCCdl2gkN4urCQV4s1+gUPreIFauSaUjwzWf0+5YCLqnkQGemIxtsiVOXvnclXSr0y4A== 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 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=RuC/p36abO8JEZCdYis01V1LLwMVRik6s9LS9KgnaLE=; b=aNaKnx/n0sMBk6UppIC/7XOjyDluvKFG6OeQcDy4N64jt/wWe4FG9nSi3IeFrRXT0D8nqWjQ5tU/DV8aIr7jG0mTZlhDQ8pEPpaRZ0wbT8FSNt8OMdxRfLVimV8lysiMIoLGQswPWcxkE9yhrZdEJ5xE9d4unMLHWzx5CK4K17Q= Received: from BN9PR03CA0975.namprd03.prod.outlook.com (2603:10b6:408:109::20) by SJ0PR12MB8139.namprd12.prod.outlook.com (2603:10b6:a03:4e8::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 13:56:52 +0000 Received: from BN8NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::ff) by BN9PR03CA0975.outlook.office365.com (2603:10b6:408:109::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56:52 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT019.mail.protection.outlook.com (10.13.176.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:52 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:56:51 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:56:51 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:47 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH v2 08/10] ASoC: amd: acp: store the pdm stream channel mask Date: Mon, 26 Jun 2023 19:25:12 +0530 Message-ID: <20230626135515.1252063-9-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT019:EE_|SJ0PR12MB8139:EE_ X-MS-Office365-Filtering-Correlation-Id: 09440f0f-7ff1-4c44-e299-08db764d31c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mKBYp3eaABjQIWrU2LQcYNOD0FWFUE63ifDYzchQnGxvsANKgKX+mRJ3iyon+QSu7OD5NyFe3sVi35XwBA6+2eptqBQfWslxFtJStTMIs2lb+Ll6ftyoDEB2ax9OIzUtZbAStepnsccmRIr3GySc+lQHBnsdOy0XpaZluwpSxBZa1vv82au4e8nnFEFTmsHRo1pAVOr/XfBgr8s68qhbobVqAP15DyCPb5B4kkV+4cqSFHIfHhCO8CLF3miUgNVpcQFPrun91V0+dHh1kb2dyMebXuEz49XWQWFexRqm5mdlVffsOsS9wxTZMikbrdd3/TcimvqojeBJxtGJIl3FuFLW2tGFj0k6S1q5FdjZGEqiTgLjSqgQIR0k3IdSeVBILyDrkMLeemN9cEdGfIY3fFvZA175eB5Bv0KSnZ5LPMK55Qs0kgToXt30u7G0x7lxoDhOVSuChz5ZrMzLvg7i44M+l1p0ZDo5yhWsO60YkWFiMyB2wVdZ5EHsh+v5ljuhyY10Ibg6rLBWbPG9sLyXDqjFHc9huYIxGospmercLk7H3G+1VmlYPLdR32buPmBJGRkYMcsFVbkQKsNqBUl1NYBAdSZSjS49qTV/ZDc3HutwayNsp+iNV22aSO7XbYbqL8pa72+NkgyXCmkLCQd4gJO21yU9dKNxmuPNwWoydObuXaSlnw73+XzFfvfl+UtodS/VbdztSwO8dM7gZS4lEz6mUz5IEC/pQEuHwcARK0GoMm+fScSpqYVSwsgS3koZE85Zv2i/ZkLGlIH11uWfFg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199021)(46966006)(40470700004)(36840700001)(82310400005)(40480700001)(40460700003)(86362001)(41300700001)(70586007)(8936002)(70206006)(336012)(2616005)(316002)(47076005)(478600001)(426003)(1076003)(7696005)(5660300002)(186003)(54906003)(4326008)(26005)(82740400003)(356005)(110136005)(81166007)(36860700001)(6666004)(2906002)(8676002)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:52.2462 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09440f0f-7ff1-4c44-e299-08db764d31c9 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8139 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769775038890284295?= X-GMAIL-MSGID: =?utf-8?q?1769775038890284295?= Store the pdm stream channel mask, it will be used during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-pdm.c | 1 + sound/soc/amd/acp/amd.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sound/soc/amd/acp/acp-pdm.c b/sound/soc/amd/acp/acp-pdm.c index f8030b79ac17..2833d2b7e596 100644 --- a/sound/soc/amd/acp/acp-pdm.c +++ b/sound/soc/amd/acp/acp-pdm.c @@ -135,6 +135,7 @@ static int acp_dmic_hwparams(struct snd_pcm_substream *substream, return -EINVAL; } + adata->ch_mask = ch_mask; if (params_format(hwparams) != SNDRV_PCM_FORMAT_S32_LE) { dev_err(dai->dev, "Invalid format:%d\n", params_format(hwparams)); return -EINVAL; diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 38c152c6c8c6..82e0684cb284 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -164,6 +164,7 @@ struct acp_dev_data { u32 lrclk_div; struct acp_resource *rsrc; + u32 ch_mask; u32 tdm_tx_fmt[3]; u32 tdm_rx_fmt[3]; u32 xfer_tx_resolution[3]; From patchwork Mon Jun 26 13:55:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7514284vqr; Mon, 26 Jun 2023 07:14:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6cztCsbG+Tkb0AQc5h1U6rLPXx+gOqxeEw3hIAf7cEgD429Hp4RQUBxKCpF50vuSauT6kE X-Received: by 2002:a19:8c01:0:b0:4f8:6d99:f4f3 with SMTP id o1-20020a198c01000000b004f86d99f4f3mr12963247lfd.52.1687788895431; Mon, 26 Jun 2023 07:14:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687788895; cv=pass; d=google.com; s=arc-20160816; b=AMaqeKTGxjYbCLPjGLudhWVO+zZCZc2Co/1FVvsqXAR6anGlfDxvWJo3JJjQipIBSs 9BlsNwA/J6Bz97Tbhima6IMxUMviYaqGUSXPRAAwO69pHcZVUuZtsFlMcwfhQelYRMGI D5HXUD9K4qO2MrKxboQd/39HqJU7EN0VsPVHMcVnFl85hoNfYeqeqYPNQxRjnlIGZNAd m6TF1Wj3VdRJrp7NO8xYdd2+QNoAoa9ZFL3wZMxdoBc4jxwb4etA6WnZs4KiQ99iCawt IPJ71gZfgK/YMvv7Rhn4C++cLP2Ef0h85Ma7B0F76050mJczINDL6Dr7HE4ruRVn4afB gAUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iBy8FZtzhflK/O11biPfyMuMDcZU0bVlpYPp66Nv80c=; fh=jwGyvZPrPZQuPTJQDh5jRLIr3GoouyaMZopym/Bkivs=; b=eIlth5JS55sgCOiACoEmId+J/yBvwRtR/WM+OTcAb7NSycTQTTzBmLIJTjO6ThJond sMn2INLtTAiCrM7yPl2s1WRTsvULIRAwCnMG5mA09//6skZzbXfKu90shpi8TOKY7omg xgnDqoRLHarqah39NW1f1pBmJrlrehAZcWNKVHtTcINka2T/6y1zwT4XmO59ROQe1/rD yFNlSLtmO8inA5vu1d90g+L0eXEpUTdrabvP73I0f5nSsIJAOb4cYs6v0xk0WTy/05Sb BV0/7inc+iMi9qBsQ+2Llt7Zs6Umm04/+RKKEGQEnghQpx4Zl/ixenkggWYyW4Al63LZ 0K5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ytdCZywe; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l22-20020aa7cad6000000b0051bec072038si2555334edt.260.2023.06.26.07.14.30; Mon, 26 Jun 2023 07:14:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ytdCZywe; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230413AbjFZN5s (ORCPT + 99 others); Mon, 26 Jun 2023 09:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbjFZN5a (ORCPT ); Mon, 26 Jun 2023 09:57:30 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2056.outbound.protection.outlook.com [40.107.92.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4803410C4 for ; Mon, 26 Jun 2023 06:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NFD3iYK+efdKwRFHPeM0doxbL7aeBHnNAkN1QJTfSxUq36cy9fJadhEBtJSASNYZk47mTOekOzoFSyHu0WduqXEhtjkxAyZsbfn/Drk+q+fr1nd60ZrBgnNUkRc6JfwHvusVA2DIwGXyi/5vCDxSf4yQrf01bi67FXETS8frCZHBwsZ72PLoy3LgiS16lmlIQMgMf0PlSblOLmRONVsCJz7kWDtS2KCl9nOuLQF+UhDeisTypWG6V7+hqIovxGwNodqV6BRHlA6wfRXly73mVtqHUWmodAQV4v+PMRps5zmivxkAkRK+b8o+WRyhrwb3hjq5DxNrUz/jvmTDZ+q1QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=iBy8FZtzhflK/O11biPfyMuMDcZU0bVlpYPp66Nv80c=; b=bDoAafdjy/TLv/MfekvjxjOekf2u31kOPk/IT6NpQFsAARtw3rV2bYw0rC327DzdiCTPYHPffERt03Vv5S60zMCxoPXlXabCwruYIz++aAVS5csbFa7ZHlrRqI3RcSamJwwcHTvYvzFry6vWPjyvMHWewov0+kfWes4FqI9yGnEzreV7aSWGwPPqeK+3hzd8Fc9kjlUwbmwIRzwwJuEW9KuHP0hqBdOiM20AuT7h5QMg94DRgcuRUJ7ci+5AgdnRiEa+cosh+naXeq0SwGjIXHJCwhdlsQ0YwFb51U0h/R+bRYTefiQ1hfD6FGcZBpQNlvbGl5nxM0NZePhH1AxGsA== 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 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=iBy8FZtzhflK/O11biPfyMuMDcZU0bVlpYPp66Nv80c=; b=ytdCZywevSpL9TvBio4cfSl5tL/7sswFpzBBvBfd8NcFRS/7Gf7DPQ14q7KECOci0NvJ/yw8oJ5T9dZ2+02TLjeRkUMQx8GNv1HL5nR45TjfTayZRKb52vjqYxwXeqUYwMyYcoaISGlaz4sRB+Q4CdMsMK7RC+wR6qbGZdGG2ro= Received: from BN9PR03CA0301.namprd03.prod.outlook.com (2603:10b6:408:112::6) by CH2PR12MB4118.namprd12.prod.outlook.com (2603:10b6:610:a4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 13:56:58 +0000 Received: from BN8NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:408:112:cafe::ca) by BN9PR03CA0301.outlook.office365.com (2603:10b6:408:112::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:56:58 +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 BN8NAM11FT099.mail.protection.outlook.com (10.13.177.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:56:58 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.23; Mon, 26 Jun 2023 08:56:58 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:56:54 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH v2 09/10] ASoC: amd: acp: move pdm macros to common header file Date: Mon, 26 Jun 2023 19:25:13 +0530 Message-ID: <20230626135515.1252063-10-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT099:EE_|CH2PR12MB4118:EE_ X-MS-Office365-Filtering-Correlation-Id: ce468f8f-d0f5-4fd7-34a3-08db764d3592 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GtmOSUB7WGO3mUZS3t23KzfEwP64MXOerAd3ZgsRfuUtMf2X8h3YUC9CbXo44nyOskp13LO0a3OiAo1qSH7CAM0j19s6M0xWdJvjer/1cGUf/NUH9yXUupF6hffG0fJ8/2S9h3dIr1krjkt9l9DC5MJHJwSpA08oYkV99Gq8/mtNR6G3gkDfgFUHAjusEujJ2ShZ/em0E+ADWXuNidRtdp7lfRVPwDGCW+m6WT6Xf108wMftYDAnGL8ntUaY+EdcvFugtJVZEK4blLYsrI2/zWe9Scb0k5e+d5p1HBcj6j935G0RMzjDpz5fcVGiDWEV+sjhIZFcCuzie6XzknHvnZQ3IyGi/4BdzMqmzxeayCd5KRVI/CB9sSu0rCbmhs5w4NBmm9M0HE9fWSgFVrVf9kvYM/ihtUsi5j75do/VcTOL3HYHEBO7YyGRN1lQ80lSdV96yoOv1hokYgiLESwMqIF6YCALUcPtx4fTh2ImZ/l+35KOb+f80aWnSRSBe/SHRTVboHeFyLLZJIDWdnZhbhAj+mO6mYJ1QzxERCryf7ZGXkbegiVZ7AsGx/3a9CWAp3cdRrSJv/ZI0/eVlhCxZX7vSYtzSiGeUv+H2Qtd4/6HCEylUl9qZFREG2r65uUwyfwHao0qgAhg5qzF3zhZ6gdEeYxLeAqdGx6/kXVIkpgqywfc2YERWF8o6DLe8Si7Dds6s9pkXkd8fEFR4fpCin1kZ1NLtt8PjKq+BvYrIvQsYVjJ/KhxvxkTLsyXX0iiUcsyJol6J4wIeytU4pfahg== 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:(13230028)(4636009)(376002)(396003)(39860400002)(136003)(346002)(451199021)(46966006)(36840700001)(40470700004)(2906002)(186003)(26005)(1076003)(426003)(47076005)(2616005)(81166007)(336012)(356005)(40480700001)(36860700001)(41300700001)(40460700003)(83380400001)(70586007)(70206006)(8936002)(8676002)(36756003)(82740400003)(6666004)(54906003)(7696005)(86362001)(110136005)(478600001)(4326008)(316002)(82310400005)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:56:58.5921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce468f8f-d0f5-4fd7-34a3-08db764d3592 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: BN8NAM11FT099.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4118 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769774928896744817?= X-GMAIL-MSGID: =?utf-8?q?1769774928896744817?= Move pdm related macros from pdm file to common header file so that it can be used across different files. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-pdm.c | 12 ------------ sound/soc/amd/acp/amd.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/amd/acp/acp-pdm.c b/sound/soc/amd/acp/acp-pdm.c index 2833d2b7e596..f754bf79b5e3 100644 --- a/sound/soc/amd/acp/acp-pdm.c +++ b/sound/soc/amd/acp/acp-pdm.c @@ -25,18 +25,6 @@ #define DRV_NAME "acp-pdm" -#define PDM_DMA_STAT 0x10 -#define PDM_DMA_INTR_MASK 0x10000 -#define PDM_DEC_64 0x2 -#define PDM_CLK_FREQ_MASK 0x07 -#define PDM_MISC_CTRL_MASK 0x10 -#define PDM_ENABLE 0x01 -#define PDM_DISABLE 0x00 -#define DMA_EN_MASK 0x02 -#define DELAY_US 5 -#define PDM_TIMEOUT 1000 -#define ACP_REGION2_OFFSET 0x02000000 - static int acp_dmic_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 82e0684cb284..8dc663c8d98a 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -111,6 +111,18 @@ #define ACP_TIMEOUT 500 #define DELAY_US 5 +#define PDM_DMA_STAT 0x10 +#define PDM_DMA_INTR_MASK 0x10000 +#define PDM_DEC_64 0x2 +#define PDM_CLK_FREQ_MASK 0x07 +#define PDM_MISC_CTRL_MASK 0x10 +#define PDM_ENABLE 0x01 +#define PDM_DISABLE 0x00 +#define DMA_EN_MASK 0x02 +#define DELAY_US 5 +#define PDM_TIMEOUT 1000 +#define ACP_REGION2_OFFSET 0x02000000 + struct acp_chip_info { char *name; /* Platform name */ unsigned int acp_rev; /* ACP Revision id */ From patchwork Mon Jun 26 13:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 112960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7514001vqr; Mon, 26 Jun 2023 07:14:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PCtRJ/+RgS92MB8S8hC8NsCmD0YQHC2YlkVBAAg8dFOvrswR1aC1+UDqL1XFb1SeCWLSS X-Received: by 2002:a05:6a20:4404:b0:129:f3e5:98a4 with SMTP id ce4-20020a056a20440400b00129f3e598a4mr16700pzb.17.1687788871559; Mon, 26 Jun 2023 07:14:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687788871; cv=pass; d=google.com; s=arc-20160816; b=lE9XvU3xkz5ar4HJuU9KjK83nuX8lhpXDH+Cedw5lXfAYoF6QUusQbiWuRX8AKLD47 14TySo/TZIElIUmbMdSJHRtzYO3qkCMkO5U77gh7XRofWGAcvkihy7qhW9p//Lk/QiwD BkKrj6G9HiYhSkaqlzm5fRWM22BXTddPii2brAZhIglrZ0oTa1eZM1wqSzQLNLdRj1kY e6izT7skM+1/9BtGRCcHF8qi4hNobZA5kyPb0DLn8sXN9RcT4X0r6RAi8AyjNdJxaAcX JCq/TsZ7i8raNFqrVj7ryOJJ+9krxpaHoG7T+4wRHbHCmfLIfQLvQxRjZstE+eroDI+p Nqqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r+G2AQ17z5b7R0yK+AQ3m9q3+FsAdVKar1G38pNPNjM=; fh=zF24KHbklc1mPMr4NiwKz69VURrt86QffOm2vD6+WeQ=; b=KJLAuq/WBe85xSxMvreN3fJmGz6bJ9BNLYk8Klca/mjVd2HiVaRiV02vq/Klgpc4Yi ULJ24Ds1VryTCVoOa5taMM5P3jrjNME9ZX94XIec0ZTtKkAAY8ODQYIvlYqP01IBpsjH EyQOnWPkpTv5rHvJ/y1OtQhA64Jls1UOFLdeWijpFHSidG6q9kgceaLmGy0fqXEQdt0T 2iihovMlfwvJTq9VR4YeyL7h6RaCdDG1ug+qE4TL3AuvFQxgPjtxyeoifKuBB3vZnW3s nCu9qI87XBUGasC73P7MB+qzAZyS9gFlqSfcNKkLml+WiB3Oz/ze8k1qoNeuYiOnzGpl dTJA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=XEDxt6vg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a170902708c00b001ac94b7f2f0si4703165plk.523.2023.06.26.07.14.19; Mon, 26 Jun 2023 07:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=XEDxt6vg; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbjFZN6G (ORCPT + 99 others); Mon, 26 Jun 2023 09:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbjFZN5v (ORCPT ); Mon, 26 Jun 2023 09:57:51 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC56710F9 for ; Mon, 26 Jun 2023 06:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OYHixpxssU9En2Tqov66gkEvOh0BbSi/HcE/2ft3cN3UetUGqudXpoS6sZZv8KSsM3kllUZOTE+8hKjkEyHfdaQdZztJQUIDM+7lUIerd8OLCfkaG10yVBnHurAf67JciLU0eo4b8t/aw75SvOCw5xOsTBSISjQAFiJrT7zUbxXL0ean8S0S/WJI8q7BFw9FTsd/qVd6I2SL/9baMhapFm+ygIGm4zi2mftPQqL8bAW62RDcybpoOsjcT9MyYTQXV1eEDbBBQcIXCX4/Tdiytb2fGFLo9hF+JTx8R/xVhYurz/1RKIzteS1RrbTRK9cg3lS9Y+LzwLadq37n+X4QyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=r+G2AQ17z5b7R0yK+AQ3m9q3+FsAdVKar1G38pNPNjM=; b=h6R+2sWkMae87dWJf//ghErm1WiaM7feSXsu+yb1m8hQJnqLX9YrUcKVaNVvs1xdBhQZtPxa/fAshfKlSd11kfhBf7VthnanqrOfDPMOleYOBTXpozxN+8w+mV42uauUADko3NAXopkX/PsLGOyuJVlypj3wXcGHf4vXDEGB5yCi1Bo1s3hTgOxK0pyf6q7KHoOXn81e6cW7t2kjEp0sVMCnGQ0gPDNz2Irj0MoHdfxopLJVtr43FzXMdG0i+go+w92vUc7vZVNS6ooXMTYXehZzCsUVt+FYY0AUzG8uhfMl7b1Cl5QKNk7lgJRxoWJKWzSyDiJV/Ubn/VkzvKnCyQ== 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 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=r+G2AQ17z5b7R0yK+AQ3m9q3+FsAdVKar1G38pNPNjM=; b=XEDxt6vgzEKp1Km3j2hg3DOJ5vDyoWGwZ+MXodb83d6CHDYqNR3RajzJkKxMoE+DMKpMEldk5QdslZSBAdAPHZjD7UMmCcdPcPMlqmuJdZjO/Am7XDrRKfD4zEuWLwVp+9GkQ7xjoO/caJMwFUexKVSoPudOuTiaPqPsJOUGrmw= Received: from BN9PR03CA0544.namprd03.prod.outlook.com (2603:10b6:408:138::9) by PH8PR12MB7352.namprd12.prod.outlook.com (2603:10b6:510:214::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 13:57:11 +0000 Received: from BN8NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:408:138:cafe::4d) by BN9PR03CA0544.outlook.office365.com (2603:10b6:408:138::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Mon, 26 Jun 2023 13:57:11 +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 BN8NAM11FT080.mail.protection.outlook.com (10.13.176.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Mon, 26 Jun 2023 13:57:11 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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.23; Mon, 26 Jun 2023 08:57:11 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 26 Jun 2023 08:57:10 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Mon, 26 Jun 2023 08:57:06 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V Sujith Kumar Reddy , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH v2 10/10] ASoC: amd: acp: add pm ops support for rembrandt platform Date: Mon, 26 Jun 2023 19:25:14 +0530 Message-ID: <20230626135515.1252063-11-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> References: <20230626135515.1252063-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT080:EE_|PH8PR12MB7352:EE_ X-MS-Office365-Filtering-Correlation-Id: 43e4dd0c-3bcf-4acb-9311-08db764d3d1c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i/7g1u1RU+F9XARqkC4a2VUIzKvLk65k/Gag80rWwN+sngUUFYpD/5HvQI4phHYzFJYDt5VCC0jFs+McppElT9hQ7avxNLEQG+m9eDazBxZueex/15CQXAmBKLxvK1DtGsKD+iY8DvnMN8yJ0wK4b4f8GtYiO7+Iv9aca6y/hjFmpxGt9sDoO3W8MrkW5beyLtGXcZxV0AqZb/+sMAH4d3dngYlmUlPLCToreePlUnl7vjeJzAA4kGNn17O4xvWWy3n+9LY6kXf2KWd/mKuA4cHD5qZ8fd0kvkkHpwd2sg+XXdjZlp7RH6LEyJ/giM14kXMufSa8MF3oU3ccGGqY8RMgRfOgt9BFUEefsmY9+lOrjaHrMUUBkZSveEp0pXBpfJH8sbt0QHvCs8eNGSUWgIWzZHEMaIgqAOf78pmUySRL6EDW3cnO5Je4UfwzbK/Ua6m8gHxCV+Lf9X3cPC5qdy93V4NSSPgZWtWvLrrLZ+atwlyVCjv9TphEVL2lU/ku/N5cNyGYQKcm3PD4L+tAyMd+t75VVMhxBVnaEQanhtK9m7uZPpFOagx0/y3K6IGPtJN7AJF605jBMjMbls9uLC5DnuwE7GfmOAzHmz/NyhCx299r21SVmbiNuEmfmI+EB6MT4tF/Dp2XMv8t5gIYhDr1DAmvdKm7BxkqgA+0Ydg8akV5RKxfFCH61jirS9JNLxaMnTY1N+7AkEJzBEbswQRnQdQREjesuXnOiyeuyExICnfVqcAv+L1wZ1c/ip2/1i3DvWZBoCi/lEiN8gwzZA== 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:(13230028)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199021)(36840700001)(46966006)(40470700004)(2906002)(30864003)(7696005)(82310400005)(82740400003)(6666004)(356005)(81166007)(2616005)(83380400001)(336012)(426003)(1076003)(186003)(26005)(47076005)(36860700001)(40460700003)(41300700001)(40480700001)(86362001)(110136005)(54906003)(478600001)(70586007)(70206006)(316002)(4326008)(8936002)(8676002)(5660300002)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 13:57:11.2430 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43e4dd0c-3bcf-4acb-9311-08db764d3d1c 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: BN8NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7352 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769774903817368127?= X-GMAIL-MSGID: =?utf-8?q?1769774903817368127?= Add pm ops for rembrandt platform. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-legacy-common.c | 208 ++++++++++++++++++++++++++ sound/soc/amd/acp/acp-rembrandt.c | 42 +++++- sound/soc/amd/acp/amd.h | 9 ++ 3 files changed, 258 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c index 45a45d002915..ba58165cc6e6 100644 --- a/sound/soc/amd/acp/acp-legacy-common.c +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -37,6 +37,214 @@ void acp_disable_interrupts(struct acp_dev_data *adata) } EXPORT_SYMBOL_NS_GPL(acp_disable_interrupts, SND_SOC_ACP_COMMON); +static void set_acp_pdm_ring_buffer(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct acp_stream *stream = runtime->private_data; + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + + u32 physical_addr, pdm_size, period_bytes; + + period_bytes = frames_to_bytes(runtime, runtime->period_size); + pdm_size = frames_to_bytes(runtime, runtime->buffer_size); + physical_addr = stream->reg_offset + MEM_WINDOW_START; + + /* Init ACP PDM Ring buffer */ + writel(physical_addr, adata->acp_base + ACP_WOV_RX_RINGBUFADDR); + writel(pdm_size, adata->acp_base + ACP_WOV_RX_RINGBUFSIZE); + writel(period_bytes, adata->acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE); + writel(0x01, adata->acp_base + ACPAXI2AXI_ATU_CTRL); +} + +static void set_acp_pdm_clk(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + unsigned int pdm_ctrl; + + /* Enable default ACP PDM clk */ + writel(PDM_CLK_FREQ_MASK, adata->acp_base + ACP_WOV_CLK_CTRL); + pdm_ctrl = readl(adata->acp_base + ACP_WOV_MISC_CTRL); + pdm_ctrl |= PDM_MISC_CTRL_MASK; + writel(pdm_ctrl, adata->acp_base + ACP_WOV_MISC_CTRL); + set_acp_pdm_ring_buffer(substream, dai); +} + +void restore_acp_pdm_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata) +{ + struct snd_soc_dai *dai; + struct snd_soc_pcm_runtime *soc_runtime; + u32 ext_int_ctrl; + + soc_runtime = asoc_substream_to_rtd(substream); + dai = asoc_rtd_to_cpu(soc_runtime, 0); + /* Programming channel mask and sampling rate */ + writel(adata->ch_mask, adata->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS); + writel(PDM_DEC_64, adata->acp_base + ACP_WOV_PDM_DECIMATION_FACTOR); + + /* Enabling ACP Pdm interuppts */ + ext_int_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, 0)); + ext_int_ctrl |= PDM_DMA_INTR_MASK; + writel(ext_int_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, 0)); + set_acp_pdm_clk(substream, dai); +} +EXPORT_SYMBOL_NS_GPL(restore_acp_pdm_params, SND_SOC_ACP_COMMON); + +static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_resource *rsrc = adata->rsrc; + struct acp_stream *stream = substream->runtime->private_data; + u32 reg_dma_size, reg_fifo_size, reg_fifo_addr; + u32 phy_addr, acp_fifo_addr, ext_int_ctrl; + unsigned int dir = substream->stream; + + switch (dai->driver->id) { + case I2S_SP_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_I2S_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + SP_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_TX_FIFOADDR; + reg_fifo_size = ACP_I2S_TX_FIFOSIZE; + phy_addr = I2S_SP_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_I2S_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_I2S_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + SP_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_RX_FIFOADDR; + reg_fifo_size = ACP_I2S_RX_FIFOSIZE; + phy_addr = I2S_SP_RX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_I2S_RX_RINGBUFADDR); + } + break; + case I2S_BT_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_BT_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + BT_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_BT_TX_FIFOADDR; + reg_fifo_size = ACP_BT_TX_FIFOSIZE; + phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_BT_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_BT_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + BT_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_BT_RX_FIFOADDR; + reg_fifo_size = ACP_BT_RX_FIFOSIZE; + phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_BT_RX_RINGBUFADDR); + } + break; + case I2S_HS_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_HS_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + HS_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_TX_FIFOADDR; + reg_fifo_size = ACP_HS_TX_FIFOSIZE; + phy_addr = I2S_HS_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_HS_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_HS_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + HS_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_RX_FIFOADDR; + reg_fifo_size = ACP_HS_RX_FIFOSIZE; + phy_addr = I2S_HS_RX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_HS_RX_RINGBUFADDR); + } + break; + default: + dev_err(dev, "Invalid dai id %x\n", dai->driver->id); + return -EINVAL; + } + + writel(DMA_SIZE, adata->acp_base + reg_dma_size); + writel(acp_fifo_addr, adata->acp_base + reg_fifo_addr); + writel(FIFO_SIZE, adata->acp_base + reg_fifo_size); + + ext_int_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + ext_int_ctrl |= BIT(I2S_RX_THRESHOLD(rsrc->offset)) | + BIT(BT_RX_THRESHOLD(rsrc->offset)) | + BIT(I2S_TX_THRESHOLD(rsrc->offset)) | + BIT(BT_TX_THRESHOLD(rsrc->offset)) | + BIT(HS_RX_THRESHOLD(rsrc->offset)) | + BIT(HS_TX_THRESHOLD(rsrc->offset)); + + writel(ext_int_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + return 0; +} + +int restore_acp_i2s_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata, + struct acp_stream *stream) +{ + struct snd_soc_dai *dai; + struct snd_soc_pcm_runtime *soc_runtime; + u32 tdm_fmt, reg_val, fmt_reg, val; + + soc_runtime = asoc_substream_to_rtd(substream); + dai = asoc_rtd_to_cpu(soc_runtime, 0); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + tdm_fmt = adata->tdm_tx_fmt[stream->dai_id - 1]; + switch (stream->dai_id) { + case I2S_BT_INSTANCE: + reg_val = ACP_BTTDM_ITER; + fmt_reg = ACP_BTTDM_TXFRMT; + break; + case I2S_SP_INSTANCE: + reg_val = ACP_I2STDM_ITER; + fmt_reg = ACP_I2STDM_TXFRMT; + break; + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_ITER; + fmt_reg = ACP_HSTDM_TXFRMT; + break; + default: + pr_err("Invalid dai id %x\n", stream->dai_id); + return -EINVAL; + } + val = adata->xfer_tx_resolution[stream->dai_id - 1] << 3; + } else { + tdm_fmt = adata->tdm_rx_fmt[stream->dai_id - 1]; + switch (stream->dai_id) { + case I2S_BT_INSTANCE: + reg_val = ACP_BTTDM_IRER; + fmt_reg = ACP_BTTDM_RXFRMT; + break; + case I2S_SP_INSTANCE: + reg_val = ACP_I2STDM_IRER; + fmt_reg = ACP_I2STDM_RXFRMT; + break; + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_IRER; + fmt_reg = ACP_HSTDM_RXFRMT; + break; + default: + pr_err("Invalid dai id %x\n", stream->dai_id); + return -EINVAL; + } + val = adata->xfer_rx_resolution[stream->dai_id - 1] << 3; + } + writel(val, adata->acp_base + reg_val); + if (adata->tdm_mode == TDM_ENABLE) { + writel(tdm_fmt, adata->acp_base + fmt_reg); + val = readl(adata->acp_base + reg_val); + writel(val | 0x2, adata->acp_base + reg_val); + } + return set_acp_i2s_dma_fifo(substream, dai); +} +EXPORT_SYMBOL_NS_GPL(restore_acp_i2s_params, SND_SOC_ACP_COMMON); + static int acp_power_on(struct acp_chip_info *chip) { u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index ea3d4aadc8e1..89314d95ec2b 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "amd.h" @@ -236,7 +237,11 @@ static int rembrandt_audio_probe(struct platform_device *pdev) acp6x_master_clock_generate(dev); acp_enable_interrupts(adata); acp_platform_register(dev); - + 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; } @@ -247,13 +252,48 @@ static void rembrandt_audio_remove(struct platform_device *pdev) acp_disable_interrupts(adata); acp_platform_unregister(dev); + pm_runtime_disable(&pdev->dev); +} + +static int __maybe_unused rmb_pcm_resume(struct device *dev) +{ + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_stream *stream; + struct snd_pcm_substream *substream; + snd_pcm_uframes_t buf_in_frames; + u64 buf_size; + + acp6x_master_clock_generate(dev); + spin_lock(&adata->acp_lock); + list_for_each_entry(stream, &adata->stream_list, list) { + if (stream) { + substream = stream->substream; + if (substream && substream->runtime) { + buf_in_frames = (substream->runtime->buffer_size); + buf_size = frames_to_bytes(substream->runtime, buf_in_frames); + config_pte_for_stream(adata, stream); + config_acp_dma(adata, stream, buf_size); + if (stream->dai_id) + restore_acp_i2s_params(substream, adata, stream); + else + restore_acp_pdm_params(substream, adata); + } + } + } + spin_unlock(&adata->acp_lock); + return 0; } +static const struct dev_pm_ops rmb_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, rmb_pcm_resume) +}; + static struct platform_driver rembrandt_driver = { .probe = rembrandt_audio_probe, .remove_new = rembrandt_audio_remove, .driver = { .name = "acp_asoc_rembrandt", + .pm = &rmb_dma_pm_ops, }, }; diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 8dc663c8d98a..1d8457383e3f 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -110,6 +110,7 @@ #define ACP_TIMEOUT 500 #define DELAY_US 5 +#define ACP_SUSPEND_DELAY_MS 2000 #define PDM_DMA_STAT 0x10 #define PDM_DMA_INTR_MASK 0x10000 @@ -213,6 +214,14 @@ void acp_disable_interrupts(struct acp_dev_data *adata); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); +void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream *stream); +void config_acp_dma(struct acp_dev_data *adata, struct acp_stream *stream, int size); +void restore_acp_pdm_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata); + +int restore_acp_i2s_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata, struct acp_stream *stream); + static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction) { u64 byte_count, low = 0, high = 0;