Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3689447imu; Sun, 11 Nov 2018 21:34:07 -0800 (PST) X-Google-Smtp-Source: AJdET5fQUFpApGtCUb/go0sOfjyke5QMY3JpKRi2YfS+opD0yXVaPzYwn4xrlWZW83oUMYcuF6nk X-Received: by 2002:a62:8647:: with SMTP id x68-v6mr19634160pfd.252.1542000847838; Sun, 11 Nov 2018 21:34:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542000847; cv=none; d=google.com; s=arc-20160816; b=PnYqM2cCbw8OVjTJpdN+qdohpqDj4rIdTJpsLJ+XdHFzia7Jn0ZCREZbKF1hI3PfZ/ W8BrQ1qqS61D19xwvDO/lcIxCGSWkXpG1Fk9OB4/fTnIOXhsfOy2g99VpoQlklU5+nXZ TDZZAgqofyhwgZRMURxYufZi10Ucan2FeOyL6Tv+05U5AUWV9a77zI0pmSQTXpk5pKyp /i1em6UiwSZWYEOdfpPs0OsxWxG0fmausUdtsvOyx2iQRwNRyaf0X5ewc9XFfIQcD6TQ ltcbNBOfztefqe07r63wDq6kwalea/O9XlvISX1Uo+GvdXu+SX+CUGtnDlvxrIgy9UsP xa0A== 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=bBffJfsJJaiX0Y086HQJvkxFmnKgPuRio0+lZc5Hrg4=; b=RW1+NGGzC7uCFmcfllVSbgs4f3pQ6JzjhKHGfOCawWXnhU2KNDLBYJAx8+AnSCQgJf rKI032eGGy5RZOqHXGhR8LPq2XExZfAiiwsYps2+0dq57qBs64Hqkmmpqd9rgUI+RDTB FV97jjtR69anJB9Bxu/tboaW+HwmeI7OZQT/KHMLb11QO09wAhS9dQLm69ZQt7HgGFLI vyoqUZkQCBWi3sTHgLNTEeNQXEfH6Ko1w0tksv2PekPsF4VowQy+ROFKKPCyg2KmXdOE f04gzMVbh0qFzsOpiDmWRHnNtt50K+SFWBZXuJBGF+88mmbcg43jk7NXoQ73vvsILqG1 SUYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=p4Mg2odV; 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 v69si15587672pgb.3.2018.11.11.21.33.52; Sun, 11 Nov 2018 21:34:07 -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=p4Mg2odV; 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 S1731283AbeKLPXd (ORCPT + 99 others); Mon, 12 Nov 2018 10:23:33 -0500 Received: from mail-eopbgr790079.outbound.protection.outlook.com ([40.107.79.79]:61793 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727243AbeKLPXc (ORCPT ); Mon, 12 Nov 2018 10:23:32 -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=bBffJfsJJaiX0Y086HQJvkxFmnKgPuRio0+lZc5Hrg4=; b=p4Mg2odV60SDtx/SIx0ejgxZQi9rmDyu+idArdLZs1wKlixGFYf2Dq40aEGYBopOwPVGpuek55x51CBnHQwGWIve9idgCM487OmFauoYRnembET5zw3DQKpNbJ66LbS5avlYgZVeYxAZ6eJ9Bf+7zKRnz3oyuNYGhlsPHNS5lKY= Received: from BN4PR12CA0002.namprd12.prod.outlook.com (2603:10b6:403:2::12) by BLUPR12MB0419.namprd12.prod.outlook.com (2a01:111:e400:516c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Mon, 12 Nov 2018 05:31:48 +0000 Received: from CO1NAM03FT060.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::202) by BN4PR12CA0002.outlook.office365.com (2603:10b6:403:2::12) 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:48 +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 CO1NAM03FT060.mail.protection.outlook.com (10.152.81.16) 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:47 +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:45 -0600 From: Vijendar Mukunda CC: , , , Vijendar Mukunda , Maruthi Bayyavarapu , Liam Girdwood , "Mark Brown" , Jaroslav Kysela , Takashi Iwai , Maruthi Srinivas Bayyavarapu , Sanju R Mehta , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH 03/11] ASoC: amd: create ACP3x PCM platform device Date: Mon, 12 Nov 2018 11:04:54 +0530 Message-ID: <1542000903-19020-4-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)(396003)(39860400002)(136003)(376002)(346002)(2980300002)(428003)(189003)(199004)(106466001)(39060400002)(426003)(81166006)(81156014)(16586007)(77096007)(8676002)(48376002)(126002)(476003)(14444005)(47776003)(26005)(72206003)(53416004)(54906003)(36756003)(50466002)(336012)(50226002)(2616005)(105586002)(11346002)(486006)(1671002)(8936002)(478600001)(2906002)(316002)(68736007)(446003)(53936002)(109986005)(97736004)(86362001)(4326008)(7696005)(5660300001)(305945005)(186003)(76176011)(6666004)(356004)(104016004)(51416003)(266003)(32563001);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR12MB0419;H:SATLEXCHOV01.amd.com;FPR:;SPF:None;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM03FT060;1:WcfurlPpz73Wt1QL9GwKcnwu41FnqWqJ0rbnx8yaTjvzPhtro01luZrY3A7mxDjfwDsA4UdBlXalSn9oPHR4A8bPvi8M+X2oBLacvB188iPNEo1qoPApItDS47MEV6Nd X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3de877c-9629-4a33-3c4a-08d6486023ff X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060);SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1;BLUPR12MB0419;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JBsJYnx6LipkYRGFI4i/G5QcK/g0itvMFUMOaSQvwQPf0LI1nw7J/J+ZvDmptYj5jLNqy+l9ECfW5rCUXtj5R1qTP/wXWyUfNHJ9m6Sa0OG0CLXnM7BrjJQ7BZyvlQFY866JZJTne04m8feHOWCSy3mOQI4d2d2wssNkFATUQjGmmuO398ARteglG7jUgF78L2z2Bua5X+vrUA2DS+0Dbg+P34Dt8+sUTCEYPRvi29nAUp82IWrFnAoHohJTPA+BUtcYqaaEbkd1/tqn2YFoSFrT9OdQafcjNYI6FHhRStJWIwFVbotZ5RjO1AG3C74YLKq+Xgul2JeSPVy2OQu6qvEU4paLRKWKxvpGelbCOxv/CBl8R3w7bBm7d76/YagPNgsUiD3A1hFU+pYU2MPe39CLTqe6wclxWuql1SRTQrPjIrxhqPGLCP27gJ1DfsExxHpYyut8t1qbdDQSkv5rctU5gfjU2N 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)(10201501046)(3231382)(944501410)(52105112)(3002001)(93006095)(93003095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:BLUPR12MB0419;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0419; X-Microsoft-Exchange-Diagnostics: 1;BLUPR12MB0419;4:CPNRbmtBziqH1KVMc6v7jCr2siKBgyvfcHX9lNdvuiv7dCuLlDMBw2FLjLbvUXNmIp1o4VTfSYSmnXCznBkM4xyXKo83oV3YE4p5k/9E4PRRsbRAYjXvwawyYnnckQ3a7EwSmlXT+k7R5WaF86nL7OzWw8+w4N+CZHe3YlegWZ2Yu1ZL1namE8n7wISgauiRQYbhwOaj1Szj36+EJE0+BO3RE7VRFhtCaKPhGxlPnHuq6woqJ0PE9UT/opg2XRFyr21U0py5ntAjNtEq9zfZ0CKbnea78+CEI5QtCR5tVnEQbplUbmSxRL1ID0g0IitG X-Forefront-PRVS: 0854128AF0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR12MB0419;23:v+F00SgcDTD0T+Mg8DFYlkFPMya0v55qgIKpuvmeB?= =?us-ascii?Q?D9XNwFrWya4065nV55FTbKyN/Orc0/v7f25KlMcQQaJWHChOpvZJVhBvyyFe?= =?us-ascii?Q?Y86R/ZqPl8fGor72hMN6VWXtrWFLQxEwVXIwItc78vZolx8xs6qJXV0bu72e?= =?us-ascii?Q?USDCz9hT7bRZruSmCHVozDzuqI6U0xDlwCjLgviQdzGXpXyLPc8/YdSLkE4l?= =?us-ascii?Q?UQ/TFDnsD7ob2OCd92t2cKJ5RRL4pJ02VF1+rw+8i/8uWlGBCyN/2ieLzZSY?= =?us-ascii?Q?vyXylZw6Qz9FoxwFHP44RvlrqnZIwi/gf9YPgA6CTNh20L2bLspm/bf6mx0x?= =?us-ascii?Q?gDeImvFrQDCOPmjmx73ChNCGUuM5CXbhouKMqniXkN8fuZvRM8uglal0A7lx?= =?us-ascii?Q?vb13RvB8XsG60c/kBRqqgxFrl+nWYuvMv2/RsWUZWVnn/D7bwI4lphNNNXyb?= =?us-ascii?Q?ZOi3UJEyjfy/hZitTgrmYUkrfDb9s6sIXK/Yt+gAU+zzH9TTVR/s9CvgPQCT?= =?us-ascii?Q?SXDW4GZwU7znbocTTTvEkgugEFSwqHqVQN2zpVm8g4gt9vHJhmFsCj5Ae9ph?= =?us-ascii?Q?koGr8KgHI8ZfJhP2CPsTujgM+0C+fJYMAAHJBLPBic2t8yrm2PUVy+1fJW6J?= =?us-ascii?Q?ULSwp75qu6yxuhNXQe9ZLHwyjaq9n8tfDF/cDRFtb+bXpMNy7Q7PHNkn3/XB?= =?us-ascii?Q?yA+PPI0RH2HO3663oZ3n36AH2XGkUG9+CaBfMCxXREFxer2Byb7911GZWuZ2?= =?us-ascii?Q?HEcPyW5jXXosQ/K2cwAQ5g8oMxywArWNwPe5e4kCMMp7CM769P6CkckqGDAo?= =?us-ascii?Q?mDQBNZifVKeKHXSWMgvhhQbIs3j8WtZxEMcoRnybiEg063J1fYeq1zvqxGqM?= =?us-ascii?Q?sfV8SBTmLebsiKvbO3shXE/0t8BlsgzFIV08FDXALa6iayulayT/aQFAIUEa?= =?us-ascii?Q?KEHItVcIARwEGLjz26o/tO1JKMDpIG6lLnJOrrJu6hrWMWhy5j0QSV1eaDU+?= =?us-ascii?Q?EzAcrQ2+IYryTThG+pUzCu1l5lHtmSBJSM1eV7DPXFzmW2G7wmujvUZBePW5?= =?us-ascii?Q?lUNU1ChrxeuJOmoIFU0KvzRoiM7irGByorTb/WoErbQUGh+RDvkwpIRns7yM?= =?us-ascii?Q?0MVvDQrJ7ez/Rcot9zm2BwqbjElGKOFpn3j9s5dEmViQfRIoZVLjc7V15xXd?= =?us-ascii?Q?sr9zfkSMsvRajGoRLbt9K7JgD+/93Rfpe+XoA2YcZfD9t8FLBcRSfAPc71rT?= =?us-ascii?Q?/Igx5g1G9EwWYO+7+o=3D?= X-Microsoft-Antispam-Message-Info: m7mq64wAM8Etj2PEXTAz5aYU+HEBRqaGYA8ZxYFv/1nRE0OCGoYUXC1mjhhYTbXs3J3x+5j+BVVLGu7QTlJQXjyuJllt1BBVOYrEGZeGiWHRVUTEsKnVuGpccDNQzsQfIsv1mLh/0czKt9PYE8LhTofCFoJmmPEDCH8zQMjaXOMm5Dxc6IFjwYK3VxEVoM4/JcE3UvGQrPg4Zl89xXnHaWUlQD2mGpPf8TTYjjCakW8hKG3QyDMhHPqnqxcm+uHFTXpdeCHfRh8BMompA79+OsJ/Cuf1022CkOoG0wBgCT1XEgMsh1kI+BUMyfvQlYLgikAsGI+9r4WnwtCGTFwX77T0e+xr3ikDinWBl6tALUc= X-Microsoft-Exchange-Diagnostics: 1;BLUPR12MB0419;6:NOaTX+B4dvO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G4ym+3ikV539F2mOAx2nLDMmncIeEbyR X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2018 05:31:47.4056 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3de877c-9629-4a33-3c4a-08d6486023ff 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: BLUPR12MB0419 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 ACP 3x IP has I2S controller device as one of IP blocks. Create a platform device for it, so that the PCM platform driver can be bound to this device. Pass PCI resources like MMIO, irq to the platform device. Signed-off-by: Maruthi Bayyavarapu Tested-by: Ravulapati Vishnu vardhan Rao Signed-off-by: Vijendar Mukunda --- sound/soc/amd/raven/acp3x.h | 4 +++ sound/soc/amd/raven/pci-acp3x.c | 70 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h index e9b4df0..83b1ed8 100644 --- a/sound/soc/amd/raven/acp3x.h +++ b/sound/soc/amd/raven/acp3x.h @@ -1,6 +1,10 @@ #include "chip_offset_byte.h" #define ACP3x_PHY_BASE_ADDRESS 0x1240000 +#define ACP3x_I2S_MODE 0 +#define ACP3x_REG_START 0x1240000 +#define ACP3x_REG_END 0x1250200 +#define I2S_MODE 0x04 static inline u32 rv_readl(void __iomem *base_addr) { diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c index 27588ed..0700162 100644 --- a/sound/soc/amd/raven/pci-acp3x.c +++ b/sound/soc/amd/raven/pci-acp3x.c @@ -16,19 +16,26 @@ #include #include #include +#include +#include #include "acp3x.h" struct acp3x_dev_data { void __iomem *acp3x_base; + bool acp3x_audio_mode; + struct resource *res; + struct platform_device *pdev; }; static int snd_acp3x_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { int ret; - u32 addr; + u32 addr, val; struct acp3x_dev_data *adata; + struct platform_device_info pdevinfo; + unsigned int irqflags; if (pci_enable_device(pci)) { dev_err(&pci->dev, "pci_enable_device failed\n"); @@ -48,6 +55,15 @@ static int snd_acp3x_probe(struct pci_dev *pci, goto release_regions; } + /* check for msi interrupt support */ + ret = pci_enable_msi(pci); + if (ret) + /* msi is not enabled */ + irqflags = IRQF_SHARED; + else + /* msi is enabled */ + irqflags = 0; + addr = pci_resource_start(pci, 0); adata->acp3x_base = ioremap(addr, pci_resource_len(pci, 0)); if (!adata->acp3x_base) { @@ -56,8 +72,57 @@ static int snd_acp3x_probe(struct pci_dev *pci, } pci_set_master(pci); pci_set_drvdata(pci, adata); + + val = rv_readl(adata->acp3x_base + mmACP_I2S_PIN_CONFIG); + switch (val) { + case I2S_MODE: + adata->res = devm_kzalloc(&pci->dev, + sizeof(struct resource) * 2, + GFP_KERNEL); + if (!adata->res) { + ret = -ENOMEM; + goto unmap_mmio; + } + + adata->res[0].name = "acp3x_i2s_iomem"; + adata->res[0].flags = IORESOURCE_MEM; + adata->res[0].start = addr; + adata->res[0].end = addr + (ACP3x_REG_END - ACP3x_REG_START); + + adata->res[1].name = "acp3x_i2s_irq"; + adata->res[1].flags = IORESOURCE_IRQ; + adata->res[1].start = pci->irq; + adata->res[1].end = pci->irq; + + adata->acp3x_audio_mode = ACP3x_I2S_MODE; + + memset(&pdevinfo, 0, sizeof(pdevinfo)); + pdevinfo.name = "acp3x_rv_i2s"; + pdevinfo.id = 0; + pdevinfo.parent = &pci->dev; + pdevinfo.num_res = 2; + pdevinfo.res = adata->res; + pdevinfo.data = &irqflags; + pdevinfo.size_data = sizeof(irqflags); + + adata->pdev = platform_device_register_full(&pdevinfo); + if (!adata->pdev) { + dev_err(&pci->dev, "cannot register %s device\n", + pdevinfo.name); + ret = -ENODEV; + goto unmap_mmio; + } + break; + default: + dev_err(&pci->dev, "Inavlid ACP audio mode : %d\n", val); + ret = -ENODEV; + goto unmap_mmio; + } return 0; +unmap_mmio: + pci_disable_msi(pci); + iounmap(adata->acp3x_base); release_regions: pci_release_regions(pci); disable_pci: @@ -70,7 +135,10 @@ static void snd_acp3x_remove(struct pci_dev *pci) { struct acp3x_dev_data *adata = pci_get_drvdata(pci); + platform_device_unregister(adata->pdev); iounmap(adata->acp3x_base); + + pci_disable_msi(pci); pci_release_regions(pci); pci_disable_device(pci); } -- 2.7.4