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: 696910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CE89EB64D7 for ; Mon, 26 Jun 2023 13:57:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4BF3A84A; Mon, 26 Jun 2023 15:56:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4BF3A84A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787822; bh=82LM/Vv3UH9rVr8D7cDw94ShEmsV4KsBD46xCqO5vI8=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=OSEnwQuFY41Duf8na7FvDmMBESeBo4KOGKqnIeDwPflqPIFVK9GlI/dg7dfpk6xew Wu8J+PwdKTkUKYEVpzSR/IKgIuZ/nxXSeKblwrJevQ5Ti5jxJItjZQOZFy80ikB1VD aTsshjbIFZOClYRz8feFVfOh6wq93eIl692i+tAY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4A16F80552; Mon, 26 Jun 2023 15:56:11 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8AD25F8053B; Mon, 26 Jun 2023 15:56:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 48CACF8053B; Mon, 26 Jun 2023 15:56:07 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2060e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::60e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AF45EF80169 for ; Mon, 26 Jun 2023 15:55:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AF45EF80169 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=mz7IsXc1 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 Message-ID-Hash: AA4O2LC7EI2O5BN6Q7SGL5VJ5SXZMDQ7 X-Message-ID-Hash: AA4O2LC7EI2O5BN6Q7SGL5VJ5SXZMDQ7 X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696540 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA112EB64DC for ; Mon, 26 Jun 2023 13:57:19 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CC9D7DEB; Mon, 26 Jun 2023 15:56:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CC9D7DEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787837; bh=9hrZFedsCusXPGxOZr/9vsBlGoz2rPps5XOiGzB/xkM=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=brVs2ebN1UIi4XbLeAiYh9pblTwm78UMxaHFDFZBf/GbRvC4nJPOiTPgomgTwxEcl OX2jE9ZGxgl8sy9HFFrHOYjXEG1XcsfvCoz2x02HhwLkGcsBqI9YQInL77tQrJXAJD rifrWdtHdCu6ZmkSCW+U1sPsXuMaW90AaL1eCblM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9C74AF80431; Mon, 26 Jun 2023 15:56:27 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1C91CF80431; Mon, 26 Jun 2023 15:56:27 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 311D7F80549; Mon, 26 Jun 2023 15:56:24 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20631.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eab::631]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3AEB9F80558 for ; Mon, 26 Jun 2023 15:56:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3AEB9F80558 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=c4cdq+dR 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 Message-ID-Hash: M7LH7R463FGDJG5NTIRR3UPCUNQMIFAE X-Message-ID-Hash: M7LH7R463FGDJG5NTIRR3UPCUNQMIFAE X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D65CEB64DA for ; Mon, 26 Jun 2023 13:57:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4900F857; Mon, 26 Jun 2023 15:56:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4900F857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787847; bh=VwDn3DTBFxnsJNJO/oDjkgLl7K8N7EdVOGhrknvHDZs=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=MoWfhyZO+nl9WUTlhsaNkZchVuiLjkRmJE+13KGtkl0D9cVdCpx0jYRj7W60Gqlkk Y1LoG5GtQFw3ajOOKhbPJ/+BC1MVG64l7mrK/7Vehqzwqg+b+V52DORie4cuqJyDOf S1IPJyV3Ug515w1DaYF3IZZ0PshfIPxcZUdQusMc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4D4AFF80567; Mon, 26 Jun 2023 15:56:34 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C7F86F80557; Mon, 26 Jun 2023 15:56:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CDB96F8055A; Mon, 26 Jun 2023 15:56:30 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20601.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::601]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 00B5DF80557 for ; Mon, 26 Jun 2023 15:56:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 00B5DF80557 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=VgGfDsRi 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 Message-ID-Hash: PIY5JMYU5N43NCVPXELAFRW3KWLTSRX5 X-Message-ID-Hash: PIY5JMYU5N43NCVPXELAFRW3KWLTSRX5 X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 200D1EB64DC for ; Mon, 26 Jun 2023 13:57:55 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id ED537AEA; Mon, 26 Jun 2023 15:57:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ED537AEA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787873; bh=oqh7iIs4xTff4sdTMspupiYjM5ENU2YfhDhaU7Xks6w=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=I3rdVc02/6cMQWoXZdin2NqD0Ak8v56v8fI2CuuvjJBzhvRw7MY2Ac3CylJGMd3RH TVCxtygYL1xDiGCGOiNK1xaClaCg9TNIcYK4cSa8bk7QJfx6CiY+xlQzIxVzU0aLHI 1Yrq+6ICkGiG+R/2yFxMB7N3jEL1C4MwZGVcmhxY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 31E92F80578; Mon, 26 Jun 2023 15:56:42 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 84721F80578; Mon, 26 Jun 2023 15:56:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3A433F8055B; Mon, 26 Jun 2023 15:56:38 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::61d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0289DF80551 for ; Mon, 26 Jun 2023 15:56:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0289DF80551 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=zMFuxtkc 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 Message-ID-Hash: L4RKSVDZEDG7S5QLNY4MGJT7SQUKOZP6 X-Message-ID-Hash: L4RKSVDZEDG7S5QLNY4MGJT7SQUKOZP6 X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696908 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 386FDEB64D7 for ; Mon, 26 Jun 2023 13:58:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D402F7F4; Mon, 26 Jun 2023 15:57:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D402F7F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787891; bh=gdgR++bgaiozEdPp+r0zfulX1h05zxnJ/aBl3a5LV9E=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=hH7cQr2x1t8sX26JVhnrSrefaVmoW2wqWszazMo4VUxnb9DkDnQmKALN4oOtF/hur kXbQl0xRLA0lWJky/I6dqgy0y8ZWzJDinDFWEGJN5DaS/ZkWuHiUFeo/U6/g4Ma2Z3 daMmSHw8d+iwXtNmdOsk+Y8EE61b0eQs/PcMxo8A= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DED3DF805A9; Mon, 26 Jun 2023 15:56:48 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 35385F80587; Mon, 26 Jun 2023 15:56:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C21D1F80587; Mon, 26 Jun 2023 15:56:44 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20625.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::625]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 95F54F8055B for ; Mon, 26 Jun 2023 15:56:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 95F54F8055B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=xKyd98YT 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 Message-ID-Hash: EH6R4TKKFCAPMN5B43WFL434VKGG6ZVU X-Message-ID-Hash: EH6R4TKKFCAPMN5B43WFL434VKGG6ZVU X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E08FEB64D7 for ; Mon, 26 Jun 2023 13:58:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1406BDF8; Mon, 26 Jun 2023 15:57:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1406BDF8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787899; bh=MRP0InxQls3A/qD8smrKvjN3jzJCbSuM0cMRRpKT1Rc=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EFHPdGenCesKz48fk28pqU1MhcVgn3KzmUyjqYKEfv/jOevx2ZQS1RnynYPY3yWd7 Y3khXDyS3zwBFTjYMv1MmBr3cozU4qlNrS5h161Ya0wYZlupf0KD3u0veMsqwg7KtY fdEMHSg+R+372HV4TNCcPZaLZYJ7dpjZEdJk4j70= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 227C2F805B4; Mon, 26 Jun 2023 15:56:51 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id BD3ADF805B1; Mon, 26 Jun 2023 15:56:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9DF77F80587; Mon, 26 Jun 2023 15:56:47 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20620.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::620]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6F2CFF8057E for ; Mon, 26 Jun 2023 15:56:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6F2CFF8057E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=SKefDmv6 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 Message-ID-Hash: BTW2OECEMISOWEC235EFGFH6KRNJPR6X X-Message-ID-Hash: BTW2OECEMISOWEC235EFGFH6KRNJPR6X X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30DA6EB64DC for ; Mon, 26 Jun 2023 13:58:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 637CADE5; Mon, 26 Jun 2023 15:57:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 637CADE5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787920; bh=HBiLnpJhS828367xDjuoW5bavr1a0Pj0J8nljDge//g=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ex1897tsCrs1e3ZYAjyUJFU524yFfHrgt2iq6wyVTXVDexk+K9v1UYWMPUsSib6wf Zx4HbLzJ3L4nmkiVfW2VA1IYqiK+UgfLXip2L8E8g5ktPbQLrhC/8JINUJavKbt7e7 v34drS9RbKzRU2P6n2nPFWbZVTwMTGioqlwkLd40= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7C40F80552; Mon, 26 Jun 2023 15:57:07 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 86836F8055A; Mon, 26 Jun 2023 15:57:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 38526F80544; Mon, 26 Jun 2023 15:57:04 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20613.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eab::613]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C86CFF80549 for ; Mon, 26 Jun 2023 15:56:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C86CFF80549 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=2AUZp0au 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 Message-ID-Hash: 7PZM3IXH57VL3YBQYF2D54Z34PU6ZJTN X-Message-ID-Hash: 7PZM3IXH57VL3YBQYF2D54Z34PU6ZJTN X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B505EB64DA for ; Mon, 26 Jun 2023 13:59:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E7AEB9F6; Mon, 26 Jun 2023 15:58:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E7AEB9F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787943; bh=aJDIrlpJaogXrlZvww+cNv5yDAT/rm5vPXpBBkSP/G4=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Eyo6EGml+fjbsGQR/QqG0ZzvSxL3drJVq0OHUVyKpZM92AOphvyd08B6+cH2pePc1 7n2XteQ7zu7jghEAGoR5LcE8BLTgjS7B4luDwS8NpJiQxFzYcYNUycXKMDoX3gyB7q MZotwBXINFKx4GGSMq24NF8kHTwg+avEahgwqCqQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 33E23F805B3; Mon, 26 Jun 2023 15:57:12 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 83B47F805BD; Mon, 26 Jun 2023 15:57:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 459FEF80548; Mon, 26 Jun 2023 15:57:06 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20623.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::623]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8503CF8027B for ; Mon, 26 Jun 2023 15:56:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8503CF8027B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=aNaKnx/n 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 Message-ID-Hash: PNF4L4ONV57JQIEYA2TS322KAMT3UVGH X-Message-ID-Hash: PNF4L4ONV57JQIEYA2TS322KAMT3UVGH X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8C89EB64DA for ; Mon, 26 Jun 2023 13:59:08 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AA8FFE81; Mon, 26 Jun 2023 15:58:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AA8FFE81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787946; bh=pxVEIZ17WqFcpZY8z1C60Ryv4TgMD+t0u4d7C+kbAQk=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LEU6BaSBl8x4MlVRhgCvn2t3MReXf29zLGF/jW7/RabThmcYWICetjiwjT2LdE4a8 0qGHtnrllp4pH4fw2i2+bUKRGq0bNXnsLfsHSz6FyhTrKaJbKrjc5dffOIv1kjl1b0 22CpmF0d/L88ekrThI6/GsSZrv5YSIIQzBtiTeSE= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 58BECF805C5; Mon, 26 Jun 2023 15:57:14 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 250A3F805C4; Mon, 26 Jun 2023 15:57:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1FD9FF8057A; Mon, 26 Jun 2023 15:57:10 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20604.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::604]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DE3E3F8057F for ; Mon, 26 Jun 2023 15:57:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DE3E3F8057F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=ytdCZywe 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 Message-ID-Hash: BEZVAH7W3GR7Y5QXQACUEKIJXWPRY62J X-Message-ID-Hash: BEZVAH7W3GR7Y5QXQACUEKIJXWPRY62J X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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: 696536 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06F8AEB64D7 for ; Mon, 26 Jun 2023 13:59:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E00C0DEC; Mon, 26 Jun 2023 15:58:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E00C0DEC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687787970; bh=IV78/xApHZtQUK7pEAr29//vb7fHQMvGJp/LtEjALE8=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=GNADxxqdAOjrIAKcSRkOm/QM25T2Grf6aaDlDNlMaig8IHD2cQfi83syhX+sMdRXL rEF00QyElAMEosw76+DXfbdLtyzuHzrglA867zMgqzbCopoe7KoAroNGEcuLZfQtAD Nl/jdB27yErfgCc7NipStTIEP5HQ5Ki5JwGPbuFc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2F518F805C6; Mon, 26 Jun 2023 15:57:24 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id DEEDFF80093; Mon, 26 Jun 2023 15:57:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B29AEF80431; Mon, 26 Jun 2023 15:57:20 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20606.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::606]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6C97AF805C4 for ; Mon, 26 Jun 2023 15:57:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6C97AF805C4 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=XEDxt6vg 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 Message-ID-Hash: 7SMM2BPAVTBRWR664U6YCK7AANZA7HSR X-Message-ID-Hash: 7SMM2BPAVTBRWR664U6YCK7AANZA7HSR X-MailFrom: Syed.SabaKareem@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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;