From patchwork Mon Nov 12 05:34:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 10678119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F3A514BA for ; Mon, 12 Nov 2018 05:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED91929E28 for ; Mon, 12 Nov 2018 05:31:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE19D29E3A; Mon, 12 Nov 2018 05:31:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D151729E28 for ; Mon, 12 Nov 2018 05:31:58 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A3DB726792F; Mon, 12 Nov 2018 06:31:57 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3F84F2679FA; Mon, 12 Nov 2018 06:31:55 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0042.outbound.protection.outlook.com [104.47.36.42]) by alsa0.perex.cz (Postfix) with ESMTP id 6010326792F for ; Mon, 12 Nov 2018 06:31:52 +0100 (CET) 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 To: 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 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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=; 20:DgxvItsmiCs6bTi+1XXwW09SsmtOkGTwtfJBsJYnx6LipkYRGFI4i/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+CZHe3YlegWZ2Yu1ZL1namE8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M5RTEDCOoZpECG9oae9iJ4DN4pTe3l4HXD0U50Y4Y60jb3t51PirKNvT17yqiy3EiDUyMF5L9jb936m1O0Wr75oh7cekt3Tz/eHwBJXcnW9ZFCNWFwKHpBaefx+LBAnhbGyEGjEgfgjvJdbiPuv7cX7sjezjI/e3JN9Qxuy2StakM2deUjVgiolk/pWJLW4vlpKV7zqw==; 5:sA8C+lUYuXUhSV2I6uGK0s56z1Z6Tb4jwjNJHbNB4k92Mq3BeUgpMSincnG8tL5CsdY3fdOSMGVXrOEtNN9dC+IYvp02htjt55UEjwIC30ebzXmHRumiZUPbab0qs4O04x0IIzFQ+A6Jd2yv5cgAfui+PLZ5AzXOpZV8b/j//wc=; 7:s6Ug/n0rXwelu5RAZ+9wC0EGmw7WAoenQthQRAHrwHunz7VA5hB7+8o2KsxuwpKicjxrtfwEumqoBnKPEbbZzzG9cJjT0C31SCMP0xifMoMa4gOCxokXPw83Fa83VVRWJpZpZI+kUhG69VD63MHUvQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0419; 20:bk3iCCFp1iCPT6pCuSfrLmt3OVz5rBK9a/8shKP4FukBXsPltugPm6sswp054yR8fh9GZ75LtLGqRyFqRN+rdUIgVvfUWGqttkvktyL2XkMlMCHGlC6DEI5Wvie4I1BgwveSN6Jvnb5dfiPm/UZEepMorpuSG+qeVgpARcGy756R/7xWcQsdjCzs4YouMt2f1qk8iYs5dOGNAxU+wzJ8gfqchejJ4efsG4ym+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 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Maruthi Srinivas Bayyavarapu , open list , Takashi Iwai , Liam Girdwood , Sanju R Mehta , Vishnuvardhanrao.Ravulapati@amd.com, Mark Brown , Vijendar Mukunda , Alexander.Deucher@amd.com Subject: [alsa-devel] [PATCH 03/11] ASoC: amd: create ACP3x PCM platform device X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }