From patchwork Tue Jul 20 16:37:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 481627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3DA0C07E9B for ; Tue, 20 Jul 2021 16:21:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CDBE4610FB for ; Tue, 20 Jul 2021 16:21:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDBE4610FB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 72477167B; Tue, 20 Jul 2021 18:21:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 72477167B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626798115; bh=x4S9rJTQ24ijGFp992WwT9jX/9sbUDlaCFg06d8e4Rk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iP2ZSeG6TzEolD9MBxiOsoFYjGv9VkzCkvxb6K/M36ZoPC0eEvGXvKkZ9GAeGnAOC REL9wq4D5+GASjTvORybYbOULP8VoMvFyDPEoVl33RRmg6DGysrhp1PEXhkRZtGe6F QQMmJr+MbiY97PTmZRld/DplBCMItoKB18cJ6Uf8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AD9A6F804DA; Tue, 20 Jul 2021 18:20:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 66041F804DF; Tue, 20 Jul 2021 18:20:27 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2067.outbound.protection.outlook.com [40.107.92.67]) (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 6B52DF80227 for ; Tue, 20 Jul 2021 18:20:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6B52DF80227 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="o/ePqSfZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Owg4nNienDlioKawguJJEya4ZGPYqGY7Cg0hRUs0s8+HyMlNw7KCoZNkXLCkt5pFCR9oqI3EvKgSrEteg5ONGM+VJt0ahWqEh0I9/YuYURVlMbqcgzX3QO0k2NpDaSUQum72zKBa68IyBwyb4SPFS0BUxJ2xHi2m23FD4Iy56Xx9XZX9Mj1YUXgomzaLxYoF96WfVTjPwJeLfcc/yVATxAuGNhZAfW97PBckCYEuED0Yywz9KjSOx5SbzKESXpHdk3Bz8Mu0PInY8lqRcL9w0HNSM/HngZwar9HA8JS21q3GdSJtb4LYf8E2qWj+Nc31bWrbl5IwH3G8MqWQJa2WPQ== 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-SenderADCheck; bh=ldSx7TxnTyTITdnoV5FskE6ccJLenCAQaOCy8czRk5w=; b=F291sLEtzl6QHgYM1VVqSpIz/x0Dct+wITE+/TW6/ZPRUUr+7f6Wiy6zdPHvLA+gZ4IGdhdXBWSgWtLQVZCeNBiGkCm+HJMZ67WjHWbzjudPFWM1THJkotTR3fcpaGHjvqvKfFL/O9Gqtl///GU8JSLIv08DmXGltHs+sfEdTZUnqzuChbSEPErepHPNlEkwVOaFX3eyh05VGX9czQ6K25k9rNYEkXswtCU4xsY6LG/SSh8U6kdmitbZOH2IWepKuDe3YsksjQiTMgC/YRcgp8mf+xQ0TManOPEPPwt4uNYC/5iFUE4doPnIBuhyfWTCXkqmiihTDaSB/SFDfNab4g== 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=ldSx7TxnTyTITdnoV5FskE6ccJLenCAQaOCy8czRk5w=; b=o/ePqSfZwBmmRuRT7zxRP7IPTPC5yEa3MTYCMpg3LchB8xtKI2abrimVE8ZVrpZszjOIRAgpGzjBOj/Zir4GFHZD6ruBlxpE2LocTEltjv90R0rZjj75ZlUWljlhfT6j0LiJe98FUqpnArn5LrU14igm1XRLOvMIuB4whSkZ4Ic= Received: from MWHPR10CA0021.namprd10.prod.outlook.com (2603:10b6:301::31) by CH0PR12MB5060.namprd12.prod.outlook.com (2603:10b6:610:e3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Tue, 20 Jul 2021 16:20:16 +0000 Received: from CO1NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:301:0:cafe::ea) by MWHPR10CA0021.outlook.office365.com (2603:10b6:301::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:20:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT004.mail.protection.outlook.com (10.13.175.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:20:16 +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.2242.4; Tue, 20 Jul 2021 11:20:15 -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.2242.4; Tue, 20 Jul 2021 09:20:14 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:20:11 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v4 02/12] ASoC: amd: add Vangogh ACP PCI driver Date: Tue, 20 Jul 2021 22:07:22 +0530 Message-ID: <20210720163732.23003-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> References: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 747d5240-7d29-4545-089d-08d94b9a4288 X-MS-TrafficTypeDiagnostic: CH0PR12MB5060: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OuN+snAXQ2yHH+Fj34hnIJWw94OQgDZpV7x9wjCOV9PsOhMJX0GFMzCClH2UvOWJ17UsQBzFChBbQ1pYg0RNgLm+IDpyVXrU9MBoTWKZHrIn8qEgv1XHu1/5NGVzQy1j5FILk9DA4iQVpuGgL8JdwUaYFWVbnSwW8tBhtLL1Vn85j9pCBbgM3FGttUtdPKWeYrWQSPn4D2JyoU7Xl222O/ZPtbUJS+l1GMqpgoCPZOE8ywn+r7y4QprALNdmof5xAxQnW0vdWPGoyxj/O7Jf9BoUIkLHdtgg/eSTKSsLGNFR/egvIo5GdpDmBZFLfF/I4AjWmAE7uxQ4I19nfqQyCtOf9LHuydJtLRqigjPB68VA5ayR672Hh9v+VmSluhwZVEJm3hVrceJFmCH3BYW8LN3wNnPsXtl/jlVXwvNB7GjFUiQxBnoXfPJpkqQ9tGtx0AcLt6Cg/w2tEe/zwxBc9JxJs30ReDb5BR81NK5x1zyUmUdaJDa3Bac5qtZmIcK3G3nNVK8BOxqc8UdZPidnrywm4eWk6Vh9ZS4+YdOV5ZnSjWrPdHT1QSKUnXjxjNox0L7+sZIQPYVJC8qvbEIs5XFnmipRZHzeYp6B2EHgXDyY972lgobKfpTX9WeMfhYgVV37rfNJWN829Gbh9XoUc/076MeDh5qHNYPMS+BOR7apUzv8/NeoKhpFLrWnCH8hFWzBOPY9sFLSII8ZlhneCqmY/YdDTk7rzdOZ0NuZBUY= 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:(4636009)(46966006)(36840700001)(36860700001)(336012)(4326008)(7696005)(82310400003)(70586007)(2616005)(83380400001)(6666004)(54906003)(316002)(47076005)(508600001)(426003)(70206006)(110136005)(186003)(5660300002)(36756003)(26005)(356005)(86362001)(2906002)(1076003)(8676002)(81166007)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:20:16.1164 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 747d5240-7d29-4545-089d-08d94b9a4288 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: CO1NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5060 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com 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. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x.h | 25 +++++++++ sound/soc/amd/vangogh/pci-acp5x.c | 87 +++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 sound/soc/amd/vangogh/acp5x.h create mode 100644 sound/soc/amd/vangogh/pci-acp5x.c diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h new file mode 100644 index 000000000000..251a7e0347a7 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * AMD ALSA SoC PCM Driver + * + * Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + */ + +#include "vg_chip_offset_byte.h" + +#define ACP5x_PHY_BASE_ADDRESS 0x1240000 +#define ACP_DEVICE_ID 0x15E2 + +/* common header file uses exact offset rather than relative + * offset which requires subtraction logic from base_addr + * for accessing ACP5x MMIO space registers + */ +static inline u32 acp_readl(void __iomem *base_addr) +{ + return readl(base_addr - ACP5x_PHY_BASE_ADDRESS); +} + +static inline void acp_writel(u32 val, void __iomem *base_addr) +{ + writel(val, base_addr - ACP5x_PHY_BASE_ADDRESS); +} diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c new file mode 100644 index 000000000000..e56d060a5cb9 --- /dev/null +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// AMD Vangogh ACP PCI Driver +// +// Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#include +#include +#include + +#include "acp5x.h" + +struct acp5x_dev_data { + void __iomem *acp5x_base; +}; + +static int snd_acp5x_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + struct acp5x_dev_data *adata; + int ret; + u32 addr; + + if (pci->revision != 0x50) + return -ENODEV; + + if (pci_enable_device(pci)) { + dev_err(&pci->dev, "pci_enable_device failed\n"); + return -ENODEV; + } + + ret = pci_request_regions(pci, "AMD ACP5x audio"); + if (ret < 0) { + dev_err(&pci->dev, "pci_request_regions failed\n"); + goto disable_pci; + } + + adata = devm_kzalloc(&pci->dev, sizeof(struct acp5x_dev_data), + GFP_KERNEL); + if (!adata) { + ret = -ENOMEM; + goto release_regions; + } + addr = pci_resource_start(pci, 0); + adata->acp5x_base = devm_ioremap(&pci->dev, addr, + pci_resource_len(pci, 0)); + if (!adata->acp5x_base) { + ret = -ENOMEM; + goto release_regions; + } + pci_set_master(pci); + pci_set_drvdata(pci, adata); + +release_regions: + pci_release_regions(pci); +disable_pci: + pci_disable_device(pci); + + return ret; +} + +static void snd_acp5x_remove(struct pci_dev *pci) +{ + pci_release_regions(pci); + pci_disable_device(pci); +} + +static const struct pci_device_id snd_acp5x_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_acp5x_ids); + +static struct pci_driver acp5x_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_acp5x_ids, + .probe = snd_acp5x_probe, + .remove = snd_acp5x_remove, +}; + +module_pci_driver(acp5x_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD Vangogh ACP PCI driver"); +MODULE_LICENSE("GPL v2"); From patchwork Tue Jul 20 16:37:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 481626 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B35AC07E95 for ; Tue, 20 Jul 2021 16:22:38 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CA09A61106 for ; Tue, 20 Jul 2021 16:22:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA09A61106 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 68C39168B; Tue, 20 Jul 2021 18:21:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 68C39168B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626798156; bh=Mop0V8cwcfYssHW/YPXWBJyENmpLR13TI1w8wB/PzEE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZzBJhgWxfohPlYlQ7at2/lWNx0Dn52V96z+K6VUsTxY5FeO/3rLvBikuLXE9ktpXZ pwA9CVMcTo4TFkeH1pCyyZr1BZvHAXLaki3Q6InCuhRx8BGqzebnpaeh34ntQffzxE bILFscImLKgwKQd667pniRY/JNuujjgE1b1e3lA8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0AF26F804E3; Tue, 20 Jul 2021 18:20:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2CF4BF804E7; Tue, 20 Jul 2021 18:20:49 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2089.outbound.protection.outlook.com [40.107.95.89]) (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 36C34F804E5 for ; Tue, 20 Jul 2021 18:20:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 36C34F804E5 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="prk/acLb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ad5e0bPoG3eQG8M9qCowzAEv/SoqDTYFknQNCVD0W9W7+5TaYBq9tIN/qLtn3eHqOaYjcNu/RuJloqr2YsE1Ja0SDF3J7AtX/iloqvqEn2dY4Uie6Yxp2zuA4bRiLR/Xh5BwjvBUcsCrcs/c0WDfPLF1hxAShDvv3nzz0e96pXp2qKBfX0YtKBU7ZwPpZ0+U3tGgBD3qP7DAwj12sWPUZ8qZh6DJeSlRl/9ByirVKqiXu77rBHjtWgr+Qf2d0KN2D9jGpuv0OnoUNuxnmYw7fZX45EX1d1kuHFV1/cuh+qPczjoL6lU5NbjIYqQQlsLGEjJA5LoUJUclGFmW1C9qng== 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-SenderADCheck; bh=1KRmzAei832uTQMC9R5tSHHDMf+pFeJ/+KMFs0ahr8s=; b=HDg5r98FUlFWPqwxJCQqn5iOvRdP4BU9k4uHxH4pYpzothoP0Cw+7n0IrUEZTCevs0Rr8BtWphS+pPZbrhzSIXUFcL9hwZI2s5iADIDXymNfZaULaKrbemdzMxdrjMTJSh26isQBD4K9y1cxcKxhB50r2AJbbER3guL/6/HqT4tB+iK4OMqNH17gSNaBpoLb96MeR2huGvDBb9b8tB87P4e+G1oE/DEdf5Ei+jScY1jotx2ZiiTgeeuRoDVCGdnYFIU1E89Q5bPxMesUjd1NbRe+NYLLeleRCvLl8er7xBpYle4JOwsoyXloexewkU8wa1WSOv+kxLJfDfn927iSQQ== 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=1KRmzAei832uTQMC9R5tSHHDMf+pFeJ/+KMFs0ahr8s=; b=prk/acLb5wAj6DkivD6FUXssBcsLr8LLPFGc4t1gAnVDeYgq3hLZqQXS7KCvBoayHBaTOuF+oI5r2aUZU+9yJ0gmO8/5NsTsEXZxbtk/1UTLVeO9B8+L9+bZsVOabWt+ojTD1vzuHzlWJhDtAEJfash/6RZBuvI29/oUAqm8QuE= Received: from MW4PR04CA0190.namprd04.prod.outlook.com (2603:10b6:303:86::15) by MN2PR12MB4125.namprd12.prod.outlook.com (2603:10b6:208:1d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.26; Tue, 20 Jul 2021 16:20:38 +0000 Received: from CO1NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::33) by MW4PR04CA0190.outlook.office365.com (2603:10b6:303:86::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23 via Frontend Transport; Tue, 20 Jul 2021 16:20:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT029.mail.protection.outlook.com (10.13.174.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:20:37 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2242.4; Tue, 20 Jul 2021 11:20:37 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:20:33 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v4 04/12] ASoC: amd: create acp5x platform devices Date: Tue, 20 Jul 2021 22:07:24 +0530 Message-ID: <20210720163732.23003-5-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> References: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0f5a375-bdb3-461f-dea8-08d94b9a4f89 X-MS-TrafficTypeDiagnostic: MN2PR12MB4125: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lMJUj2BPi27vNWfv9sIV+G9lGomT3hOHyB2kH5gLyk9Z4NIzlfrckiBcalMFf/uij4rn66/niEQNlAFy2N5BZl1n6ju2MUXLdnh1hCOpul9XJQm6ciLcFFDq2MBgpDhUnsjPUnJ+cWYiZJxUyEXLqJoOD3Nj0QxI/TRPrk25xQpoCiIQa7yukB0aOXSqcSIlvEjG9DVnmApK6z1v0F8h0nHd7tXd/hcmN/sH2PGHi7DrKNU+238rBWa8PW1abw/O4Ft97Xr6rry+1jf5Y0QePeieyNo9VqcYbEd7JFQU/O58JLU1c7FNOk+jsLtiaWqLOsIuaqAu23J1smhirGx3SMIvNZoI+7R4jFLeiG5FUmwvJ6x+Edfn9+Z7dgnkQRpgfoxZeRqIxGmAPOyeqTK0/9Who9h8PGjkmxAkDcsUkAw3oXgpcWss0VTs7u9YsjJ6ZhBX3D2g0kbMla/i8Iom6UO4+Tp6ezhy3lGv2Ha2g3nifOwcPZoazhd9XZJnR19xYTF6waeSkTlPVvM68bG5In9K/xmP4TPidajU++Vy6C/xumOG58TjHxGfwfBh/IaNmUiC1iikYfJtR2FHJTAElGBJnTNKW9aFWI7k941KiYmyHY06eTGrIjN3f2yfwdmn6kGkjV7vbCuCNL0oI4pOcc8zOldy2Wp96rvaiDkVVLu2NOaUReGYd2T6+jxsTen1pjJ2iMo5ccMnR7bjl89bhVJgNQUuRc9+yTwvHDEZf9KydFPM1GPRWoGEv1eoIrOG2tc37MRjJXlTFSvRIiOat3exFn01oGlsZNHrwsH7Vf8= 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:(4636009)(136003)(376002)(396003)(39860400002)(346002)(46966006)(36840700001)(81166007)(82740400003)(478600001)(26005)(83380400001)(426003)(7696005)(82310400003)(2616005)(110136005)(70206006)(4326008)(54906003)(316002)(36860700001)(356005)(70586007)(1076003)(2906002)(5660300002)(336012)(36756003)(47076005)(8936002)(86362001)(8676002)(6666004)(186003)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:20:37.9389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0f5a375-bdb3-461f-dea8-08d94b9a4f89 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: CO1NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4125 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com 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" ACP5.x IP has multiple I2S controllers and DMA controller. Create platform devices for I2S HS controller instance, I2S SP controller instance and DMA controller. Pass PCI resources like MMIO, irq to these platform devices. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x.h | 11 ++++ sound/soc/amd/vangogh/pci-acp5x.c | 94 ++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index db23fffce9a0..32e5db10c1c8 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -22,6 +22,17 @@ #define ACP_ERR_INTR_MASK 0x20000000 #define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF +#define ACP5x_DEVS 3 +#define ACP5x_REG_START 0x1240000 +#define ACP5x_REG_END 0x1250200 +#define ACP5x_I2STDM_REG_START 0x1242400 +#define ACP5x_I2STDM_REG_END 0x1242410 +#define ACP5x_HS_TDM_REG_START 0x1242814 +#define ACP5x_HS_TDM_REG_END 0x1242824 +#define I2S_MODE 0 +#define ACP5x_I2S_MODE 1 +#define ACP5x_RES 4 + /* common header file uses exact offset rather than relative * offset which requires subtraction logic from base_addr * for accessing ACP5x MMIO space registers diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c index 523b962fe35e..25b42a37ad3a 100644 --- a/sound/soc/amd/vangogh/pci-acp5x.c +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -8,11 +8,16 @@ #include #include #include +#include +#include #include "acp5x.h" struct acp5x_dev_data { void __iomem *acp5x_base; + bool acp5x_audio_mode; + struct resource *res; + struct platform_device *pdev[ACP5x_DEVS]; }; static int acp5x_power_on(void __iomem *acp5x_base) @@ -114,9 +119,12 @@ static int snd_acp5x_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { struct acp5x_dev_data *adata; - int ret; - u32 addr; + struct platform_device_info pdevinfo[ACP5x_DEVS]; + unsigned int irqflags; + int ret, i; + u32 addr, val; + irqflags = IRQF_SHARED; if (pci->revision != 0x50) return -ENODEV; @@ -150,6 +158,82 @@ static int snd_acp5x_probe(struct pci_dev *pci, if (ret) goto release_regions; + val = acp_readl(adata->acp5x_base + ACP_PIN_CONFIG); + switch (val) { + case I2S_MODE: + adata->res = devm_kzalloc(&pci->dev, + sizeof(struct resource) * ACP5x_RES, + GFP_KERNEL); + if (!adata->res) { + ret = -ENOMEM; + goto de_init; + } + + adata->res[0].name = "acp5x_i2s_iomem"; + adata->res[0].flags = IORESOURCE_MEM; + adata->res[0].start = addr; + adata->res[0].end = addr + (ACP5x_REG_END - ACP5x_REG_START); + + adata->res[1].name = "acp5x_i2s_sp"; + adata->res[1].flags = IORESOURCE_MEM; + adata->res[1].start = addr + ACP5x_I2STDM_REG_START; + adata->res[1].end = addr + ACP5x_I2STDM_REG_END; + + adata->res[2].name = "acp5x_i2s_hs"; + adata->res[2].flags = IORESOURCE_MEM; + adata->res[2].start = addr + ACP5x_HS_TDM_REG_START; + adata->res[2].end = addr + ACP5x_HS_TDM_REG_END; + + adata->res[3].name = "acp5x_i2s_irq"; + adata->res[3].flags = IORESOURCE_IRQ; + adata->res[3].start = pci->irq; + adata->res[3].end = adata->res[3].start; + + adata->acp5x_audio_mode = ACP5x_I2S_MODE; + + memset(&pdevinfo, 0, sizeof(pdevinfo)); + pdevinfo[0].name = "acp5x_i2s_dma"; + pdevinfo[0].id = 0; + pdevinfo[0].parent = &pci->dev; + pdevinfo[0].num_res = 4; + pdevinfo[0].res = &adata->res[0]; + pdevinfo[0].data = &irqflags; + pdevinfo[0].size_data = sizeof(irqflags); + + pdevinfo[1].name = "acp5x_i2s_playcap"; + pdevinfo[1].id = 0; + pdevinfo[1].parent = &pci->dev; + pdevinfo[1].num_res = 1; + pdevinfo[1].res = &adata->res[1]; + + pdevinfo[2].name = "acp5x_i2s_playcap"; + pdevinfo[2].id = 1; + pdevinfo[2].parent = &pci->dev; + pdevinfo[2].num_res = 1; + pdevinfo[2].res = &adata->res[2]; + + for (i = 0; i < ACP5x_DEVS; i++) { + adata->pdev[i] = + platform_device_register_full(&pdevinfo[i]); + if (IS_ERR(adata->pdev[i])) { + dev_err(&pci->dev, "cannot register %s device\n", + pdevinfo[i].name); + ret = PTR_ERR(adata->pdev[i]); + goto unregister_devs; + } + } + break; + default: + dev_info(&pci->dev, "ACP audio mode : %d\n", val); + } + return 0; + +unregister_devs: + for (--i; i >= 0; i--) + platform_device_unregister(adata->pdev[i]); +de_init: + if (acp5x_deinit(adata->acp5x_base)) + dev_err(&pci->dev, "ACP de-init failed\n"); release_regions: pci_release_regions(pci); disable_pci: @@ -161,9 +245,13 @@ static int snd_acp5x_probe(struct pci_dev *pci, static void snd_acp5x_remove(struct pci_dev *pci) { struct acp5x_dev_data *adata; - int ret; + int i, ret; adata = pci_get_drvdata(pci); + if (adata->acp5x_audio_mode == ACP5x_I2S_MODE) { + for (i = 0; i < ACP5x_DEVS; i++) + platform_device_unregister(adata->pdev[i]); + } ret = acp5x_deinit(adata->acp5x_base); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); From patchwork Tue Jul 20 16:37:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 481625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE967C07E9B for ; Tue, 20 Jul 2021 16:23:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3B58D610FB for ; Tue, 20 Jul 2021 16:23:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B58D610FB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 C5A761669; Tue, 20 Jul 2021 18:22:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C5A761669 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626798210; bh=zmE4u4tWtj0PNnXfiSWijOT3ujyh/UsLT6ppD3J9CEA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HPJvQAeTqffVVCG8ci81bMJQXs2MMwup2HmZS1wih1DTK+PA3WiKcBpsVJNFUYoWd ANEM0gmFXXMHKv+dSFHN9d18R9y8p62x1Lb2YtwXq66Lc4zu/jjIXr6ewjeILyYCKm WKsWpryqiaw0jbbdNkfsXCAL/5Ld19qMjj9U0HTo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3CBDBF8020D; Tue, 20 Jul 2021 18:21:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6A663F80506; Tue, 20 Jul 2021 18:21:12 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) (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 6AE4EF80218 for ; Tue, 20 Jul 2021 18:21:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6AE4EF80218 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="4NDsuvNK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eNQqPnSd8KLSZu/libCI1yXairH5p5tOjn1QRk1Bnm27wFulnAi0H5Ih5ira+zK94TPnNulGSAo8tf2XSUfmflBW6zbyv1iYSVb2+BUJPU9xz6zuraPjWytP0aW/L2gZ4OWp3H61w4+UXcheBXQgUASnNyUdBqagJFk6LBRrUtd9PDf2pnOmOOndC9AKOpKbNbo1WuDfza9OSbfgwwHaM6uzUOh6MetEKWRFqWW82ztkthPNj8iMJgrTS8pjmhhla1u6D4MFYp3PG7heuEa7u3Py9vN/F0PFOHmuidtusCx1HP0sSti5Dbp+GrERXPHEzwZKAwD+m8iB2rE/ulHRTQ== 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-SenderADCheck; bh=u503hGVKxSWEtPSf5nUdRdzX/q1scFh97TSSssSXsqo=; b=A4kTbA4yOjZblB/jz5abtM46YOMyCwIcZHe8haC19yEt8qdTHJQYWCmrlrxk6rUHcX7GiVNq0NYfh+k07dkx/jN1QqEBkvytBS2Fp+lYnU4LELFBwOXXkvACqiqJVdvl0WROevduJBK0zdaGUChSiwdo75eqJhDn3OjJ0+n+YCz4YXcWywYa7b6oolSFxxuvLcYGAX2ZjPBB0LTYcqlCI45ZvaYxpHYYt8fkepJbmjujreUddg+hkWeZyM7c6L6SvtMfr4mL1TfFqlwajoJcpBET32vuUS/CWCow18dIUAxP12g1lKwdd2IgpjKpzA9ndeL0ZluE5rdFoP+eN/NCMA== 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=u503hGVKxSWEtPSf5nUdRdzX/q1scFh97TSSssSXsqo=; b=4NDsuvNKr96zy1aCzt1AKgzWhrYQaP4lTsQY2jKayePmMTpO91qGgQnKME33ho5YIpMGu7XD7Zq+pN0hUzvwFS5MO7/LHF04nMuudV8iepkfVGkT0oUVeRz7953IjkHrYlSvXLrI8uFR0BOYBsqUb9dt+4e9XffWAPy1dAEm1YQ= Received: from MW4PR04CA0384.namprd04.prod.outlook.com (2603:10b6:303:81::29) by CH2PR12MB3718.namprd12.prod.outlook.com (2603:10b6:610:2e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Tue, 20 Jul 2021 16:21:02 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::96) by MW4PR04CA0384.outlook.office365.com (2603:10b6:303:81::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Tue, 20 Jul 2021 16:21:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:21:02 +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.2242.4; Tue, 20 Jul 2021 11:21:01 -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.2242.4; Tue, 20 Jul 2021 09:21:00 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:20:57 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v4 06/12] ASoC: amd: irq handler changes for ACP5x PCM dma driver Date: Tue, 20 Jul 2021 22:07:26 +0530 Message-ID: <20210720163732.23003-7-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> References: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b3ac1da-d098-4cca-9149-08d94b9a5de7 X-MS-TrafficTypeDiagnostic: CH2PR12MB3718: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:45; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p44Mj2iXyN0MRjuHqsuZgoBkfQy9PEW9wv0xuOQ/aSZx+56DhOCfb42grt9NxrYzaQ6dlebLpb4/1pO13E7NrNbZMlTEnC+6pIivwYdiAttSqJ7UA2jH4qAcopbT8+ntCRQ0ySkC3WyMmmmywKhkbWl76nYoodp4rJNwx/z8lcQaJo81BeAAZQ6JPmmKt1bRQF5o2c0QwfK8jNXS/GA8hhNGusFT+Ie60NWy+/RTR/VbTa1tUQCz5F1CFWlfSuuuBsxjggB7X8Vasrd2t5LUl3iC5may82L15WCyw/gUOQXVrqKHzQp27yLKSyjnMO+1tUhtblc9WgmZAgQLQfULLsVoNIqDZTzdN2CBClnjOhWNNPqHHhTKqK4da8O3MIjFbOxKkS8NtYsnIn4qrp+aoVeq9EQ0PZbqx44VP95MhwvzT1Az1aHtefHv6JGTDiKXT+DGju85+9U7/yMZyfHsftsM/1tgZASMhLXiT7mdApCtuNV67gcB/OQMq1bFSAvm/MUrGVu9k++z073VLlH1M1/Y6dWACkSs6WD3lipeA6w+tukBpVb04MwWovkXCNb0Q0GIidiYoeKdROasdDtnH5vBj0iu3Bu88SluPk2So9UdbWHawsp7aBC6n5QPMj3tg/PHv2aXFxAJJdH1xkW+DUvPT8s+YDhCCsHZh1cTbGe9b3QbfQrIQD9NyHsOBSKBbnkkaLoDgoa1XqdntcjE0XUwN9EDmosZuAAGzWOUliI/S6/6NcXBy/cbFtCoA1gZ 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:(4636009)(46966006)(36840700001)(81166007)(5660300002)(316002)(2906002)(82310400003)(356005)(186003)(54906003)(36860700001)(8936002)(7696005)(26005)(86362001)(83380400001)(4326008)(110136005)(508600001)(426003)(1076003)(8676002)(47076005)(6666004)(70206006)(36756003)(336012)(2616005)(70586007)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:21:02.0300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b3ac1da-d098-4cca-9149-08d94b9a5de7 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: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3718 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com 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" Whenever audio data equal to the I2S FIFO watermark level are produced/consumed, interrupt is generated. Acknowledge the interrupt. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 61 ++++++++++++++++++++++++++- sound/soc/amd/vangogh/acp5x.h | 9 ++++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 7d397acb3632..4bc32183297b 100644 --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -21,10 +21,55 @@ static const struct snd_soc_component_driver acp5x_i2s_component = { .name = DRV_NAME, }; +static irqreturn_t i2s_irq_handler(int irq, void *dev_id) +{ + struct i2s_dev_data *vg_i2s_data; + u16 irq_flag; + u32 val; + + vg_i2s_data = dev_id; + if (!vg_i2s_data) + return IRQ_NONE; + + irq_flag = 0; + val = acp_readl(vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); + if ((val & BIT(HS_TX_THRESHOLD)) && vg_i2s_data->play_stream) { + acp_writel(BIT(HS_TX_THRESHOLD), vg_i2s_data->acp5x_base + + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->play_stream); + irq_flag = 1; + } + if ((val & BIT(I2S_TX_THRESHOLD)) && vg_i2s_data->i2ssp_play_stream) { + acp_writel(BIT(I2S_TX_THRESHOLD), + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_play_stream); + irq_flag = 1; + } + + if ((val & BIT(HS_RX_THRESHOLD)) && vg_i2s_data->capture_stream) { + acp_writel(BIT(HS_RX_THRESHOLD), vg_i2s_data->acp5x_base + + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->capture_stream); + irq_flag = 1; + } + if ((val & BIT(I2S_RX_THRESHOLD)) && vg_i2s_data->i2ssp_capture_stream) { + acp_writel(BIT(I2S_RX_THRESHOLD), + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_capture_stream); + irq_flag = 1; + } + + if (irq_flag) + return IRQ_HANDLED; + else + return IRQ_NONE; +} + static int acp5x_audio_probe(struct platform_device *pdev) { struct resource *res; struct i2s_dev_data *adata; + unsigned int irqflags; int status; if (!pdev->dev.platform_data) { @@ -47,12 +92,26 @@ static int acp5x_audio_probe(struct platform_device *pdev) resource_size(res)); if (!adata->acp5x_base) return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n"); + return -ENODEV; + } + + adata->i2s_irq = res->start; dev_set_drvdata(&pdev->dev, adata); status = devm_snd_soc_register_component(&pdev->dev, &acp5x_i2s_component, NULL, 0); - if (status) + if (status) { dev_err(&pdev->dev, "Fail to register acp i2s component\n"); + return status; + } + status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler, + irqflags, "ACP5x_I2S_IRQ", adata); + if (status) + dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n"); return status; } diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index e450fb32d680..a0d898e47bb8 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -32,9 +32,18 @@ #define I2S_MODE 0 #define ACP5x_I2S_MODE 1 #define ACP5x_RES 4 +#define I2S_RX_THRESHOLD 27 +#define I2S_TX_THRESHOLD 28 +#define HS_TX_THRESHOLD 24 +#define HS_RX_THRESHOLD 23 struct i2s_dev_data { + unsigned int i2s_irq; void __iomem *acp5x_base; + struct snd_pcm_substream *play_stream; + struct snd_pcm_substream *capture_stream; + struct snd_pcm_substream *i2ssp_play_stream; + struct snd_pcm_substream *i2ssp_capture_stream; }; /* common header file uses exact offset rather than relative From patchwork Tue Jul 20 16:37:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 481624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 273E2C07E95 for ; Tue, 20 Jul 2021 16:24:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A2149610FB for ; Tue, 20 Jul 2021 16:24:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2149610FB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 4234C16A6; Tue, 20 Jul 2021 18:23:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4234C16A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626798262; bh=itV8gZ/xYtt7vup0VHSoqsMoJVIRJ9CXzkNER+S7yIo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DaKbHgyLjG2Bww7dSDRSoS1mcLUng7Y6+0b9A/oxQUt0+r2Ux3yrv/g9FUI4jC9Ow 5i6VJ66gm8UZvtLAebn7oS3/+/lJCXoMGFaC5INRUBvgMJEzlmryP464/YosYKxJxl Iwhkbih589VDP8b3iYKokHgh32xRr2lxrAxt+9h8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9A8A7F804E1; Tue, 20 Jul 2021 18:21:39 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 60F4CF804FF; Tue, 20 Jul 2021 18:21:38 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2051.outbound.protection.outlook.com [40.107.243.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 3A6B0F80518 for ; Tue, 20 Jul 2021 18:21:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3A6B0F80518 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="daVYTwiR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P940TQDOjBIxtQ9r0JHW6bRpobN8I1abGo7+K3Rk4odqBNfE5r+FGNlzHU69SZGnXbqggakt6G8wh5AqN5OETYjVAbXLs8OzgxJYGVPmPILvkiqHDaJ0aOeW0A05OUNRqeYOEIOWffVP1T092t5jCSEcUWnc9ojE0B5mnjNDSdJRCIbT1s3jxEjJKISlQdJ9TZsuO+zRkZa1fnO8Aj6OP6xupoIoMsJCiE8H87cx5Fy1Wr5Wcqitrp51zPqL0/4lGJmMDsZ15iJanOsQC+ftqMI5MmxKtkjYQ1R5WK/+dvEbzJDKGuBjaUY79mLrxujL4iGraS3SJ12VoaGCwfL5qQ== 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-SenderADCheck; bh=tG6KcD+mdjzGtNUGOAjy00ESLHlnDLyIRS8d/XmXQH4=; b=iyVzo6P4L7tR3vyavuNmiMk2KTY7QShShjJ5UHDgnToqDNMNWln/o3JICMDHfWELiJUJ6rrLSrFHIcXdR7DD4sI8AtZ/lbKfY18a01OIthJ87BA6kiZ+IecqBiI1IIUD2eqyIHdejy457y5qxXZswsKWgolbN2cym8ghYFr0kobfmLrwtL2iKeEhs3C4c3NtKVJ9+ZhQ1nhcGgJTcaLDLG5Dz2i9bTM+/sqHFkR8vnNIgKbf90Bzm4nM/Qg/LmXuvKfoIVs1KYnrtjcGr2YX+Slij142rleqIz3AdU47JzfM7KI29Yoc8rTH0gVMyDD6iHexQ7hiVS65KGAWK8XZig== 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=tG6KcD+mdjzGtNUGOAjy00ESLHlnDLyIRS8d/XmXQH4=; b=daVYTwiRlrerJwA2DYVG0m7m0YYS2Oa2miqTZiUrrCIntplWLnpe2B0COWNZh2gQEThU8PugZlb1CXn+bHubqQUeBulWipPWw0tMjVO6hjRzrMCzV4ZMWf/WSUqx0hdqHzcam/yA5xwYmDejRPuxqFHm/oPXOeWguzzbV46y4RE= Received: from MWHPR15CA0027.namprd15.prod.outlook.com (2603:10b6:300:ad::13) by MWHPR1201MB0015.namprd12.prod.outlook.com (2603:10b6:300:df::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22; Tue, 20 Jul 2021 16:21:26 +0000 Received: from CO1NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ad:cafe::bc) by MWHPR15CA0027.outlook.office365.com (2603:10b6:300:ad::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:21:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT061.mail.protection.outlook.com (10.13.175.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:21:26 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2242.4; Tue, 20 Jul 2021 11:21:25 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:21:25 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:21:22 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v4 08/12] ASoC: amd: add vangogh i2s controller driver Date: Tue, 20 Jul 2021 22:07:28 +0530 Message-ID: <20210720163732.23003-9-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> References: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d99c11fc-03fc-441c-5311-08d94b9a6c93 X-MS-TrafficTypeDiagnostic: MWHPR1201MB0015: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RmRTSByPzHFYDDHWlyIl96lkGdjyE/AdCf10VcmWsMrMeVyg6Gwb+f71+ZOagjt1l0qoD3nyY2n7wsDn+xd+kBvZ9o60nw1M2RhRclqIIjGHFGtIdHFosJT/4q82dgLfUmvbBT8/6JPyM1L22GfhJ2Jjeh+T6Wu/LlHjIQ5MJqBldyDs57R9tpJSkAzmENDrR/RZoZkCmZo2xykJtYWR9G+TSZHcMUqsuVY9uYUk6wK5/9z/U9oFxED8zNgZTF1mSS+VX/zP1mghUKQHrO8014RrRh4N8mxKYDiYn7Uak8sDr0Zn7lTJ4bIaNwZI6Rpe8aGU+7qsUQmo1E8t3X87hox6fGRfuAC/AtWHV9jyV3XFL1DBQhpSOeziDOLyhI6Hp+Lu9FT/QLKkk3SdoOEQah4B0gh6Lim7mFIbkEMIC0+BZlhDuqkz1rWysnbUtiUqVMD/rlT8259ii19s01DiFMvaKWHMjc6AsRzhNzPUc8bBbmvPsMll2qNw9fiHJZLkSXC+R9GLpqPcjz652eutMZuQNxpEe9Yu/F9gOlVcfNca5X7Lw0WDafLcrL085HfglNhj+5UL5yc/u93lH+IXqhKmHPwFUQUECAm6MJKUZqJ0pYLxEWhbyuVZuOl3ES/vAypuECJ9NGD0dqbFdhyEzgkwh29vGgKZBK9DaUxR+jtd4JzYnjOGoMD+S/hDinBZ1zTLim+Zr/kS6xrrGGC0RLCqFKsFHK3M9kpRdOyytK4= 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:(4636009)(39860400002)(376002)(136003)(346002)(396003)(46966006)(36840700001)(8676002)(8936002)(7696005)(186003)(54906003)(36756003)(26005)(5660300002)(70586007)(81166007)(110136005)(2906002)(316002)(356005)(1076003)(86362001)(82740400003)(4326008)(70206006)(47076005)(82310400003)(336012)(2616005)(426003)(478600001)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:21:26.6548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d99c11fc-03fc-441c-5311-08d94b9a6c93 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: CO1NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0015 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com 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 Vangogh I2S controller driver to support two I2S controller instances. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-i2s.c | 88 +++++++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 92 insertions(+) create mode 100644 sound/soc/amd/vangogh/acp5x-i2s.c diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c new file mode 100644 index 000000000000..30b651035042 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-i2s.c @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// AMD ALSA SoC PCM Driver +// +// Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acp5x.h" + +#define DRV_NAME "acp5x_i2s_playcap" + +static const struct snd_soc_component_driver acp5x_dai_component = { + .name = "acp5x-i2s", +}; + +static struct snd_soc_dai_driver acp5x_i2s_dai = { + .playback = { + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 96000, + }, + .capture = { + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 96000, + }, +}; + +static int acp5x_dai_probe(struct platform_device *pdev) +{ + struct resource *res; + struct i2s_dev_data *adata; + int ret; + + adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data), + GFP_KERNEL); + if (!adata) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENOMEM; + } + adata->acp5x_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (IS_ERR(adata->acp5x_base)) + return PTR_ERR(adata->acp5x_base); + + adata->master_mode = I2S_MASTER_MODE_ENABLE; + dev_set_drvdata(&pdev->dev, adata); + ret = devm_snd_soc_register_component(&pdev->dev, + &acp5x_dai_component, + &acp5x_i2s_dai, 1); + if (ret) + dev_err(&pdev->dev, "Fail to register acp i2s dai\n"); + return ret; +} + +static struct platform_driver acp5x_dai_driver = { + .probe = acp5x_dai_probe, + .driver = { + .name = "acp5x_i2s_playcap", + }, +}; + +module_platform_driver(acp5x_dai_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP5.x CPU DAI Driver"); +MODULE_ALIAS("platform:" DRV_NAME); +MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index 929be9905e8e..2300e63534e7 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -71,7 +71,11 @@ #define DMA_SIZE 0x40 #define FRM_LEN 0x100 +#define I2S_MASTER_MODE_ENABLE 0x01 +#define I2S_MASTER_MODE_DISABLE 0x00 + struct i2s_dev_data { + bool master_mode; unsigned int i2s_irq; void __iomem *acp5x_base; struct snd_pcm_substream *play_stream; From patchwork Tue Jul 20 16:37:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 481623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D290BC07E95 for ; Tue, 20 Jul 2021 16:25:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5770C61029 for ; Tue, 20 Jul 2021 16:25:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5770C61029 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 CB24B16A5; Tue, 20 Jul 2021 18:24:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CB24B16A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626798312; bh=NYHsl2yZUlLb+yCmMR6jh5BtwZWnBm4xIowzScvtVbg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=av5Y4SZWilmUh0OfIjuNzyd9VA795t611O3+FIUs5aUZEgmBSe/c1qJJMEiOP4LKG kJR9QnurTZK/iJ1ZHRR6qxbZOSfF37aArzWzv8cf9LZNSgVJjN9rNTNt8kXDAL1EsC pmI1t89w7HRX4GBCWbw3za0+rWsBaTx6u5aIy45c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E9FABF804EB; Tue, 20 Jul 2021 18:22:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6CD0FF80526; Tue, 20 Jul 2021 18:22:07 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) (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 547D9F804DA for ; Tue, 20 Jul 2021 18:22:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 547D9F804DA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="dfidu0wD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DB4+CQVm3eftPe/P8OoBPJcLLbIrCsuQL28nzw+V6cbwEmWVTSe9JnmHPklB+xR0YfjH6t0A8C2RETiEaClRju6/8pWLi80c0x5aurQWlgBVHeYfBdmLeW6d5BifsKPWZgzRySx9HeTvj7fF+u+9cDbAx4jY30/c9GlrnmWguvmi+gTqA+/MXd2fvErHUBJLPR5pgWysDFsySf98I2PBKYX8cUryEVbb0/4IlQfrIKroj7DagcO8vP4XAwlwKcvwYzWsh4lj9dHO06wNOUKY0PRKYKUfyFjeq/gzNxofH148rmwwwdlKieypkzFQSvIFaVvK5mgXZtZ5hLud3zHL7w== 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-SenderADCheck; bh=R24IyrcLXC4EOQrKNoLsLOydMVGnJ5VoiKBgjj8ZTmY=; b=ZX5H9flwBkAmLSQuP9nQWvSwCdKCgT9FQe2U97caTlzRZpY1jwxKgiP9faEpwtuVheG1+MYBVwLhK5XWeZudy/BGKFELaaiHWXCMhHsk8JT5vTRwAVedPf7NAqS67wkztJvR0oP15PnY+E+n9BhoVnqnLxhxTkdVLEdKa4YXnOXu22YoG4ug5YaXz3D6aOeruB4WpA9SZZ4zyms9qqRo1LL2S6R9XUl741Q++Fiv260K7fMuUMr9+5VCa3y20k58nGRTPo9AkwYLOPDy/8fb0U2TAv3yFjuNmZVCiwhUxRNAJ4ye6NOZ6+ZICKFisqG5g+DlI3nLmUSYyNmsVa5cSg== 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=R24IyrcLXC4EOQrKNoLsLOydMVGnJ5VoiKBgjj8ZTmY=; b=dfidu0wDMVG11ndX4gz2Xl2lD16lH1UUDYBQH1nYqEW+EJvIGxnxGsL0ePkKNvzYX9jw1GY7X9CtsyFw/YyzLYqRCCIFmX/IttbcEKT7VrNY0FhQZqy7M08I2LxrFl5qWOkiH+1uGVce10K2Gj3eieHfjA8XZAD0Q4/uq1B11jU= Received: from MW2PR16CA0010.namprd16.prod.outlook.com (2603:10b6:907::23) by BY5PR12MB3650.namprd12.prod.outlook.com (2603:10b6:a03:1a3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Tue, 20 Jul 2021 16:21:55 +0000 Received: from CO1NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:907:0:cafe::1e) by MW2PR16CA0010.outlook.office365.com (2603:10b6:907::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:21:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT056.mail.protection.outlook.com (10.13.175.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:21:55 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2242.4; Tue, 20 Jul 2021 11:21:53 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:21:53 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:21:49 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v4 11/12] ASoC: amd: add vangogh i2s dma driver pm ops Date: Tue, 20 Jul 2021 22:07:31 +0530 Message-ID: <20210720163732.23003-12-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> References: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c7e97d3-227d-4075-db3b-08d94b9a7d8b X-MS-TrafficTypeDiagnostic: BY5PR12MB3650: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rdsuyy0WUX1jeDuXAP6twW0wbmhbFk+cZO42LnLVxWag/75W9j7+yTlmV6GRDmqjChwTCfQVStXW8jGpXEHjqKvS1Qj7qRGDP1wlgV988rXBlaAcHzn8bg2Zhml2rrnurVy08sweKwUr2JjQLppmVqT9NZHdP/l9Z/uokY0yu8aKISK6JS1hQhNuLoyFWbn18yV1lbFlzimr5yQthf/xDJwDsxpTX0IlAgAb2r1yn1H4A1sBICKNAGtTm+0fVlRL2jGXb79VHRqIPAd9l1zytz/k3RZWyw0SGH8c3DHTA0uNwqJDEJh0cqRXHi9NABM+s/niWYU5R+U1Ux8bnsQuKz2ahu8ZUqLj0dORSFdglSiCqM+qgcTHgVgTv/eXc0SNpo2hoZ+50MCe2xGZ296rQakBjGUKrZ2yWCH/7kzzvGpEv+pFAn737ZYAkw77jSCj/dCwcd5AWXNPeHfK2Uqj0+MaZDA/uPMUyAnyhxV0mukDiYceuRoBNatpBw0BfAHqz4EAkY2mDCxDKAN81AfVFd+KMMFRB5C/6OaFtZUnJQs4bsYjLSdqlZ7Yesxyei11ycmw4dZIXYpbhOktSfiG1Rh5RigJ0eiQYuRYe4jNIYj/uaJF4FaQLFU0783RujYlb9r9szxyGfJgBbcgyRWp9222Tg4OkcHK0XL931UpzTvM7ElFeuXJqfoFeSLq44PM+gQd6I1+mPfvKHgG9XCcH8xuStsQ5ZNfV/TKdsebjw8= 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:(4636009)(136003)(39860400002)(346002)(396003)(376002)(46966006)(36840700001)(5660300002)(81166007)(316002)(82740400003)(82310400003)(356005)(186003)(54906003)(36860700001)(8936002)(7696005)(26005)(86362001)(83380400001)(4326008)(110136005)(478600001)(426003)(1076003)(8676002)(6666004)(47076005)(70206006)(70586007)(36756003)(336012)(2616005)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:21:55.0441 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c7e97d3-227d-4075-db3b-08d94b9a7d8b 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: CO1NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3650 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com 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 Vangogh i2s dma driver pm ops Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 96 ++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 57a1a1f54155..cad640ea0fff 100644 --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -411,16 +412,107 @@ static int acp5x_audio_probe(struct platform_device *pdev) } status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler, irqflags, "ACP5x_I2S_IRQ", adata); - if (status) + if (status) { dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n"); + return status; + } + pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_enable(&pdev->dev); + pm_runtime_allow(&pdev->dev); + + return 0; +} - return status; +static int acp5x_audio_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); + return 0; } +static int __maybe_unused acp5x_pcm_resume(struct device *dev) +{ + struct i2s_dev_data *adata; + u32 val, reg_val, frmt_val; + + reg_val = 0; + frmt_val = 0; + adata = dev_get_drvdata(dev); + + if (adata->play_stream && adata->play_stream->runtime) { + struct i2s_stream_instance *rtd = + adata->play_stream->runtime->private_data; + config_acp5x_dma(rtd, SNDRV_PCM_STREAM_PLAYBACK); + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_ITER; + frmt_val = ACP_HSTDM_TXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_ITER; + frmt_val = ACP_I2STDM_TXFRMT; + } + acp_writel((rtd->xfer_resolution << 3), + rtd->acp5x_base + reg_val); + } + + if (adata->capture_stream && adata->capture_stream->runtime) { + struct i2s_stream_instance *rtd = + adata->capture_stream->runtime->private_data; + config_acp5x_dma(rtd, SNDRV_PCM_STREAM_CAPTURE); + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_IRER; + frmt_val = ACP_HSTDM_RXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_IRER; + frmt_val = ACP_I2STDM_RXFRMT; + } + acp_writel((rtd->xfer_resolution << 3), + rtd->acp5x_base + reg_val); + } + if (adata->tdm_mode == TDM_ENABLE) { + acp_writel(adata->tdm_fmt, adata->acp5x_base + frmt_val); + val = acp_readl(adata->acp5x_base + reg_val); + acp_writel(val | 0x2, adata->acp5x_base + reg_val); + } + acp_writel(1, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB); + return 0; +} + +static int __maybe_unused acp5x_pcm_suspend(struct device *dev) +{ + struct i2s_dev_data *adata; + + adata = dev_get_drvdata(dev); + acp_writel(0, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB); + return 0; +} + +static int __maybe_unused acp5x_pcm_runtime_resume(struct device *dev) +{ + struct i2s_dev_data *adata; + + adata = dev_get_drvdata(dev); + acp_writel(1, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB); + return 0; +} + +static const struct dev_pm_ops acp5x_pm_ops = { + SET_RUNTIME_PM_OPS(acp5x_pcm_suspend, + acp5x_pcm_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(acp5x_pcm_suspend, acp5x_pcm_resume) +}; + static struct platform_driver acp5x_dma_driver = { .probe = acp5x_audio_probe, + .remove = acp5x_audio_remove, .driver = { .name = "acp5x_i2s_dma", + .pm = &acp5x_pm_ops, }, }; From patchwork Tue Jul 20 16:37:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 481622 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B8DFC07E9B for ; Tue, 20 Jul 2021 16:25:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CA9B060FF2 for ; Tue, 20 Jul 2021 16:25:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA9B060FF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 587811693; Tue, 20 Jul 2021 18:25:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 587811693 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626798354; bh=V/RSoCvqUueHuWEhw1RIZGXUiphHpHJPkI81LKTyrz4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cB+oEW3ELePOajTz5CefhF8Dr0jtlgImQDCCD+7PdLBIQUDT72WXM63IUFuWQGKPc 9PquwBVJGC7ZHYV6YiJ6jOqprR4LfKnp0wffKpK7JHHCIdmLw4PuhlMqmHjwGoUFAn eHh/r1/gUDFjV7xeJJuiglg3NhLThxTekqQrr/G8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 407D9F80227; Tue, 20 Jul 2021 18:22:22 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 56A97F804FC; Tue, 20 Jul 2021 18:22:21 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20606.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8a::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 E15EBF804CF for ; Tue, 20 Jul 2021 18:22:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E15EBF804CF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="N3G+CEzP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mPPXv3S/N4eq21+WKvhWg0D+qNFcYpY5SjNMRpGjQ+221g4UlmrkGfcH763NIbdxpeCOcXlgwGXopLAdpg+n28yJMO8vBofD7vy8gIbFGp+4MQpUT/pMsuB8pOnK+n13gEqyFVgX2cvU6P9WJaigvbi+vW3Mr4vinmVaeFY8fZhDgVLKV2SfaaQPdkv3kNBPqyzaRo87KXYMTrZCs8TcYVYOq/SkUPVU9ITuldw8cFtTgzmKPOesXzC6RgmKnwDdnn1P8M336OxezjG6/4BIWss3/5x6tzwCW9hDqH8RYMs82ZGJFITDSynOKa9DURGWAkUM6TxPcFrgSqOsPUv0gA== 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-SenderADCheck; bh=1i0+9gPb94UsQr3Sp0gKBRXkObFv558cCC3DKJKN7Wk=; b=gvznEpi4q2a4xqzWjIYD15fhVKdH9IgB7mISGzSXJVXqpjuxw69TbdoTBYiC2rUj6bv24rhI7hDhTV4TLY27HnJV3f6IudBHU53RewYhsCFyzxxvzHdLBbYgp8MvILNAiG6RMGoLvRt7CcdsJPnrUr+EE8Rd86vnwDyH/jac5XhZoaQ/OUNCTkrEjIHCbIomz9MgvGb0cyn7CI2WDu0WdUYsGS4JCvND4YpDAl2da1ql5NRn3+fhRpZ9meHDray/V89HbkiKqSudSxnbAW5yx+PonViRusEdsjI9RArq00FC0gd2xYoA6Ug6CNLdF5SNXBPEZc4DrT1OeE/4KG/QdQ== 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=1i0+9gPb94UsQr3Sp0gKBRXkObFv558cCC3DKJKN7Wk=; b=N3G+CEzPwSl85s0zNM/nD4SkwChgLTd/6emcHx0pnaQtRRw4bZRL5cBueSe8YJ3S1HsjXkGhvNDBtzIteOxGyd1hmZfy1cP6YMmpCCVp1pWhnKeVuQUxGvzRfSefUBOBjuZBcaJQe4QRKTx+n3HX9w4OP7pdLe6KIO9dH25Q15s= Received: from MW4PR03CA0360.namprd03.prod.outlook.com (2603:10b6:303:dc::35) by DM4PR12MB5149.namprd12.prod.outlook.com (2603:10b6:5:390::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Tue, 20 Jul 2021 16:22:13 +0000 Received: from CO1NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::ec) by MW4PR03CA0360.outlook.office365.com (2603:10b6:303:dc::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:22:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none; kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT013.mail.protection.outlook.com (10.13.174.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:22:12 +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.2242.4; Tue, 20 Jul 2021 11:22:11 -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.2242.4; Tue, 20 Jul 2021 11:22:11 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:22:02 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v4 12/12] ASoC: amd: enable vangogh acp5x driver build Date: Tue, 20 Jul 2021 22:07:32 +0530 Message-ID: <20210720163732.23003-13-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> References: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33fe1a99-2684-49cb-c9db-08d94b9a880c X-MS-TrafficTypeDiagnostic: DM4PR12MB5149: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A3D1g9zymY6wCMMFyo4Q6XaAkWVlBAWLbRazs7v8t4+wBGbx7ohH/VkRdej4GiZ6Zruv/lA8BzLYOdFhfb5Iihayey9fAL67/4V5sTwYyxWJlUpXqQD2rHcw4trdt1Gi9NkKY5aVow2yTcWQDRAi6zgq+mwG/SEvV3bzOPmYAgggRcqzU7Hjgb25IzJAFcpUiuGIWIZO0ZCc964SctGubx7Vf8qKhPmXdev3hrzni3ZbGjUtMojQ3aD6Pit/qo9FRX3UVzcczYn6etrWhfkRDwxUfuiB62qn5oBofjy/V44UlLNG19/OpX8xT0KxXcXIg2FolP+Xr/TUK85c1C7mi+5Xmom5nbl93HIAv2bfxBjisURwH4qNo3I1VLuSaerbwycIpCmkfqdeONwkTBJQFwOOulgDSSwXDJsTcBLqY0uMARuP55I6Thr5qlaBSx3EDs1rHSpS2nRzJr5848XQvPBCSoQ4i2k3E68537xAmRBeOG7Xq67NHLRonwQbyKbQE9KG0LLQoBJOWeAXPv5FZRaeIOmkY3TOXFYB+14Ld+a1HnpIJ8b//oyXHRZuLQleYKQIZhmaYC2Yr+AKb2eLc3QAwNKYME5n5/w+k1YfLE2cZRKq1fszKjx0bMIG6A3NF2bbV0GLBicPrx7YckAtbXJHB9rBsjiv1tLRZlUy2PEt1i97YLek0M7CQ/w8AQ0IkQyLelYub/3Pha9BU8lUqqeaXc6AOTG7HdZNTE/5vDPLE68tsD6z15bKWMNIfhhtlScJAFlxoXbb+KFUM4OShi6E6cNWjkAlIsL7V7JRSw0= 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:(4636009)(346002)(376002)(396003)(136003)(39860400002)(46966006)(36840700001)(82310400003)(81166007)(5660300002)(82740400003)(356005)(36860700001)(86362001)(478600001)(36756003)(47076005)(316002)(7696005)(336012)(426003)(2906002)(8676002)(110136005)(54906003)(6666004)(2616005)(8936002)(70586007)(70206006)(1076003)(26005)(186003)(4326008)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:22:12.7433 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33fe1a99-2684-49cb-c9db-08d94b9a880c 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: CO1NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5149 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Ravulapati Vishnu vardhan rao , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com 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" From: Vijendar Mukunda Vangogh ACP5x drivers can be built by selecting necessary kernel config option. The patch enables build support of the same. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/Kconfig | 9 +++++++++ sound/soc/amd/Makefile | 1 + sound/soc/amd/vangogh/Makefile | 9 +++++++++ 3 files changed, 19 insertions(+) create mode 100644 sound/soc/amd/vangogh/Makefile diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index ba5a85bf7412..cc48d4e5b080 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -52,3 +52,12 @@ config SND_SOC_AMD_RENOIR_MACH depends on SND_SOC_AMD_RENOIR help This option enables machine driver for DMIC + +config SND_SOC_AMD_ACP5x + tristate "AMD Audio Coprocessor-v5.x I2S support" + depends on X86 && PCI + help + This option enables ACP v5.x support on AMD platform + + By enabling this flag build will trigger for ACP PCI driver, + ACP DMA drvier, CPU DAI driver. diff --git a/sound/soc/amd/Makefile b/sound/soc/amd/Makefile index e6df2f72a2a1..07150d26f315 100644 --- a/sound/soc/amd/Makefile +++ b/sound/soc/amd/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_SND_SOC_AMD_CZ_RT5645_MACH) += snd-soc-acp-rt5645-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP3x) += raven/ obj-$(CONFIG_SND_SOC_AMD_RV_RT5682_MACH) += snd-soc-acp-rt5682-mach.o obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/ +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += vangogh/ diff --git a/sound/soc/amd/vangogh/Makefile b/sound/soc/amd/vangogh/Makefile new file mode 100644 index 000000000000..3353f93dc610 --- /dev/null +++ b/sound/soc/amd/vangogh/Makefile @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Vangogh platform Support +snd-pci-acp5x-objs := pci-acp5x.o +snd-acp5x-i2s-objs := acp5x-i2s.o +snd-acp5x-pcm-dma-objs := acp5x-pcm-dma.o + +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += snd-pci-acp5x.o +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += snd-acp5x-i2s.o +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += snd-acp5x-pcm-dma.o