Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3688404imu; Sun, 11 Nov 2018 21:32:29 -0800 (PST) X-Google-Smtp-Source: AJdET5dT9f17AG8+4xFu5AnPckElSQmuDJ+0VyQUCUp9agLFZODCqZ9iUs2qro8L6HE/gzb8Ftgi X-Received: by 2002:a63:608f:: with SMTP id u137mr16361175pgb.203.1542000749345; Sun, 11 Nov 2018 21:32:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542000749; cv=none; d=google.com; s=arc-20160816; b=WIHIOgiCBL2d3gpp/BJIAVhg51w2Iqzkn5GjXzLcvIGR9Iw3TWPeBUamEvleBgjyqI byn2moVHZRd4lnLhydzSXI42ICHTdiVL51vspk3QuY9Rfz16rEdlRV+NNl18s2Kvzgu8 iKdE5dn6LtsJtx6Q9M2nJhIcS9EOIYT5BDkVYnVy7K5DwQm0e8aTxwmZcqKOO/OlOegZ MdMWUavm/R1pfniIAC7j9RAQ77qp6PkLJnyCSga+jBySp1N8Pq68gs3eFnMc+jD8qQCK MC62ghYiSE/AYWKCuD6z3hGfDELwCv7qxcYXxWolT9zeyPvm35LM6+vh9b6potdgNsoe ADWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:from:dkim-signature; bh=ve7ha8JTvwRfncF26SouVXgKXq3YhF3UBZR9W3pt2hg=; b=lIg/qu9S+Y8hs+IhVSCvJTVmp8xzYUsdQFBN3sOUOYUliAxAnlKCsez4IQ91AtvTdR DfQzRNxdHTaQGBXf3IGJsUD/VVeHed3hIw6w56b7qTogNuQOhE/C+FX7Za6/FYdR8iBB uJVxs4y9s8gPWqAO2SYnnofLDVHjrDKWoqzlLdEQ83BR5rgCtldGiiWLy85aY1XnHwGO zRdsTDt378bBptmqd2tnLcNnzhG7QbYBZy+DtLgKW5KpUXrbHJU5HbTRbk6IbahdI+2z 7vhuFyrosrko56VraPUkLN+HbhHq0CcmiTb8326+zIbfD0RmTxJ5BVyJlwXUh7c0D99Y T43Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=ucXvMgVF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9-v6si15496950pgd.17.2018.11.11.21.32.13; Sun, 11 Nov 2018 21:32:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=ucXvMgVF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731176AbeKLPXK (ORCPT + 99 others); Mon, 12 Nov 2018 10:23:10 -0500 Received: from mail-eopbgr760073.outbound.protection.outlook.com ([40.107.76.73]:59296 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727243AbeKLPXJ (ORCPT ); Mon, 12 Nov 2018 10:23:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ve7ha8JTvwRfncF26SouVXgKXq3YhF3UBZR9W3pt2hg=; b=ucXvMgVFN2TVAZtVjiKyNe5ujSz9f4Kavj+IIFfROCpecroqpeJeNy35WyrzfR4aLuecEK6J88IEXBrnbg6QY9upLcH1nIk/FemqRdSOl5BYgly+DvfHQ2/HLtb338Sz9aZYG2Ezctz4Co+MGxfISlePWt8qLMD2WjNOjgA0Faw= Received: from SN1PR12CA0093.namprd12.prod.outlook.com (2603:10b6:802:21::28) by SN1PR12MB0622.namprd12.prod.outlook.com (2a01:111:e400:c428::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Mon, 12 Nov 2018 05:31:26 +0000 Received: from CO1NAM03FT008.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by SN1PR12CA0093.outlook.office365.com (2603:10b6:802:21::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.21 via Frontend Transport; Mon, 12 Nov 2018 05:31:26 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT008.mail.protection.outlook.com (10.152.80.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1339.10 via Frontend Transport; Mon, 12 Nov 2018 05:31:25 +0000 Received: from LinuxHost.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Sun, 11 Nov 2018 23:31:24 -0600 From: Vijendar Mukunda CC: , , , Maruthi Srinivas Bayyavarapu , Maruthi Bayyavarapu , Sanju R Mehta , "Liam Girdwood" , Mark Brown , "Jaroslav Kysela" , Takashi Iwai , Vijendar Mukunda , open list , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." Subject: [PATCH 02/11] ASoC: AMD: add ACP3.0 PCI driver Date: Mon, 12 Nov 2018 11:04:53 +0530 Message-ID: <1542000903-19020-3-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542000903-19020-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1542000903-19020-1-git-send-email-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39850400004)(396003)(376002)(346002)(136003)(2980300002)(428003)(199004)(189003)(356004)(6666004)(106466001)(105586002)(2906002)(53416004)(104016004)(305945005)(14444005)(50466002)(478600001)(97736004)(81156014)(81166006)(48376002)(1671002)(47776003)(8676002)(39060400002)(186003)(2616005)(54906003)(126002)(8936002)(476003)(109986005)(26005)(11346002)(446003)(76176011)(16586007)(426003)(7696005)(72206003)(51416003)(77096007)(86362001)(53936002)(4326008)(316002)(5660300001)(68736007)(50226002)(336012)(36756003)(486006)(266003)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB0622;H:SATLEXCHOV01.amd.com;FPR:;SPF:None;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM03FT008;1:ypfJPxKdblJn1Q1phJxNLhPeLOMKfvplB7JQZCLA/8d2S2Ay1pmKUlLiSOVGEWZjuDBwTZxUATErDELLIYJfaW0tCd7soOjflwXSviu8KxOCf+Z54I7AtNzt5k2CNLaQ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38c3169a-8aa6-4594-2431-08d648601720 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060);SRVR:SN1PR12MB0622; X-Microsoft-Exchange-Diagnostics: 1;S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ntm2Ed7syEAqttHfDAw61hXa8+6GClBF6Y6lFvHCSoAERa9f6HhFWdCh26TQY2TLx46YoPHeY+phN3pUv+enSRrLdS/QVkENOFAatAl+9SvQ4RNQPmXr0GN2vGukAk5fcgp1c9K/5SzYfz7t0QhbzMz3fGfAstxdYTOdnW0BvlD3aFAJYowJo3UICFzMR6KiiLWapiVrkUZlyJxLhUPbxnk+UCBQ/7s5gnW4wjpIHDp8DZ6K03mB72aKONHYQiurl0Uu89frSHy8xiKMhd8pdRnp7eRgyGq8tHncEYRAdldIV+n7LE86uF6xNudSslqEj/XX5IWip0UGhNmEzh07p2yxbgiVSA5gkb3orRzcn0voli4OsaGZokqQuQdEofiJJAqsL9fGI0t+Jfbgi8a/HQQaA9acYuvZF+S3HMoPWZjNlCaPl3i4oktKfawqN075KwfGHOH2mPdm5wVHtY1zFlQwpXZBI X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105112)(10201501046)(3002001)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991095);SRVR:SN1PR12MB0622;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0622; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0622;4:pP4ejntTqRBr36GbZ1p3zSur5GLmdNydHAkxy9C2b4E5QPQ9ZmAsb/iZe989ApDRzR3xPK7fLG8whBnCL5wAPjeU8o4FqfsW/QBqVH/qxgmZaOySfu4QUDHlEG0BZqrtrg0LIYjg7nSvetof6dGJx/KY+FSVhwhgcRu2aZ+kWodszhewXXLCQpynJZNUvRFV9P0wXlVFOsMsB142RHJ3vSmz81FC2XQt2YGKj/DnxK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Gk+IdyxpIfQq4y?= =?us-ascii?Q?RPhVzvfDgZa2EnX3z+wy2xAi7p45IVSA/P5AB7LFVBok19oc8VZ5M6OwjOsK?= =?us-ascii?Q?5hn7CnwM9/rGYQCCNDFRp4e5lXbXSVIsMt7xIqPKFe8kbmGypGfnJPyS4XfO?= =?us-ascii?Q?dMmIaj8KOjYLYhZPSf28Bc60oTXF0ozuXGOU0inRt4tzMcM0eClbyInv2uac?= =?us-ascii?Q?iiCp77oJAgK3N0XxTaa4P58OEU/ixvNu/sakjMD+OzzUEnixcnX8VlydfaCm?= =?us-ascii?Q?IdJr9PfCaMCBHMlZ5w/qEKThlVKlbFKKKzJCm8UnGMjbMY+L2RoMW7Nmsgx1?= =?us-ascii?Q?poZSLLIjnaOTKzwTrZc6Wkgo8S15443zXfC6Imu1mx/RJO+RyRG0hhIvIUUQ?= =?us-ascii?Q?pXrwLWfJy6GOfDc6YDNYeDohnKFOJPbBqs6FUv7xKnXtNSHx81FVLmS0eLnk?= =?us-ascii?Q?SRQHe9il8E9QM0nde7WRy+JjdiBdiSuJY3pZZWYYkO7FMbBl5H8+4SVPaIuP?= =?us-ascii?Q?j/k024KxUotPz6dS+s=3D?= X-Microsoft-Antispam-Message-Info: 0Jhgp+hDenSQ289ephNMrW8ibqBh5SHhcnFIqCmqiSaORaGO59aG+J3626QNEQd2sSN2sbEe3kKuZ8CPx+WHYTwr1/VBzUVMLBcyO1o+Fb9dkY7mKG9UqleOyN6rW28l8331/P+4485gpK3alUWzhi4u+v+qjvQ1f3+2qzFwIND903tszyzUVyGxEXzeEj0/x0Oa6d7KClVohAgvHnx0G6Zqlig9aHqDRazaB8r+4ecyfKtinQtwHGp38naDwpoI4NE/tyAQhXixEKtwZN/Nw4aSIQsep6PLptHy2W7GYdbiBqopySnH07A0gk4Q+u+tjbgXFoEBZLLH3NoXBjErM0Pb0BjQldG7deW1QM+IE5o= X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0622;6:fY/q6QnGMKt0+8f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cOi0yZHpFrInlCYp+0tWDewi4XYLR4T4fFE7yFJhS9hoH/6qKtOgw X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2018 05:31:25.8109 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38c3169a-8aa6-4594-2431-08d648601720 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0622 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maruthi Srinivas Bayyavarapu ACP 3.0 is a PCI audio device. This patch adds PCI driver to bind to this device and get PCI resources. Signed-off-by: Maruthi Bayyavarapu Signed-off-by: Sanju R Mehta Tested-by: Ravulapati Vishnu vardhan Rao Signed-off-by: Vijendar Mukunda --- sound/soc/amd/raven/acp3x.h | 13 ++++++ sound/soc/amd/raven/pci-acp3x.c | 97 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 sound/soc/amd/raven/acp3x.h create mode 100644 sound/soc/amd/raven/pci-acp3x.c diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h new file mode 100644 index 0000000..e9b4df0 --- /dev/null +++ b/sound/soc/amd/raven/acp3x.h @@ -0,0 +1,13 @@ +#include "chip_offset_byte.h" + +#define ACP3x_PHY_BASE_ADDRESS 0x1240000 + +static inline u32 rv_readl(void __iomem *base_addr) +{ + return readl(base_addr - ACP3x_PHY_BASE_ADDRESS); +} + +static inline void rv_writel(u32 val, void __iomem *base_addr) +{ + writel(val, base_addr - ACP3x_PHY_BASE_ADDRESS); +} diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c new file mode 100644 index 0000000..27588ed --- /dev/null +++ b/sound/soc/amd/raven/pci-acp3x.c @@ -0,0 +1,97 @@ +/* + * AMD ALSA SoC PCM Driver + * + * Copyright 2016 Advanced Micro Devices, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include +#include + +#include "acp3x.h" + +struct acp3x_dev_data { + void __iomem *acp3x_base; +}; + +static int snd_acp3x_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + int ret; + u32 addr; + struct acp3x_dev_data *adata; + + if (pci_enable_device(pci)) { + dev_err(&pci->dev, "pci_enable_device failed\n"); + return -ENODEV; + } + + ret = pci_request_regions(pci, "AMD ACP3x audio"); + if (ret < 0) { + dev_err(&pci->dev, "pci_request_regions failed\n"); + goto disable_pci; + } + + adata = devm_kzalloc(&pci->dev, sizeof(struct acp3x_dev_data), + GFP_KERNEL); + if (!adata) { + ret = -ENOMEM; + goto release_regions; + } + + addr = pci_resource_start(pci, 0); + adata->acp3x_base = ioremap(addr, pci_resource_len(pci, 0)); + if (!adata->acp3x_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_acp3x_remove(struct pci_dev *pci) +{ + struct acp3x_dev_data *adata = pci_get_drvdata(pci); + + iounmap(adata->acp3x_base); + pci_release_regions(pci); + pci_disable_device(pci); +} + +static const struct pci_device_id snd_acp3x_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x15e2), + .class = PCI_CLASS_MULTIMEDIA_OTHER << 8, + .class_mask = 0xffffff }, + { 0, }, +}; +MODULE_DEVICE_TABLE(pci, snd_acp3x_ids); + +static struct pci_driver acp3x_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_acp3x_ids, + .probe = snd_acp3x_probe, + .remove = snd_acp3x_remove, +}; + +module_pci_driver(acp3x_driver); + +MODULE_AUTHOR("Maruthi.Bayyavarapu@amd.com"); +MODULE_DESCRIPTION("AMD ACP3x PCI driver"); +MODULE_LICENSE("GPL v2"); -- 2.7.4