From patchwork Sat Aug 27 16:56:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 600585 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 D63FBC0502C for ; Sat, 27 Aug 2022 17:01:07 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 24C10161E; Sat, 27 Aug 2022 19:00:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 24C10161E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661619666; bh=2RXDr0ZunB5nCKBEUDYtu79SXo+rBLl3X1ypa7NfPaI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oESkt7CatK1Elerm9a6HAbTzcP/hKXgxrxnKLdotD6pEpygj2BO7MnSBgRBmO+rdi Ued4/MgOqxh6bt3qeA7t+ks4cAhJ/yNBcZ+gJgqyJ8vpCu8X9LAHDugzSS4F29wvs9 HIPd6TE82aHdi3sOq1Ks4qvRybIMKcAuH+gqoEkI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 74162F8052D; Sat, 27 Aug 2022 18:59:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D3073F8052F; Sat, 27 Aug 2022 18:59:43 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2076.outbound.protection.outlook.com [40.107.244.76]) (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 77C3BF80526 for ; Sat, 27 Aug 2022 18:59:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 77C3BF80526 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="YWjUOCt5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=khFco4a3TdLTy8m/6bcNfsOlqu3M9iIPp8Z0oB0VFqGJmg7zRwKPHGZoAMCx2adfHEIRbCc7QdCmULyDsUxX0eD9lH3KsSECElwUoJluOR/vPGOfpIsdk3/r487EH1KINFoeiFlH9vcm6am2uRBifg52FalGmyb9rsrR8nLY21MlNoFm7X1uRsTELQ+/6VB3jhwIJJMh+8sntS8PR5wjmvqVJ1Dl3iobaNYtuq5qMm32XQr0PGSrbs+hVMJsV5V58kCT1Ya4IK3fIqL75a1WlDdD+r0PwmcdlS6H+5c0c5hbdqw4IcGNQvoZoVu2b2M4fBrcfeTWYsCQ0UI1ZIRMMw== 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=vIQsHVe3Bj4pPChcGCypFb8fZQB6b26eNL/2K5BLdjE=; b=HfrBhClEgpYdcI84neyHuJvmOc9GnhLh70inb2LojC6MZXSvIF6m5XAvKuYFi+JY7zQWReUXbd6IR8BylKbQKUjx/8ejwLxP5GBIKRRnUTBLf6SXuMAs+7+yo5CNJewpBk9OnvaK48KjkMhUwc5PDhMLoKmnNey48dXt1Y+DK9ozOL/DkM5mzjIWOmf6mQvjnG7gYq/YtRe5CBvuvPHskOPNyQnEDrqkZImx7/ohpmqVJkxncCK7/GnvRpJGQYoLHDM0mKLEX+sIeJjC+p7AZDy+i9aSbv11S4crW9creI/ROHDQ2Y2GDtzEm1tJYVNpMWUVtK4ZV/DsfxQlPwok2g== 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=vIQsHVe3Bj4pPChcGCypFb8fZQB6b26eNL/2K5BLdjE=; b=YWjUOCt51cjbgx5+5I802+TsBN0U8///6V1glkqsDKakX+9PaoaDhXD3wYXbFnNB56PbMHhueK+pzF9EjDFy3D35GeWk/4oen9zd5I0N+8ZPf6TOFtsqBe8WCZtRA2F0yOJmwa2xPlXkmieVsO0JEoa4gFGTtMSjq8vDZOYCTk0= Received: from DM5PR08CA0055.namprd08.prod.outlook.com (2603:10b6:4:60::44) by CH0PR12MB5140.namprd12.prod.outlook.com (2603:10b6:610:bf::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Sat, 27 Aug 2022 16:59:31 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:4:60:cafe::9f) by DM5PR08CA0055.outlook.office365.com (2603:10b6:4:60::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 16:59:31 +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 DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 16:59:30 +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.2375.28; Sat, 27 Aug 2022 11:59:30 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2375.28; Sat, 27 Aug 2022 11:59:30 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Sat, 27 Aug 2022 11:59:26 -0500 From: Syed Saba Kareem To: , Subject: [PATCH v2 02/13] ASoC: amd: add Pink Sardine ACP PCI driver Date: Sat, 27 Aug 2022 22:26:46 +0530 Message-ID: <20220827165657.2343818-3-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> References: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58409804-eda3-4af8-52b1-08da884d827b X-MS-TrafficTypeDiagnostic: CH0PR12MB5140:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ee4hU6DXvDQii0xBKQ2au8gYS3sMecK0jQrQ9jNPBiLSB7AEvk59aOASKomMNmHOzuJ+HM38cFRuNYYB6BPJYo/XgzupyjdhNfvs6z2Oq6Ez6RQHCd73YKG9Z1kpX1JlTdePx5PFV+9SavEn5I3F2WB9GqoN/E1xAjmCEUhLWg2RC6jiKnvIsxGIT/LSTVJNGKLrlTbK3w3oFCJMBG8ekcdbbA4m5rQeWUYkgiUy0Qp1bI/9yMrvEKYIEMz3XbhRqeIWC6AoJHzjcy4ZVxwHYrXU5ymk3wykAopGkWpxA7g8QaBpa5D5aKhzvU2OBWlpwRTVN9KHyasj9Ysh/CvOPF/kxzSglTAS0regnjtvI6CZVA76VxaU/wcYeXM/b6Oe3GTvD4C84n8TZbpXNX84qbeadCc6uhO8gh5ZVv+v+mn7o8mkA8qWa5G+jq8m/Jpg4SWyN+V6YnLodtxDlZF+LBXaBqDRUkWVJ30JPVVMEbgg1V2pC5NbcTWW4UTRkjKeBdlxszQeBwpof50ogQ1xyTrI39Ldf59BGHk9+zwoRui03C4iuNdJfn0xBEsl07+YcsQdPeEosryPvLT25jtJq+NcV0VoEZBBlew+0UDrVG5g0XMOVeZ1m6cGgiWsII/oOVoqi+2Dsz0BxLgZGp1lUMTfR54KzTFt/eCr2reOaGFVGJlhpyA310Aroxl84QcRfCvMGRu90NWPquv4igVzRrvYTNjCZ3Q7cIpoKBye9lhnC7DTRSpQHhZ284SkikLZV+oKDRSFALZ9EH448xkap9vBzS5ibLctpYdv6jtwCQo= 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:(13230016)(4636009)(136003)(376002)(346002)(39860400002)(396003)(36840700001)(46966006)(40470700004)(7696005)(356005)(26005)(82310400005)(426003)(47076005)(2906002)(81166007)(83380400001)(54906003)(110136005)(82740400003)(36756003)(316002)(8676002)(4326008)(70586007)(70206006)(5660300002)(41300700001)(6666004)(8936002)(36860700001)(2616005)(186003)(1076003)(336012)(86362001)(478600001)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2022 16:59:30.8232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58409804-eda3-4af8-52b1-08da884d827b 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: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5140 Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , mario.limonciello@amd.com, Vijendar.Mukunda@amd.com, alexander.deucher@amd.com, Syed Saba Kareem X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" ACP is a PCI audio device. This patch adds PCI driver to bind to this device and get PCI resources for Pink Sardine Platform. Signed-off-by: Syed Saba Kareem Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/acp62.h | 20 +++++++++ sound/soc/amd/ps/pci-ps.c | 94 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 sound/soc/amd/ps/acp62.h create mode 100644 sound/soc/amd/ps/pci-ps.c diff --git a/sound/soc/amd/ps/acp62.h b/sound/soc/amd/ps/acp62.h new file mode 100644 index 000000000000..5291585f45f9 --- /dev/null +++ b/sound/soc/amd/ps/acp62.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * AMD ALSA SoC PDM Driver + * + * Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. + */ + +#include + +#define ACP_DEVICE_ID 0x15E2 + +static inline u32 acp62_readl(void __iomem *base_addr) +{ + return readl(base_addr); +} + +static inline void acp62_writel(u32 val, void __iomem *base_addr) +{ + writel(val, base_addr); +} diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c new file mode 100644 index 000000000000..8bb33845622a --- /dev/null +++ b/sound/soc/amd/ps/pci-ps.c @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * AMD Pink Sardine ACP PCI Driver + * + * Copyright 2022 Advanced Micro Devices, Inc. + */ + +#include +#include +#include + +#include "acp62.h" + +struct acp62_dev_data { + void __iomem *acp62_base; +}; + +static int snd_acp62_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + struct acp62_dev_data *adata; + u32 addr; + int ret; + + /* Pink Sardine device check */ + switch (pci->revision) { + case 0x63: + break; + default: + dev_dbg(&pci->dev, "acp62 pci device not found\n"); + return -ENODEV; + } + if (pci_enable_device(pci)) { + dev_err(&pci->dev, "pci_enable_device failed\n"); + return -ENODEV; + } + + ret = pci_request_regions(pci, "AMD ACP6.2 audio"); + if (ret < 0) { + dev_err(&pci->dev, "pci_request_regions failed\n"); + goto disable_pci; + } + adata = devm_kzalloc(&pci->dev, sizeof(struct acp62_dev_data), + GFP_KERNEL); + if (!adata) { + ret = -ENOMEM; + goto release_regions; + } + + addr = pci_resource_start(pci, 0); + adata->acp62_base = devm_ioremap(&pci->dev, addr, + pci_resource_len(pci, 0)); + if (!adata->acp62_base) { + ret = -ENOMEM; + goto release_regions; + } + pci_set_master(pci); + pci_set_drvdata(pci, adata); + return 0; +release_regions: + pci_release_regions(pci); +disable_pci: + pci_disable_device(pci); + + return ret; +} + +static void snd_acp62_remove(struct pci_dev *pci) +{ + pci_release_regions(pci); + pci_disable_device(pci); +} + +static const struct pci_device_id snd_acp62_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_AMD, ACP_DEVICE_ID), + .class = PCI_CLASS_MULTIMEDIA_OTHER << 8, + .class_mask = 0xffffff }, + { 0, }, +}; +MODULE_DEVICE_TABLE(pci, snd_acp62_ids); + +static struct pci_driver ps_acp62_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_acp62_ids, + .probe = snd_acp62_probe, + .remove = snd_acp62_remove, +}; + +module_pci_driver(ps_acp62_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_AUTHOR("Syed.SabaKareem@amd.com"); +MODULE_DESCRIPTION("AMD ACP Pink Sardine PCI driver"); +MODULE_LICENSE("GPL v2"); From patchwork Sat Aug 27 16:56:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 600584 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 681A7ECAAD1 for ; Sat, 27 Aug 2022 17:01:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B53D282C; Sat, 27 Aug 2022 19:00:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B53D282C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661619693; bh=PQ1noVpbjOyn9ljacpFYcbW+VYUE6O74rOoA0IeTpd8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hE61QgHBlYa+nJyCvLtULJuBYuvJIO2k+yuwSglTvElNC8BWZ2cowvx3NdlKaGfrn V4tyz3t6M1f6tpKjvctcSJCj1Vfd5PLzgigxQE3XMg1kAU2iikhGftG6r4GJyg9uAc hU4eUo/zMShlD1C2sYfV3pFdBX5lA0K0/JiuDqnI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D3802F8053B; Sat, 27 Aug 2022 19:00:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 59CF8F8053D; Sat, 27 Aug 2022 19:00:00 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69]) (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 3DE68F80536 for ; Sat, 27 Aug 2022 18:59:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3DE68F80536 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="UCvIjLR3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CMNzcndOxoRvkgdHfOpNzQ6/5DeOpkqscwh7SnThhHZOUlqpDtPqzEPYwKMDDmuSbigNiSXKXbOSHZ62NsxUsARamdCV7lzthB22U5T7orPghg1AY1oZME28SqhmSWgd2R5SDZXqNk3vFyF61ojhKiJjQM78Sksk7ytlfr9/UgdoQDqfbZODQB4rw9CT+fPjxHS6St78lod9Qklt+n4jl6w8IFZYNb3Cgf1UHKTbzghOjwct+bMYIDiuk0VMeTtEgSr6M/FiLq503qZduaHwkaQH78OBxHOrUB9ZECdjHOPgvJTKF40FeDvNEtzZze98s1jbeJTwoRiRSyYEU56Dtw== 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=k1ZtCbAh6UmUBvQ8RjLjIlxg4WFKsFP5AKwFQeg847U=; b=Flgext3U89JqZnmb5+bqJK4eKA42soJwUizH+UTNokhp9ZxUmpBi1MgkvXSSyoR9SzI7xkk53mD28wVlsL7f1OyxgLy/qEMR1U8ZAq10oQxlkedwDp4ypAKzqQXSxj4AzWJArARMNhjxJahgcafDgKlgImpi94S+lMgzwAmt0F765CfW37BiMhS4pQKL/uVyXiiLwyagTR3v+DVc0/D5s20z0m/rNKT+tQpiWCtx1RfqWsbsyWWmap87g6vF/66mppbGSW3E9OpDFkM8TYUcSoeTe/Dh2HrVPCeFWXMGC8FPZJb+fWK+lO0yKKPA2wYPt5vfODKIDjmaaLbORUJVIQ== 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=k1ZtCbAh6UmUBvQ8RjLjIlxg4WFKsFP5AKwFQeg847U=; b=UCvIjLR3pqjB2rY/gH60hTV8t+/xBRrqiGS+7b9UWlRF9jkeudCneEHijfnitDVpZ/yK5/NUccwpWPkmWszh3UiQjJvQHZbdmU4+KX/MWxzs9Y7ydt/RPl9e3rt9gl/3FaIbA7B+VSBufwzx6CoHtzcpgnyqgBF/tnkffgDiwLQ= Received: from BN9PR03CA0904.namprd03.prod.outlook.com (2603:10b6:408:107::9) by MN2PR12MB4408.namprd12.prod.outlook.com (2603:10b6:208:26c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Sat, 27 Aug 2022 16:59:49 +0000 Received: from BN8NAM11FT099.eop-nam11.prod.protection.outlook.com (2603:10b6:408:107:cafe::22) by BN9PR03CA0904.outlook.office365.com (2603:10b6:408:107::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 16:59:49 +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.5566.15 via Frontend Transport; Sat, 27 Aug 2022 16:59:48 +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.2375.28; Sat, 27 Aug 2022 11:59:47 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2375.28; Sat, 27 Aug 2022 11:59:46 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Sat, 27 Aug 2022 11:59:43 -0500 From: Syed Saba Kareem To: , Subject: [PATCH v2 04/13] ASoC: amd: add platform devices for acp6.2 pdm driver and dmic driver Date: Sat, 27 Aug 2022 22:26:48 +0530 Message-ID: <20220827165657.2343818-5-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> References: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6bfb7a4f-dc89-4efa-3a2d-08da884d8cda X-MS-TrafficTypeDiagnostic: MN2PR12MB4408:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qg+6o1F+nelXaXC5VrVx+QVchR9Kn6fSpUaYgBr9pSBMiNP0hwbioooup5LHNp+XmI+6CJ7HCsfVR8WjXltKlwNSMeAskHIk9R0RmHx0eMmZvwOWEnw+cyXvWIXcw6PX0P0/dn2xG+zcCNZ8d52NtCK/iFAYXRc16AX1o9C/gRN92AQ8/nkkUZO4iktQsruW3zJSMwvmU/wM3GYZPEan4Z0Fh/ybvLbMHAQuXG8r8gmpDDabtXajNYgdTGIOor7+1tzB07uuodsBUd+dGQhTU8Fz0K6rrV/8GRMK414Dn8GGM7+sVdxjjEErqAu+nybgeW8SpAKiI+7rGrmv/Qgj5fXVl+7ZpzWOZlis9EfOEWa0RIN5iJKbusWilY/5XAv0fTxQ2q6ddKjUs7Yw8sG0EmV9A0rU0rUXKlXVX8w+QPKfEdCucG1c1cpY9bTHZ47OuPWYwEI05w2r+pMr9UjEhGNqnN8xEUoMpfv/g8HrCGUQSYRirFYs/F5r3UDrbCt9xj3lMUBiuCGyzDzG9EcARPQ9JQXtn6pb5LJYDA3e1jTprPO1HLAdBrWfXQ0++T22+fzbchY2nQX5mooSPR5xdLm6YaPSSVJvIx3x8bxN3a1OTgfixSThkUwEYz2c3Vw3OtBuyJGPoNPmh9rP6N00gz8/uDhYaHO2brceUBiZMV4a5tyiOk0yazQ1Ql0VlAkjgju5WJIOjOnLhQfzjUy64Y4D30AJuSg3fq8ZpIngkIFkGGmIrR/qeIeQN/Ff13jwY/Uy6mAnz7Uwa80KMRneh5KL4D8ai/WbuUFWr2M2Q62uR9SJOU/xPgWUar1ytrPN 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:(13230016)(4636009)(136003)(396003)(346002)(39860400002)(376002)(46966006)(36840700001)(40470700004)(336012)(1076003)(426003)(47076005)(186003)(83380400001)(81166007)(356005)(86362001)(36860700001)(82740400003)(2616005)(40480700001)(8676002)(40460700003)(4326008)(70586007)(70206006)(36756003)(316002)(54906003)(82310400005)(110136005)(2906002)(5660300002)(8936002)(41300700001)(478600001)(7696005)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2022 16:59:48.2692 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bfb7a4f-dc89-4efa-3a2d-08da884d8cda 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: MN2PR12MB4408 Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , mario.limonciello@amd.com, Vijendar.Mukunda@amd.com, alexander.deucher@amd.com, Syed Saba Kareem X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" ACP6.2 IP has PDM decoder block. Create a platform device for it, so that the PDM platform driver can be bound to this device. Pass PCI resources like MMIO to this platform device. Create a platform device for generic dmic codec driver. Signed-off-by: Syed Saba Kareem Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/acp62.h | 23 +++++++++++ sound/soc/amd/ps/pci-ps.c | 81 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/ps/acp62.h b/sound/soc/amd/ps/acp62.h index 1f5e7d758f9f..79ad1bdb5b38 100644 --- a/sound/soc/amd/ps/acp62.h +++ b/sound/soc/amd/ps/acp62.h @@ -8,6 +8,10 @@ #include #define ACP_DEVICE_ID 0x15E2 +#define ACP6x_REG_START 0x1240000 +#define ACP6x_REG_END 0x1250200 +#define ACP6x_DEVS 2 +#define ACP6x_PDM_MODE 1 #define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001 #define ACP_PGFSM_CNTL_POWER_ON_MASK 1 @@ -21,6 +25,25 @@ #define ACP_ERROR_MASK 0x20000000 #define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF +enum acp_config { + ACP_CONFIG_0 = 0, + ACP_CONFIG_1, + ACP_CONFIG_2, + ACP_CONFIG_3, + ACP_CONFIG_4, + ACP_CONFIG_5, + ACP_CONFIG_6, + ACP_CONFIG_7, + ACP_CONFIG_8, + ACP_CONFIG_9, + ACP_CONFIG_10, + ACP_CONFIG_11, + ACP_CONFIG_12, + ACP_CONFIG_13, + ACP_CONFIG_14, + ACP_CONFIG_15, +}; + static inline u32 acp62_readl(void __iomem *base_addr) { return readl(base_addr); diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index a87dbf8847e6..adad29667791 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -9,11 +9,16 @@ #include #include #include +#include +#include #include "acp62.h" struct acp62_dev_data { void __iomem *acp62_base; + struct resource *res; + bool acp62_audio_mode; + struct platform_device *pdev[ACP6x_DEVS]; }; static int acp62_power_on(void __iomem *acp_base) @@ -114,8 +119,12 @@ static int snd_acp62_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { struct acp62_dev_data *adata; + struct platform_device_info pdevinfo[ACP6x_DEVS]; + int index, ret; + int val = 0x00; + struct acpi_device *adev; + const union acpi_object *obj; u32 addr; - int ret; /* Pink Sardine device check */ switch (pci->revision) { @@ -154,8 +163,72 @@ static int snd_acp62_probe(struct pci_dev *pci, ret = acp62_init(adata->acp62_base, &pci->dev); if (ret) goto release_regions; + val = acp62_readl(adata->acp62_base + ACP_PIN_CONFIG); + switch (val) { + case ACP_CONFIG_0: + case ACP_CONFIG_1: + case ACP_CONFIG_2: + case ACP_CONFIG_3: + case ACP_CONFIG_9: + case ACP_CONFIG_15: + dev_info(&pci->dev, "Audio Mode %d\n", val); + break; + default: + + /* Checking DMIC hardware*/ + adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), 0x02, 0); + + if (!adev) + break; + + if (!acpi_dev_get_property(adev, "acp-audio-device-type", + ACPI_TYPE_INTEGER, &obj) && + obj->integer.value == 2) { + adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL); + if (!adata->res) { + ret = -ENOMEM; + goto de_init; + } + + adata->res->name = "acp_iomem"; + adata->res->flags = IORESOURCE_MEM; + adata->res->start = addr; + adata->res->end = addr + (ACP6x_REG_END - ACP6x_REG_START); + adata->acp62_audio_mode = ACP6x_PDM_MODE; + memset(&pdevinfo, 0, sizeof(pdevinfo)); + pdevinfo[0].name = "acp_ps_pdm_dma"; + pdevinfo[0].id = 0; + pdevinfo[0].parent = &pci->dev; + pdevinfo[0].num_res = 1; + pdevinfo[0].res = adata->res; + + pdevinfo[1].name = "dmic-codec"; + pdevinfo[1].id = 0; + pdevinfo[1].parent = &pci->dev; + + for (index = 0; index < ACP6x_DEVS; index++) { + adata->pdev[index] = + platform_device_register_full(&pdevinfo[index]); + + if (IS_ERR(adata->pdev[index])) { + dev_err(&pci->dev, + "cannot register %s device\n", + pdevinfo[index].name); + ret = PTR_ERR(adata->pdev[index]); + goto unregister_devs; + } + } + } + break; + } return 0; +unregister_devs: + for (--index; index >= 0; index--) + platform_device_unregister(adata->pdev[index]); +de_init: + if (acp62_deinit(adata->acp62_base, &pci->dev)) + dev_err(&pci->dev, "ACP de-init failed\n"); release_regions: pci_release_regions(pci); disable_pci: @@ -167,9 +240,13 @@ static int snd_acp62_probe(struct pci_dev *pci, static void snd_acp62_remove(struct pci_dev *pci) { struct acp62_dev_data *adata; - int ret; + int ret, index; adata = pci_get_drvdata(pci); + if (adata->acp62_audio_mode == ACP6x_PDM_MODE) { + for (index = 0; index < ACP6x_DEVS; index++) + platform_device_unregister(adata->pdev[index]); + } ret = acp62_deinit(adata->acp62_base, &pci->dev); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); From patchwork Sat Aug 27 16:56:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 600583 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 D8448C0502C for ; Sat, 27 Aug 2022 17:02:06 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 17176162F; Sat, 27 Aug 2022 19:01:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 17176162F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661619725; bh=7D+obFcdUrOL8WhCrTVjfgZQl/vL/wpH3SXer8LP3AU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mlm1dk9EE/Yq/MCQS6u7UWRIiRfVCvbhNvJPbDa/lYy8zE6B0/aM3np70iqU6wRmo W0A4aPFs3ea945Bj/3Y6C05+ZbDp6eUh+7vkloEpYc963PQo9hGWLbBY4ABDq5tx79 m5C++TzOAilWyRqqM38WX0LeSeEEgYeqa9i5iWPI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5C53FF80301; Sat, 27 Aug 2022 19:00:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 355B4F80301; Sat, 27 Aug 2022 19:00:27 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2081.outbound.protection.outlook.com [40.107.243.81]) (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 E42C5F80301 for ; Sat, 27 Aug 2022 19:00:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E42C5F80301 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="vm+leOwN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JNqTZd0AJoPQ1JGFEtHtCIdITjs9Qs0oP4bnZYFdmE8/T327JVVTN3Eehl523XeD9z7abHXigzcLYz/JfLjJN1H/nERjJbkzog/oDMDZ/MYV7g/qdbFMoNksfxkA/aVxoZdafu71ZQIH5ygQ43fEzj59cYlIjKV0FRa/6hGALef3H9QyMuEA3328SWOE7lW3N33hnwf2Qy2p9KcdNUxyhF1qWPYjOzMlekuravy5VOTeIkb9WoBf2Kf9KOpyPuEvE2F37kDMR1ZPHp6KEdTAb5owOgxkGJNPfj5oFKVHHX4YPzlFmkoMuEH27yhayA4bvSERIWq99z239LJS+EQc4w== 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=mK2hOgeN7vclhULylIgWyEs3QJOWRqEDOULg4OqfuKQ=; b=mTCT/uup2BXi5BDCpLNVzJAOIagkCyHVjiVxhTAwPmVOrXDwRWBB3gQnnm358ySb+F6nfcMh77NYJJBwC430sN10JW1ZSbMadALlDnSjlglGML/ATjGowmyLtTz/2D1JvoEw+Kvb2E7QRCIx48jZkIEdFJJ5Jpkoh2LtcJhxatw/zh/DLxfsDZGdH56WMXyfWrrcOD/zAOTPGDojvhjj4cSJCcM/ovmqtvEkDkYeqQyWOjsSw+c+e6mGubpgffGRlyI053rXo05lMIQqHJp+6Oa+tG++1sHntl+w0Zf2WJvWqxfa1g88SgQ4aU1RZEDQW+bldGKJKUa5ltmc/Ev16w== 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=mK2hOgeN7vclhULylIgWyEs3QJOWRqEDOULg4OqfuKQ=; b=vm+leOwNhVeDu5TYx5YXaWU2fj89lzAiAIH8vzs6RGL39lUecp4FjNPxR1FygpywJarejeTLTzkStt+UUuh2DSpW2P9BuW+dQpoZ9khRgG/aktkCcYInGR6fqjevabrIf2nryWBY/Cw+rBqNNHxj5rP9LP7eJuLVFVZiAY6JZmk= Received: from DM6PR02CA0154.namprd02.prod.outlook.com (2603:10b6:5:332::21) by PH7PR12MB7113.namprd12.prod.outlook.com (2603:10b6:510:1ec::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Sat, 27 Aug 2022 17:00:14 +0000 Received: from DM6NAM11FT019.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::1d) by DM6PR02CA0154.outlook.office365.com (2603:10b6:5:332::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 17:00:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT019.mail.protection.outlook.com (10.13.172.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 17:00:13 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2375.28; Sat, 27 Aug 2022 12:00:13 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2375.28; Sat, 27 Aug 2022 10:00:13 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Sat, 27 Aug 2022 12:00:09 -0500 From: Syed Saba Kareem To: , Subject: [PATCH v2 07/13] ASoC: amd: add acp6.2 pdm driver dma ops Date: Sat, 27 Aug 2022 22:26:51 +0530 Message-ID: <20220827165657.2343818-8-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> References: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4330fd6-7d29-46f6-7764-08da884d9c19 X-MS-TrafficTypeDiagnostic: PH7PR12MB7113:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eN2YfAieaf+2R2bqXj0QI6qwCcSJncNmzjn9Ld1/tvIhBVTg26E2BKZgzbSRiC3pAzAOjIixgsxTLZj6m84HkoqgP8Ygc/OmuRtlcP66gM4Oci9/PNpTBNrE9kjNfwqzarya0VLWAQDvAduZc94q69ZDQO7aY/u+uU89iqMZbkgzCMpwvawPyS4pRwVLBG8EZF5Ku4vFL73IUIM0pOj0mBiuspdD7gXcR8MhMQLy7FlMn66g17pq/qpEHKpRZaJsXZJ99Pp/Az9H6y4XD3E6Yyb9n56EKThIo8nq4Aooir4QFsRKAiMdsk8e4iF7r8FM0U4dswZj/maYukM7Kg5rMLACWMZ7F30G69DFhThtYFL+uF7hvBZYfjdjElD+ZynmLvbbolNDA835/oN+wKM1BfWaBofkL/6ZZjEC+yCpicChLIwotmeCDutWTLtNine6OOKNYZyRpzNnrjEhc+OOL/NRXFNZ4SiMYwRXIkSaWLsIVZ1Gaj7PEP79EHsOuRT7GeZ+Vs03WWKvypkm2OtEj+0A1vsFjjphzd5YJ8UZjud3OCc8Ve8ywfuIiaJFMaawE616RiOeHBb/OHmXOlWdjdawzpC25bY4VQjSchUOFonE1tqU0oVSb8nNVjnehDHrWIrkHn+onShZS+Ic0ToiInbXYL/rC9hxI/wrO573EqUfFqfe4J+ToHk5Q9XaUOb63ODXjKmZPMrNajGM+sKPVtugotWv5FEpkyEQHWi6dEthlMFZUKyh3DNymFkG6i9syWnddQwf4xxhHfF+TrDh/W7e3AnpxwNNe/B2duy/11g62ZrI8x5wnYy7mrpl2E+w 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:(13230016)(4636009)(376002)(346002)(39860400002)(136003)(396003)(40470700004)(36840700001)(46966006)(7696005)(36756003)(6666004)(26005)(40460700003)(47076005)(186003)(336012)(1076003)(2616005)(426003)(110136005)(70206006)(70586007)(2906002)(316002)(54906003)(4326008)(8676002)(82310400005)(41300700001)(478600001)(30864003)(5660300002)(36860700001)(86362001)(82740400003)(356005)(81166007)(8936002)(83380400001)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2022 17:00:13.8026 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4330fd6-7d29-46f6-7764-08da884d9c19 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: DM6NAM11FT019.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7113 Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , mario.limonciello@amd.com, Vijendar.Mukunda@amd.com, alexander.deucher@amd.com, Syed Saba Kareem X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This patch adds PDM driver DMA operations for Pink Sardine Platform. Signed-off-by: Syed Saba Kareem Reviewed-by: Vijendar Mukunda --- sound/soc/amd/ps/acp62.h | 33 ++++ sound/soc/amd/ps/ps-pdm-dma.c | 313 ++++++++++++++++++++++++++++++++++ 2 files changed, 346 insertions(+) diff --git a/sound/soc/amd/ps/acp62.h b/sound/soc/amd/ps/acp62.h index 9e359006b06b..589c974f9997 100644 --- a/sound/soc/amd/ps/acp62.h +++ b/sound/soc/amd/ps/acp62.h @@ -26,6 +26,31 @@ #define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF #define PDM_DMA_STAT 0x10 +#define PDM_DMA_INTR_MASK 0x10000 +#define ACP_ERROR_STAT 29 +#define PDM_DECIMATION_FACTOR 2 +#define ACP_PDM_CLK_FREQ_MASK 7 +#define ACP_WOV_MISC_CTRL_MASK 0x10 +#define ACP_PDM_ENABLE 1 +#define ACP_PDM_DISABLE 0 +#define ACP_PDM_DMA_EN_STATUS 2 +#define TWO_CH 2 +#define DELAY_US 5 +#define ACP_COUNTER 20000 + +#define ACP_SRAM_PTE_OFFSET 0x03800000 +#define PAGE_SIZE_4K_ENABLE 2 +#define PDM_PTE_OFFSET 0 +#define PDM_MEM_WINDOW_START 0x4000000 + +#define CAPTURE_MIN_NUM_PERIODS 4 +#define CAPTURE_MAX_NUM_PERIODS 4 +#define CAPTURE_MAX_PERIOD_SIZE 8192 +#define CAPTURE_MIN_PERIOD_SIZE 4096 + +#define MAX_BUFFER (CAPTURE_MAX_PERIOD_SIZE * CAPTURE_MAX_NUM_PERIODS) +#define MIN_BUFFER MAX_BUFFER + enum acp_config { ACP_CONFIG_0 = 0, ACP_CONFIG_1, @@ -45,6 +70,14 @@ enum acp_config { ACP_CONFIG_15, }; +struct pdm_stream_instance { + u16 num_pages; + u16 channels; + dma_addr_t dma_addr; + u64 bytescount; + void __iomem *acp62_base; +}; + struct pdm_dev_data { u32 pdm_irq; void __iomem *acp62_base; diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c index 964686b46097..f0ec1a4f3b9d 100644 --- a/sound/soc/amd/ps/ps-pdm-dma.c +++ b/sound/soc/amd/ps/ps-pdm-dma.c @@ -17,6 +17,313 @@ #define DRV_NAME "acp_ps_pdm_dma" +static const struct snd_pcm_hardware acp62_pdm_hardware_capture = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, + .formats = SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .buffer_bytes_max = CAPTURE_MAX_NUM_PERIODS * CAPTURE_MAX_PERIOD_SIZE, + .period_bytes_min = CAPTURE_MIN_PERIOD_SIZE, + .period_bytes_max = CAPTURE_MAX_PERIOD_SIZE, + .periods_min = CAPTURE_MIN_NUM_PERIODS, + .periods_max = CAPTURE_MAX_NUM_PERIODS, +}; + +static void acp62_init_pdm_ring_buffer(u32 physical_addr, u32 buffer_size, + u32 watermark_size, void __iomem *acp_base) +{ + acp62_writel(physical_addr, acp_base + ACP_WOV_RX_RINGBUFADDR); + acp62_writel(buffer_size, acp_base + ACP_WOV_RX_RINGBUFSIZE); + acp62_writel(watermark_size, acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE); + acp62_writel(0x01, acp_base + ACPAXI2AXI_ATU_CTRL); +} + +static void acp62_enable_pdm_clock(void __iomem *acp_base) +{ + u32 pdm_clk_enable, pdm_ctrl; + + pdm_clk_enable = ACP_PDM_CLK_FREQ_MASK; + pdm_ctrl = 0x00; + + acp62_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL); + pdm_ctrl = acp62_readl(acp_base + ACP_WOV_MISC_CTRL); + pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK; + acp62_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL); +} + +static void acp62_enable_pdm_interrupts(void __iomem *acp_base) +{ + u32 ext_int_ctrl; + + ext_int_ctrl = acp62_readl(acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_int_ctrl |= PDM_DMA_INTR_MASK; + acp62_writel(ext_int_ctrl, acp_base + ACP_EXTERNAL_INTR_CNTL); +} + +static void acp62_disable_pdm_interrupts(void __iomem *acp_base) +{ + u32 ext_int_ctrl; + + ext_int_ctrl = acp62_readl(acp_base + ACP_EXTERNAL_INTR_CNTL); + ext_int_ctrl &= ~PDM_DMA_INTR_MASK; + acp62_writel(ext_int_ctrl, acp_base + ACP_EXTERNAL_INTR_CNTL); +} + +static bool acp62_check_pdm_dma_status(void __iomem *acp_base) +{ + bool pdm_dma_status; + u32 pdm_enable, pdm_dma_enable; + + pdm_dma_status = false; + pdm_enable = acp62_readl(acp_base + ACP_WOV_PDM_ENABLE); + pdm_dma_enable = acp62_readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if ((pdm_enable & ACP_PDM_ENABLE) && (pdm_dma_enable & ACP_PDM_DMA_EN_STATUS)) + pdm_dma_status = true; + + return pdm_dma_status; +} + +static int acp62_start_pdm_dma(void __iomem *acp_base) +{ + u32 pdm_enable; + u32 pdm_dma_enable; + int timeout; + + pdm_enable = 0x01; + pdm_dma_enable = 0x01; + + acp62_enable_pdm_clock(acp_base); + acp62_writel(pdm_enable, acp_base + ACP_WOV_PDM_ENABLE); + acp62_writel(pdm_dma_enable, acp_base + ACP_WOV_PDM_DMA_ENABLE); + timeout = 0; + while (++timeout < ACP_COUNTER) { + pdm_dma_enable = acp62_readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if ((pdm_dma_enable & 0x02) == ACP_PDM_DMA_EN_STATUS) + return 0; + udelay(DELAY_US); + } + return -ETIMEDOUT; +} + +static int acp62_stop_pdm_dma(void __iomem *acp_base) +{ + u32 pdm_enable, pdm_dma_enable; + int timeout; + + pdm_enable = 0x00; + pdm_dma_enable = 0x00; + + pdm_enable = acp62_readl(acp_base + ACP_WOV_PDM_ENABLE); + pdm_dma_enable = acp62_readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if (pdm_dma_enable & 0x01) { + pdm_dma_enable = 0x02; + acp62_writel(pdm_dma_enable, acp_base + ACP_WOV_PDM_DMA_ENABLE); + timeout = 0; + while (++timeout < ACP_COUNTER) { + pdm_dma_enable = acp62_readl(acp_base + ACP_WOV_PDM_DMA_ENABLE); + if ((pdm_dma_enable & 0x02) == 0x00) + break; + udelay(DELAY_US); + } + if (timeout == ACP_COUNTER) + return -ETIMEDOUT; + } + if (pdm_enable == ACP_PDM_ENABLE) { + pdm_enable = ACP_PDM_DISABLE; + acp62_writel(pdm_enable, acp_base + ACP_WOV_PDM_ENABLE); + } + acp62_writel(0x01, acp_base + ACP_WOV_PDM_FIFO_FLUSH); + return 0; +} + +static void acp62_config_dma(struct pdm_stream_instance *rtd, int direction) +{ + u16 page_idx; + u32 low, high, val; + dma_addr_t addr; + + addr = rtd->dma_addr; + val = PDM_PTE_OFFSET; + + /* Group Enable */ + acp62_writel(ACP_SRAM_PTE_OFFSET | BIT(31), rtd->acp62_base + + ACPAXI2AXI_ATU_BASE_ADDR_GRP_1); + acp62_writel(PAGE_SIZE_4K_ENABLE, rtd->acp62_base + + ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1); + for (page_idx = 0; page_idx < rtd->num_pages; page_idx++) { + /* Load the low address of page int ACP SRAM through SRBM */ + low = lower_32_bits(addr); + high = upper_32_bits(addr); + + acp62_writel(low, rtd->acp62_base + ACP_SCRATCH_REG_0 + val); + high |= BIT(31); + acp62_writel(high, rtd->acp62_base + ACP_SCRATCH_REG_0 + val + 4); + val += 8; + addr += PAGE_SIZE; + } +} + +static int acp62_pdm_dma_open(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + struct pdm_dev_data *adata; + struct pdm_stream_instance *pdm_data; + int ret; + + runtime = substream->runtime; + adata = dev_get_drvdata(component->dev); + pdm_data = kzalloc(sizeof(*pdm_data), GFP_KERNEL); + if (!pdm_data) + return -EINVAL; + + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + runtime->hw = acp62_pdm_hardware_capture; + + ret = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (ret < 0) { + dev_err(component->dev, "set integer constraint failed\n"); + kfree(pdm_data); + return ret; + } + + acp62_enable_pdm_interrupts(adata->acp62_base); + + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + adata->capture_stream = substream; + + pdm_data->acp62_base = adata->acp62_base; + runtime->private_data = pdm_data; + return ret; +} + +static int acp62_pdm_dma_hw_params(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct pdm_stream_instance *rtd; + size_t size, period_bytes; + + rtd = substream->runtime->private_data; + if (!rtd) + return -EINVAL; + size = params_buffer_bytes(params); + period_bytes = params_period_bytes(params); + rtd->dma_addr = substream->runtime->dma_addr; + rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); + acp62_config_dma(rtd, substream->stream); + acp62_init_pdm_ring_buffer(PDM_MEM_WINDOW_START, size, + period_bytes, rtd->acp62_base); + return 0; +} + +static u64 acp62_pdm_get_byte_count(struct pdm_stream_instance *rtd, + int direction) +{ + u32 high, low; + u64 byte_count; + + high = acp62_readl(rtd->acp62_base + ACP_WOV_RX_LINEARPOSITIONCNTR_HIGH); + byte_count = high; + low = acp62_readl(rtd->acp62_base + ACP_WOV_RX_LINEARPOSITIONCNTR_LOW); + byte_count = (byte_count << 32) | low; + return byte_count; +} + +static snd_pcm_uframes_t acp62_pdm_dma_pointer(struct snd_soc_component *comp, + struct snd_pcm_substream *stream) +{ + struct pdm_stream_instance *rtd; + u32 pos, buffersize; + u64 bytescount; + + rtd = stream->runtime->private_data; + buffersize = frames_to_bytes(stream->runtime, + stream->runtime->buffer_size); + bytescount = acp62_pdm_get_byte_count(rtd, stream->stream); + if (bytescount > rtd->bytescount) + bytescount -= rtd->bytescount; + pos = do_div(bytescount, buffersize); + return bytes_to_frames(stream->runtime, pos); +} + +static int acp62_pdm_dma_new(struct snd_soc_component *component, + struct snd_soc_pcm_runtime *rtd) +{ + struct device *parent = component->dev->parent; + + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + parent, MIN_BUFFER, MAX_BUFFER); + return 0; +} + +static int acp62_pdm_dma_close(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct pdm_dev_data *adata = dev_get_drvdata(component->dev); + struct snd_pcm_runtime *runtime = substream->runtime; + + acp62_disable_pdm_interrupts(adata->acp62_base); + adata->capture_stream = NULL; + kfree(runtime->private_data); + return 0; +} + +static int acp62_pdm_dai_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + struct pdm_stream_instance *rtd; + int ret; + bool pdm_status; + unsigned int ch_mask; + + rtd = substream->runtime->private_data; + ret = 0; + switch (substream->runtime->channels) { + case TWO_CH: + ch_mask = 0x00; + break; + default: + return -EINVAL; + } + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + acp62_writel(ch_mask, rtd->acp62_base + ACP_WOV_PDM_NO_OF_CHANNELS); + acp62_writel(PDM_DECIMATION_FACTOR, rtd->acp62_base + + ACP_WOV_PDM_DECIMATION_FACTOR); + rtd->bytescount = acp62_pdm_get_byte_count(rtd, substream->stream); + pdm_status = acp62_check_pdm_dma_status(rtd->acp62_base); + if (!pdm_status) + ret = acp62_start_pdm_dma(rtd->acp62_base); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + pdm_status = acp62_check_pdm_dma_status(rtd->acp62_base); + if (pdm_status) + ret = acp62_stop_pdm_dma(rtd->acp62_base); + break; + default: + ret = -EINVAL; + break; + } + return ret; +} + +static const struct snd_soc_dai_ops acp62_pdm_dai_ops = { + .trigger = acp62_pdm_dai_trigger, +}; + static struct snd_soc_dai_driver acp62_pdm_dai_driver = { .name = "acp_ps_pdm_dma.0", .capture = { @@ -27,10 +334,16 @@ static struct snd_soc_dai_driver acp62_pdm_dai_driver = { .rate_min = 48000, .rate_max = 48000, }, + .ops = &acp62_pdm_dai_ops, }; static const struct snd_soc_component_driver acp62_pdm_component = { .name = DRV_NAME, + .open = acp62_pdm_dma_open, + .close = acp62_pdm_dma_close, + .hw_params = acp62_pdm_dma_hw_params, + .pointer = acp62_pdm_dma_pointer, + .pcm_construct = acp62_pdm_dma_new, }; static int acp62_pdm_audio_probe(struct platform_device *pdev) From patchwork Sat Aug 27 16:56:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 600582 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 B3265C0502C for ; Sat, 27 Aug 2022 17:02:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0A3A5850; Sat, 27 Aug 2022 19:01:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0A3A5850 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661619758; bh=B2E9l8xGAnjFlfpWR4CnaDLYx5WkuCCGC+b8ts6Lf88=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QMYtQ3iWwlPI/LGPdnHzLJ6jaFiZksqCbfi0ayj5OxE7Tm2MYWLVA25RD6WPMk6oG SRJXtBdmlldX7r1Dz4DG/4af7sdCdMdKEOhW3ajXAoqFf7D53zSyeTRHwx6CSRcEzH FFxKrzuekNpm2tddYsQFY/QuwLRCeZSBaSjvw1vY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 88D46F80564; Sat, 27 Aug 2022 19:00:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 60693F80567; Sat, 27 Aug 2022 19:00:40 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2051.outbound.protection.outlook.com [40.107.220.51]) (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 23B53F80564 for ; Sat, 27 Aug 2022 19:00:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 23B53F80564 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="WJOhrhLF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=So6PpzVYuvEv0bBhpOKR6/4gjiGL4c4Y7rzVBGc19SBjw+y66OFk4L9ZdxiGgO3NS4LuOq+s/pr0n8vncLwuLzJYledqUBEwh5GLD5XIE17sP1JYkcKB/KATxDScNh+JE8h974zC02wD9AcSDkHIbPz95UD/aWZ7SqQYhfeYG3CLaJnF2zFDRQpr0dL1kvFF/Sjc4yxUBpXBuRlkwXH9kwPwrnRJgAhdhm+zBVDvZtriXjvCuvPfDNPMAIGs/cXxD8sn41NEZWZG5FHOtwfl988B/md4VgL9PtrW2yW1ad1Qu3qp8SewC2KCuw68qHgFpXw7wqwJ9NapHVET4ZJHCQ== 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=J7vhFRkqFyHu7AN+afeQ91y0G2jtowyCxHTF+C3uNNA=; b=M2iEjDg7USzepefFBwNPw+cfYoUVgBl6RDf1BGhKvM1lSi3mPcTp/kXsEE6S+O+WOT4OQxjFmSoJV/4MCUPjdstRPTlYF3TQobLf5BO9k/qJ8lWw0G60n2ZSYx6tDcR5E1iN6K/kKFqvLwWpKwdzl57uvy+8B0h5VVsiV5MbSn/tjGEbP5tDN2lJXefrts7IDf0Wu785dEzxoIjoLZEQIw1CkGXNiQVPdmd/FmxPh57cZZsp++wTg0R823/aZ9NjFKJ/EzgK63Etlv7l16r+lUUg43Y5WNbWzXeClaY2JG5kq23LNvxbkTTdmjIKiK9mM7mCiu+cDSR0Y3J8Xc7Rgw== 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=J7vhFRkqFyHu7AN+afeQ91y0G2jtowyCxHTF+C3uNNA=; b=WJOhrhLF3iHYO+oPqy3i1LUfcPPvqIxuwd/IPRuBffjiO2MqcSu0C0ULo47rWRK0AofO8sNFnIMY8kHOXcNvlnvtmyigj2bFheatmEtN6Oc1DajE/geqNb5VrayyTydhF40HcfEgNZTOSfv/FyQI99/vVvmp/lAQ6HzgYt+h/BY= Received: from BN9PR03CA0718.namprd03.prod.outlook.com (2603:10b6:408:ef::33) by CO6PR12MB5411.namprd12.prod.outlook.com (2603:10b6:5:356::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Sat, 27 Aug 2022 17:00:24 +0000 Received: from BN8NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ef:cafe::9) by BN9PR03CA0718.outlook.office365.com (2603:10b6:408:ef::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 17:00:24 +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 BN8NAM11FT078.mail.protection.outlook.com (10.13.176.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 17:00:22 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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.2375.28; Sat, 27 Aug 2022 12:00:21 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2375.28; Sat, 27 Aug 2022 10:00:21 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Sat, 27 Aug 2022 12:00:18 -0500 From: Syed Saba Kareem To: , Subject: [PATCH v2 08/13] ASoC: amd: add acp6.2 pci driver pm ops Date: Sat, 27 Aug 2022 22:26:52 +0530 Message-ID: <20220827165657.2343818-9-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> References: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d8d50e5-e372-4a0f-0875-08da884da11f X-MS-TrafficTypeDiagnostic: CO6PR12MB5411:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jFl+HDr8Tjfgh5kwrSq4vDAt8vxmR0rRv+6SxWZJCATrVXGa6BewLKe96pgy2ORbFsDfgqkXYwXT4x0HKvPFpXjPFQOD72vuV7oJO7oOQWQDuEguky8X9LD+GP7Jy7cUjNRI8iqwImhuBSNP62fvtwCygOozHbRDtSywyFWoAmks0lQKqv67xyy1VOUsq4Yj/C9QUbYlEAWdeF6qG9mGeDjmD5IF3g0vtIh02EuLm6ipPTCvYZgYWs0oJFY8HZMBGtPPO99gyT8lkl76fJ8Dnwi4sW79ja3ojaEkDBv9ul+wLg/8TyMLg9Xb8FDzAid9Feu24/yMejsIAPJkNPDa6IBVH9V8IQfT4FSim/yH81BWuS+LazC0U/wZBVSQ1CN1eFsgL4ILds9tdR5GlNcf+Z1X+F18Xyd3dlBFbb0/ayuBumry4/mE5f33br+MGCb980HtN+zHqi8UA90fdPzcK6qMODZQrYht2GLGT0eDOrPs0/5jZx0QLoxLjwaio6hweYfHQ8tLl8fvXRV8oyRO15TaUSl+esRsHnc+zWbwx9eehigfUWOfENZckcWP0CsYN3RCcJ7T/HWIZLYkzy6IK1Ik/q7Fb+toJZ1+pQv2I0qhmSIjAtiWCISkg74Drq+sqNRNUrZBuIbmPh8LWBX6mOb3IAbVC5Br+Q+sC5fE715ewJT81b+wMmp6Ry8mg56ZrH0Vbhpxg22OtT4sFNYSWOm6QXIDmmjq8ID9J9MedSM70s36j2rpN98Jovt80decLMfBU/axo1hbamYvIRtoAQFlKSpk5gZsKhngyfXgTt8= 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:(13230016)(4636009)(136003)(376002)(346002)(39860400002)(396003)(36840700001)(46966006)(40470700004)(7696005)(356005)(26005)(82310400005)(426003)(47076005)(2906002)(81166007)(83380400001)(54906003)(110136005)(82740400003)(36756003)(316002)(8676002)(4326008)(70586007)(70206006)(5660300002)(41300700001)(6666004)(8936002)(36860700001)(2616005)(186003)(1076003)(336012)(86362001)(478600001)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2022 17:00:22.2746 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d8d50e5-e372-4a0f-0875-08da884da11f 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: BN8NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5411 Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , mario.limonciello@amd.com, Vijendar.Mukunda@amd.com, alexander.deucher@amd.com, Syed Saba Kareem X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add acp6.2 pci driver pm ops. Signed-off-by: Syed Saba Kareem Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/acp62.h | 3 +++ sound/soc/amd/ps/pci-ps.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/sound/soc/amd/ps/acp62.h b/sound/soc/amd/ps/acp62.h index 589c974f9997..89ff14007e5c 100644 --- a/sound/soc/amd/ps/acp62.h +++ b/sound/soc/amd/ps/acp62.h @@ -51,6 +51,9 @@ #define MAX_BUFFER (CAPTURE_MAX_PERIOD_SIZE * CAPTURE_MAX_NUM_PERIODS) #define MIN_BUFFER MAX_BUFFER +/* time in ms for runtime suspend delay */ +#define ACP_SUSPEND_DELAY_MS 2000 + enum acp_config { ACP_CONFIG_0 = 0, ACP_CONFIG_1, diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index e4ddd80d0dd4..075d9a23205d 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "acp62.h" @@ -253,6 +254,10 @@ static int snd_acp62_probe(struct pci_dev *pci, } break; } + pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(&pci->dev); + pm_runtime_put_noidle(&pci->dev); + pm_runtime_allow(&pci->dev); return 0; unregister_devs: for (--index; index >= 0; index--) @@ -268,6 +273,35 @@ static int snd_acp62_probe(struct pci_dev *pci, return ret; } +static int __maybe_unused snd_acp62_suspend(struct device *dev) +{ + struct acp62_dev_data *adata; + int ret; + + adata = dev_get_drvdata(dev); + ret = acp62_deinit(adata->acp62_base, dev); + if (ret) + dev_err(dev, "ACP de-init failed\n"); + return ret; +} + +static int __maybe_unused snd_acp62_resume(struct device *dev) +{ + struct acp62_dev_data *adata; + int ret; + + adata = dev_get_drvdata(dev); + ret = acp62_init(adata->acp62_base, dev); + if (ret) + dev_err(dev, "ACP init failed\n"); + return ret; +} + +static const struct dev_pm_ops acp62_pm_ops = { + SET_RUNTIME_PM_OPS(snd_acp62_suspend, snd_acp62_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(snd_acp62_suspend, snd_acp62_resume) +}; + static void snd_acp62_remove(struct pci_dev *pci) { struct acp62_dev_data *adata; @@ -281,6 +315,8 @@ static void snd_acp62_remove(struct pci_dev *pci) ret = acp62_deinit(adata->acp62_base, &pci->dev); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); + pm_runtime_forbid(&pci->dev); + pm_runtime_get_noresume(&pci->dev); pci_release_regions(pci); pci_disable_device(pci); } @@ -298,6 +334,9 @@ static struct pci_driver ps_acp62_driver = { .id_table = snd_acp62_ids, .probe = snd_acp62_probe, .remove = snd_acp62_remove, + .driver = { + .pm = &acp62_pm_ops, + } }; module_pci_driver(ps_acp62_driver); From patchwork Sat Aug 27 16:56:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 600581 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 3CEBFC0502C for ; Sat, 27 Aug 2022 17:03:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 87725839; Sat, 27 Aug 2022 19:02:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 87725839 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661619801; bh=i+mAwXJow1pzaEGFP2dbEBahvDTAlOh2He3rXMCU4jA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OtldRD9hYTvPahNPkOfPie2FRVo0IsgbYfTu17xXcSs89Ep0m18wl7zb7TQL42hlw /oyjMFjqJUOU5xxykgA8p5tkvUSmFivJaB+Z/29wghb9m5GbncXLUYbVCS5LG1Z4PO Zu9Sh1S+SliDMkzgy0eHs0WtmX9esHYmtBkLQFaY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 42F3EF80132; Sat, 27 Aug 2022 19:01:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 00267F802E8; Sat, 27 Aug 2022 19:00:51 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2046.outbound.protection.outlook.com [40.107.212.46]) (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 D65B2F802E8 for ; Sat, 27 Aug 2022 19:00:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D65B2F802E8 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="41jwp1/h" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c0VkAMu4Ar2Q75qGc4V9jzeRauePHEw4AWOHXQ3FZ6d1iu5eZm5N4MpAY6fqqnYX6evbFKjA+S401Z0vxqOIfIeXzsYaYq00miQQKz73Oh7+V31J74TwfioUIEU5J9nfifCmiKDXOcYGcCt8/tsc5eQtkZfSi/iZ1glchClT238N5QFfaVoS8qIXgwDYsUTEsOW1Uov/GpKwsKmfiuewxaMkq7uAhUjIeUixzsSrGy3AQZI+Pmac0IU+zWtUzeCVoDULXMcAIBoSYSB6BxL9orXHlB9tl9h1FQ6VgRh7tdaetEeYm4rWtl9vs5hBLadKRG/TcbNu9Z8NmV/lI7gzBw== 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=GUVqbegoaAbedst9IwEttr4om4QfKduQQCj3uRVe758=; b=EG5+t77Tj6b8IS3Zv+951k12HzoxfeV3JgreMSNl4Kyv+/rFB+GMg2MigI0YTwNu+grzq02J2LnFRmwcnUgXS3gxGY1nRd4MORCn/1OOo1+TZBVGDM1IEMEdjDS6zKgW0tkjGGGPKU02x3JhSJbmQMY1aFXfoAOoepssx42zwU41PNU5XqNrfRa1n7uyLT0/85O9+2RejShnFFmYoaX/UL7WIXnmY/wNWDHs1GhY2ihqMdlyy3w7XMCY7bDoCnRtY3qASbUGUckSseUifL5yybOseDkwfwhDuFYnITOaknJZbF5O4AD2LybY8j0MKLrl20NFM3W0j77K4wWjtVtsLQ== 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=GUVqbegoaAbedst9IwEttr4om4QfKduQQCj3uRVe758=; b=41jwp1/h3QCD9gtt9rkHdu11OW9SYwYZe6FDyyt05GXujSj3VTEINSeF3m+QyFDDGpFugCH4OM+6X0tj26OFunNgwOfFTnBtwZHc+sa9r3NJlFQCKs9BofbU3lfOR/vwaff2xTfUtrA9yB1ShA1MczXaY9NpGf74TrUJHht8V10= Received: from DM6PR08CA0030.namprd08.prod.outlook.com (2603:10b6:5:80::43) by BN9PR12MB5242.namprd12.prod.outlook.com (2603:10b6:408:11f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Sat, 27 Aug 2022 17:00:40 +0000 Received: from DM6NAM11FT101.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::18) by DM6PR08CA0030.outlook.office365.com (2603:10b6:5:80::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.19 via Frontend Transport; Sat, 27 Aug 2022 17:00:40 +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 DM6NAM11FT101.mail.protection.outlook.com (10.13.172.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 17:00:40 +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.2375.28; Sat, 27 Aug 2022 12:00:39 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2375.28; Sat, 27 Aug 2022 10:00:39 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Sat, 27 Aug 2022 12:00:33 -0500 From: Syed Saba Kareem To: , Subject: [PATCH v2 10/13] ASoC: amd: enable Pink Sardine acp6.2 drivers build Date: Sat, 27 Aug 2022 22:26:54 +0530 Message-ID: <20220827165657.2343818-11-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> References: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4acafe1b-eee6-47ab-4617-08da884dabbb X-MS-TrafficTypeDiagnostic: BN9PR12MB5242:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FTEXyRE74hAslhxAbroZHVd2V6/fxj+eRmjR7/wXUysah0Fv/rHB9ygUw/u0euZhO77IPK4dGc3A7BDe4EiLOHYgpeSaqRYnQ3BS340QXwDfo/J4R1x9RG++H7EOf/vpfByPcq4ed7fGbJAGvczuNRtFZ52fEzIzzJHy73DJNAhhDmX9Ncxv/XiSJwFzz3tNfUV3/r88ALMuqrX60oH5wwKEgOLRuDvRxJY4QUjPViHx50/GPj+TjNKnAuxI/4VSUjWAijLEl1Z2o3iRk+qWd/+bHh84HyRaUwWwcIGA9NanWF/e7qeSCrofHiJ4TLnV5sFzmEmnodS7A8B1No8f3fGeh+JZJeHqhpZXPWnh6KYrA7gpJLMOvWa4btWt0LGGR95cRTdRhs3a+hJI8/I9JjEwXVcQXI6akAbz6T0HvnROuc2dIh+ORM9XisKdKeVpbXq041Hg1ZElU2dTR/gdqEo8K0gT8eOLBurjS2DnS1MQPReYo9D49m1tBTnTFFFtG3UdKiFPdBdQ260TepfPr729cei2tgWDw8zsd+SLv3qJbsWigaHJVp7dyi4csICU4lU8XfJKWEkCbh0yo2zitHntYE9lqR0UZAjwuQ4Gg0w1X3PYF+sgdBINFkOrlLUQOCwR89A/kC18Ks/u4x8VygpCYr1Pub2lN2RWQbLtuTTd/zM9tBY4ZrvcySPcXb46CGCMeYywsSmXWhBO5qvJq/oM8wd2Ag8DVDvWDS1pV9jAoSCZagB+kGxmJ2Pnb5BX9m931HlXNgSQdGAMUtmFxpZlbrhA1muX1a9T+e7EDEI/nx0Ey/mS/SW8bNjjMBVc 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:(13230016)(4636009)(376002)(136003)(396003)(39860400002)(346002)(46966006)(36840700001)(40470700004)(336012)(110136005)(54906003)(4326008)(70586007)(70206006)(8676002)(86362001)(36756003)(356005)(82740400003)(478600001)(81166007)(7416002)(41300700001)(5660300002)(8936002)(6666004)(82310400005)(2906002)(83380400001)(36860700001)(40460700003)(316002)(7696005)(186003)(1076003)(26005)(40480700001)(47076005)(2616005)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2022 17:00:40.0445 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4acafe1b-eee6-47ab-4617-08da884dabbb 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: DM6NAM11FT101.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5242 Cc: Pierre-Louis Bossart , Sunil-kumar.Dommati@amd.com, Kai Vehmanen , Ajit Kumar Pandey , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Bard Liao , Randy Dunlap , mario.limonciello@amd.com, Vijendar.Mukunda@amd.com, alexander.deucher@amd.com, Julian Braha , Lucas Tanure , Syed Saba Kareem X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Pink Sardine ACP6.2 drivers can be built by selecting necessary kernel config option. The patch enables build support of the same. Signed-off-by: Syed Saba Kareem Reviewed-by: Vijendar Mukunda --- sound/soc/amd/Kconfig | 10 ++++++++++ sound/soc/amd/Makefile | 1 + sound/soc/amd/ps/Makefile | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100644 sound/soc/amd/ps/Makefile diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index 08f5289dac54..bd785a0efb67 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -127,3 +127,13 @@ config SND_SOC_AMD_RPL_ACP6x triggered for ACP PCI driver. Say m if you have such a device. If unsure select "N". + +config SND_SOC_AMD_PS + tristate "AMD Audio Coprocessor-v6.2 Pink Sardine support" + depends on X86 && PCI && ACPI + help + This option enables Audio Coprocessor i.e ACP v6.2 support on + AMD Pink sardine platform. By enabling this flag build will be + triggered for ACP PCI driver, ACP PDM DMA driver. + Say m if you have such a device. + If unsure select "N". diff --git a/sound/soc/amd/Makefile b/sound/soc/amd/Makefile index 0592e7c5c407..82e1cf864a40 100644 --- a/sound/soc/amd/Makefile +++ b/sound/soc/amd/Makefile @@ -18,3 +18,4 @@ obj-$(CONFIG_SND_SOC_AMD_ACP6x) += yc/ obj-$(CONFIG_SND_SOC_AMD_ACP_COMMON) += acp/ obj-$(CONFIG_SND_AMD_ACP_CONFIG) += snd-acp-config.o obj-$(CONFIG_SND_SOC_AMD_RPL_ACP6x) += rpl/ +obj-$(CONFIG_SND_SOC_AMD_PS) += ps/ diff --git a/sound/soc/amd/ps/Makefile b/sound/soc/amd/ps/Makefile new file mode 100644 index 000000000000..23afa5e32ffa --- /dev/null +++ b/sound/soc/amd/ps/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Pink Sardine platform Support +snd-pci-ps-objs := pci-ps.o +snd-ps-pdm-dma-objs := ps-pdm-dma.o + +obj-$(CONFIG_SND_SOC_AMD_PS) += snd-pci-ps.o +obj-$(CONFIG_SND_SOC_AMD_PS) += snd-ps-pdm-dma.o From patchwork Sat Aug 27 16:56:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 600580 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 BF32FECAAD1 for ; Sat, 27 Aug 2022 17:03:48 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0688386E; Sat, 27 Aug 2022 19:02:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0688386E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661619827; bh=cyor6tWthoEO11hrB8lgvNfkmbe5AWrf4BcdWbI6QNY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JkSV3j0IsOQFOqsKM7iEzAB6pCtIwOxhr0vL981Pt32oTcTJ6sLnqWPwFyc6f5Vli td8RNI4qfMiYq7pIstI962mMUarvdPy5mvdzijiz+fj/emG+Ur0jOEVpdYWYqtgpEp B2LoXe/h6On74GKhPdaHMQUhwQwEPlCFEzaadgI4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 633B6F8057C; Sat, 27 Aug 2022 19:01:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3AF2FF8057B; Sat, 27 Aug 2022 19:01:10 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2069.outbound.protection.outlook.com [40.107.96.69]) (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 F32A1F80549 for ; Sat, 27 Aug 2022 19:01:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F32A1F80549 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="V856GmCk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JN/OOAUoBa5vMyT7BYQzvJ7ujV4N20P9XAviWju9eOJgz1NCaC3uw2MSJWqhKrhcYVT3a0YHRGj7+0koInpsHRlgF3veIx+zXfMD5RrGGx+Zt2fVw0ETcbTByiXn6LtZEy5DfmIytbBIzFiCcOL8RRa3XN0hqEyjM2nHiiueCFgcP+JXIpuay2KSiUzLSrzYggf4xJY5qzdb3zGMmm8m/NpS+DCYCEi5FExEgnObfz+1bQfBUVQ+sjARnYdP/oR5cx8Vn9YAFQH81Wqbu3wP1Y0cGJA7VLB3GpsW7MbE6NgsO2ZE14qTItv8L53cHN8r7JKdny3QeAvu3U1iSp4Gyw== 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=lWsqTp3JjopfvN6pja74ulXjVHjiAtsPGjew8/PpDO4=; b=TXKIB5e0Oc48OORPA8UHI9jS/XkUxWYdKF8ZQA3zFg0agUEy3mKirzFQsmOo0JHI+0sXjs9nZYaam+TVbyN3BAFV+LxJ0ONps4VC0VnYojQ/INAVqVo1zHsD7dKP9KDAplZSr/Rsl3fVAaAOmVNJBYRbKuQESOMAF1W2Ft36MY9mbkPVp/lE5IXEVH1laKI6fgF3k1ng1OgIYvpQ4F7O92UDolCd8jwTWyEyMXP+9MsgGEZs3dXfID6PkQsqIW4ly+7wVvoE/zGRmrM03fT1cIMYduEI6lhVAVkOSISiVIQlybg5tbmjAOhLjU9LUNSxXVml0wWq7eSq0GhdiHbVGQ== 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=lWsqTp3JjopfvN6pja74ulXjVHjiAtsPGjew8/PpDO4=; b=V856GmCkpHTlIhg+R18A/+oGRPfvV/arumHn6RrYT60PWXTM2GMG18nrmz/VkXxmEWVvQuPTXzqjOaJkjhWNHYddObTetPDg9eaUluP4vnCw0RBm4Kfjxa95cO8/sYSS47IwkkOmYx9RUqyTuP90MiouzoJUg7IPYHqhOzeKe8Y= Received: from BN9P221CA0024.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::23) by CY4PR1201MB0151.namprd12.prod.outlook.com (2603:10b6:910:1e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Sat, 27 Aug 2022 17:00:57 +0000 Received: from BN8NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10a:cafe::6e) by BN9P221CA0024.outlook.office365.com (2603:10b6:408:10a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 17:00:57 +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 BN8NAM11FT050.mail.protection.outlook.com (10.13.177.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Sat, 27 Aug 2022 17:00:55 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2375.28; Sat, 27 Aug 2022 12:00:55 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2375.28; Sat, 27 Aug 2022 10:00:55 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Sat, 27 Aug 2022 12:00:51 -0500 From: Syed Saba Kareem To: , Subject: [PATCH v2 12/13] ASoC: amd: add Pink Sardine machine driver using dmic Date: Sat, 27 Aug 2022 22:26:56 +0530 Message-ID: <20220827165657.2343818-13-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> References: <20220827165657.2343818-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83020c03-326f-43b7-baaf-08da884db521 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0151:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8B1hRD28cFULcBCxEBQ89SukpDwBaxDa6LV9AvjaJdyiHlUOS5+7JfFNVvzvP7V2cUCt/IPyKU1oB7Ebwoc8ax7+EqWxwBiyqzHextjoq4aEaRmaQCGQNO/04oYT/Iydm94YkjZQI9lD9g58tOicR17jvaf4U8Hy7NzWpqeycYkSSUqUWhgFdY8HTTq1nBbAwi7U24VEEd3L3nJTdOYUU4tkeEUNrXK2OAJUsYh7XQl//jPByQhXHlv8ujYcsufLEyVLblAxe5C/ReWfHG3t5Mis60T/lOMGVaui/t98RdsbWR5cNMoEjdz2ZXkFXzHKXntqiFnwPhkqCXJJNKzsWarotwio24gY4axVEFV5ySmQMIc/STSNLLYSVKh58oSl4zUXQdOdANZL9MNEg4piMPoV6Hx2adMZMOT4QTF+jnHMlzftcnZoVvtkyb1AmrRkDIu9nIFtRJUrjceKTVigSEWcGJbDdhQ+ouLS8xU13/37SGQKDFtLSnjyC3c0dNHSfrCeeWGSB241MQ1PHNlmQl+E6iXqWMh7q8Fvbi1e2yDmJ1/IeEsHmABPbDIgYuXqpWLdQSjVHKpFT+Ep6DBxaUi2Tb0Cwv3Odfzm3WhKfJNiMmP0e59ljdxs4s3gsYx5hclTtmuDMWQ2FSalYXWyNPdGqOwPlIu0FGnDBeSfduz/F4clD9OJKkCURIaICyAfMSc/rZJXs6tp68aACNvzdfeMQD90vje3G8/yCXzSHQvpHJ0/Oauj1MMksvV/qvXuPpTRQNl0FRmBbGAsE4Boo93EG4rJSIEz/popJTkVVm8= 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:(13230016)(4636009)(396003)(136003)(39860400002)(346002)(376002)(36840700001)(40470700004)(46966006)(82310400005)(36860700001)(40480700001)(86362001)(478600001)(356005)(82740400003)(70586007)(81166007)(8676002)(40460700003)(70206006)(8936002)(41300700001)(110136005)(5660300002)(54906003)(4326008)(316002)(1076003)(336012)(186003)(2616005)(47076005)(426003)(7696005)(26005)(2906002)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2022 17:00:55.8467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83020c03-326f-43b7-baaf-08da884db521 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: BN8NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0151 Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , mario.limonciello@amd.com, Vijendar.Mukunda@amd.com, alexander.deucher@amd.com, Syed Saba Kareem X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add Pink Sardine platform machine driver using dmic. Signed-off-by: Syed Saba Kareem Reviewed-by: Vijendar Mukunda --- sound/soc/amd/ps/ps-mach.c | 79 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sound/soc/amd/ps/ps-mach.c diff --git a/sound/soc/amd/ps/ps-mach.c b/sound/soc/amd/ps/ps-mach.c new file mode 100644 index 000000000000..b3e97093481d --- /dev/null +++ b/sound/soc/amd/ps/ps-mach.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Machine driver for AMD Pink Sardine platform using DMIC + * + * Copyright 2022 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "acp62.h" + +#define DRV_NAME "acp_ps_mach" + +SND_SOC_DAILINK_DEF(acp62_pdm, + DAILINK_COMP_ARRAY(COMP_CPU("acp_ps_pdm_dma.0"))); + +SND_SOC_DAILINK_DEF(dmic_codec, + DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec.0", + "dmic-hifi"))); + +SND_SOC_DAILINK_DEF(pdm_platform, + DAILINK_COMP_ARRAY(COMP_PLATFORM("acp_ps_pdm_dma.0"))); + +static struct snd_soc_dai_link acp62_dai_pdm[] = { + { + .name = "acp62-dmic-capture", + .stream_name = "DMIC capture", + .capture_only = 1, + SND_SOC_DAILINK_REG(acp62_pdm, dmic_codec, pdm_platform), + }, +}; + +static struct snd_soc_card acp62_card = { + .name = "acp62", + .owner = THIS_MODULE, + .dai_link = acp62_dai_pdm, + .num_links = 1, +}; + +static int acp62_probe(struct platform_device *pdev) +{ + struct acp62_pdm *machine = NULL; + struct snd_soc_card *card; + int ret; + + platform_set_drvdata(pdev, &acp62_card); + card = platform_get_drvdata(pdev); + acp62_card.dev = &pdev->dev; + + snd_soc_card_set_drvdata(card, machine); + ret = devm_snd_soc_register_card(&pdev->dev, card); + if (ret) { + return dev_err_probe(&pdev->dev, ret, + "snd_soc_register_card(%s) failed\n", + card->name); + } + + return 0; +} + +static struct platform_driver acp62_mach_driver = { + .driver = { + .name = "acp_ps_mach", + .pm = &snd_soc_pm_ops, + }, + .probe = acp62_probe, +}; + +module_platform_driver(acp62_mach_driver); + +MODULE_AUTHOR("Syed.SabaKareem@amd.com"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME);