From patchwork Wed Nov 13 07:14:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "RAVULAPATI, VISHNU VARDHAN RAO" X-Patchwork-Id: 11241195 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A2AC21515 for ; Wed, 13 Nov 2019 07:16:26 +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 9F6C9222C2 for ; Wed, 13 Nov 2019 07:16:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="F5RzbANn"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="NCImUz8G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F6C9222C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none 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 48B841612; Wed, 13 Nov 2019 08:15:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 48B841612 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1573629383; bh=wTRW0+cjBsbf6HQZL368GShzX1gaDSA4qhQbO150Ml0=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=F5RzbANnAhNYhn95m4HkGZKO9HE62+JgOevfrwjdYJI/4cabk7ziwmOKBJSEFl5T2 JUITHYVypuv+RzWYE/fC/WYqayEgIuzoj7lsSr9Pwr6xCdQVOCZelXEBCfdz1jXRep lrtVGSuuRIuVCys9+yGmDDech0IAlQr0G/p2VrO8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BC5ABF8045D; Wed, 13 Nov 2019 08:15:32 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6B182F804FF; Wed, 13 Nov 2019 08:15:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, FORGED_SPF_HELO,SPF_HELO_PASS,SPF_NONE,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790082.outbound.protection.outlook.com [40.107.79.82]) (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 0C174F80214 for ; Wed, 13 Nov 2019 08:15:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0C174F80214 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="NCImUz8G" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CrV2cscfn971UXOcrq2oqgqyTrVFda7e3Hm3FAlSyg77gxqmHRCa2siD2TGhYiHv2lIlhPde7ZIzoqCiWtzxIo2rg2oNxRf2bseJDpygfKrLilN58uoumwAaADr8l5cg2BB9KZpaCfXAluWM4S2jefaoUykUNrQS/1CY4m/WDqcmzJSQ3ccYJOV0X05iJ7sEYfToO17KGYuM5DWuM++7QbQrhXFay5JT3WvH7QyTLthf/GcEG2Eezxwq1asolXmFYsu2HWI5B4hOFhfwZy8PmnWM/4vriPgLuHIsZgYZ7a5jGFAdHRzTwpUy1R0OUzXmvHq7Aoz0X7NiCm4D4WRDag== 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=3QJKUW4CLUU/PPXT9y32zLf3je84kFtHwMMA7F/ZW5Q=; b=f3iMNVLYXAn5q7nkyiDIPIyr8NrOWc1dj1EeGOMqNw1d49BgI1PMSj+bKagr+tNe+JGLjhz6Ragw4YBoXwTF2dNaEfBudpZayJFbr7ynvtaYq5M05x4RUPiGcU/h1lJ+n+uXKCJLgwg7Nn2KhCIKg74E1TxqyI5MTQ1PfOU2zpd2Ok2BnBrbHBjjcnRjT/vYhH8TF51o+eUkmnPvPsyLag7OUS7J7HcFTxsbTn8M5oiVs2264ddxQygNX0pVOGM6oGUe6d2ePwlZe0LMvL+lpsKiytIxGUUcriHAB4Docv9SwSGwYIm6FVu6Mz4/aIkiTFigJVH9OvNDhhIbiMwBCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3QJKUW4CLUU/PPXT9y32zLf3je84kFtHwMMA7F/ZW5Q=; b=NCImUz8Gd2Uj8I30PeMNco8s0q5SYhbbEJJxGVQuB3C2Y5arU5nYbqti30vsSobpYPe1YV7PwcKEDhIi79caHnayRKr2A+mSN4nVdtS2rU6e8e4j5vLylj1ULu60rAVICUG5H9R/XfO/fBkeRjdSps57DD/V+ge0teDBvijayTQ= Received: from DM6PR12CA0013.namprd12.prod.outlook.com (2603:10b6:5:1c0::26) by CH2PR12MB4151.namprd12.prod.outlook.com (2603:10b6:610:78::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2430.20; Wed, 13 Nov 2019 07:15:23 +0000 Received: from CO1NAM11FT041.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::207) by DM6PR12CA0013.outlook.office365.com (2603:10b6:5:1c0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2430.22 via Frontend Transport; Wed, 13 Nov 2019 07:15:23 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; google.com; dkim=none (message not signed) header.d=none;google.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 SATLEXMB01.amd.com (165.204.84.17) by CO1NAM11FT041.mail.protection.outlook.com (10.13.174.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2451.23 via Frontend Transport; Wed, 13 Nov 2019 07:15:23 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 13 Nov 2019 01:15:22 -0600 Received: from SATLEXMB02.amd.com (10.181.40.143) 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.1713.5; Wed, 13 Nov 2019 01:15:22 -0600 Received: from vishnu-All-Series.amd.com (10.180.168.240) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 13 Nov 2019 01:15:17 -0600 From: Ravulapati Vishnu vardhan rao To: Date: Wed, 13 Nov 2019 12:44:04 +0530 Message-ID: <1573629249-13272-2-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1573629249-13272-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> References: <1573629249-13272-1-git-send-email-Vishnuvardhanrao.Ravulapati@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)(4636009)(376002)(346002)(39860400002)(396003)(136003)(428003)(189003)(199004)(426003)(2616005)(476003)(446003)(11346002)(126002)(316002)(486006)(16586007)(5660300002)(336012)(81156014)(4326008)(109986005)(51416003)(50226002)(81166006)(8936002)(54906003)(36756003)(8676002)(7696005)(76176011)(53416004)(70586007)(47776003)(70206006)(305945005)(478600001)(26005)(1671002)(50466002)(186003)(2906002)(356004)(48376002)(6666004)(86362001)(266003); DIR:OUT; SFP:1101; SCL:1; SRVR:CH2PR12MB4151; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b17e4e6-4a3e-4f1b-53b7-08d768093ff0 X-MS-TrafficTypeDiagnostic: CH2PR12MB4151: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:182; X-Forefront-PRVS: 0220D4B98D X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rLA1HwobOyf3fbnLtO/+niWDfeHoS5Yj7G7r7srkpKDPAc9ogKXrLylllqEZ6zQ+n7lsnVGBgMAg9SQFWjP48rbDJdvRAjgolItrupGzrHoU+HJeVUdDveQ+XyPWE38CQU3jWuPjjzxLWCeUA+xURQtWKqKCBJbDtQb6iAd99NdK5Z91X9V8BIucmJV5yY+E/r3uYsiDCuzsepaUYAGhQ2pzk+7QDjpFNc1ZAQxuGaTmbEFkmEvoMuyy4swR9i9Y5wsT0jrXJOUxPR14KTa2UDi5RVeHfh5QJzgZAEnQGAx0enzj9Uo7I1hERjE7RFfUfZ+zeJd50r943T3YZdKIgqfuPYdQuxcsWLE3WCVLNBQgepyEHUV3WsajCN6ndRkpKdvwUf/8GcIm8SM8oRaYuo0EMKvh+TkWUmjOBIbBC+WSTo4JfbaR8qC7kJC8DJvf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2019 07:15:23.1292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b17e4e6-4a3e-4f1b-53b7-08d768093ff0 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4151 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Maruthi Srinivas Bayyavarapu , open list , Takashi Iwai , Liam Girdwood , Akshu.Agrawal@amd.com, Sanju R Mehta , Ravulapati Vishnu vardhan rao , Mark Brown , djkurtz@google.com, Vijendar Mukunda , Alexander.Deucher@amd.com, Colin Ian King , Dan Carpenter Subject: [alsa-devel] [PATCH v5 1/6] ASoC: amd:Create multiple I2S platform device Endpoint 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" Creates Platform Device endpoints for multiple I2S instances: SP and BT endpoints device. Pass PCI resources like MMIO, irq to the platform devices. Signed-off-by: Ravulapati Vishnu vardhan rao --- sound/soc/amd/raven/acp3x.h | 5 +++ sound/soc/amd/raven/pci-acp3x.c | 78 +++++++++++++++++++++++++++++------------ 2 files changed, 60 insertions(+), 23 deletions(-) diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h index 4f2cadd..2f15fe1 100644 --- a/sound/soc/amd/raven/acp3x.h +++ b/sound/soc/amd/raven/acp3x.h @@ -7,10 +7,15 @@ #include "chip_offset_byte.h" +#define ACP3x_DEVS 3 #define ACP3x_PHY_BASE_ADDRESS 0x1240000 #define ACP3x_I2S_MODE 0 #define ACP3x_REG_START 0x1240000 #define ACP3x_REG_END 0x1250200 +#define ACP3x_I2STDM_REG_START 0x1242400 +#define ACP3x_I2STDM_REG_END 0x1242410 +#define ACP3x_BT_TDM_REG_START 0x1242800 +#define ACP3x_BT_TDM_REG_END 0x1242810 #define I2S_MODE 0x04 #define BT_TX_THRESHOLD 26 #define BT_RX_THRESHOLD 25 diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c index facec24..91ebee9 100644 --- a/sound/soc/amd/raven/pci-acp3x.c +++ b/sound/soc/amd/raven/pci-acp3x.c @@ -16,16 +16,16 @@ struct acp3x_dev_data { void __iomem *acp3x_base; bool acp3x_audio_mode; struct resource *res; - struct platform_device *pdev; + struct platform_device *pdev[ACP3x_DEVS]; }; static int snd_acp3x_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { int ret; - u32 addr, val; + u32 addr, val, i; struct acp3x_dev_data *adata; - struct platform_device_info pdevinfo; + struct platform_device_info pdevinfo[ACP3x_DEVS]; unsigned int irqflags; if (pci_enable_device(pci)) { @@ -68,7 +68,7 @@ static int snd_acp3x_probe(struct pci_dev *pci, switch (val) { case I2S_MODE: adata->res = devm_kzalloc(&pci->dev, - sizeof(struct resource) * 2, + sizeof(struct resource) * 4, GFP_KERNEL); if (!adata->res) { ret = -ENOMEM; @@ -80,28 +80,52 @@ static int snd_acp3x_probe(struct pci_dev *pci, 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->res[1].name = "acp3x_i2s_sp"; + adata->res[1].flags = IORESOURCE_MEM; + adata->res[1].start = addr + ACP3x_I2STDM_REG_START; + adata->res[1].end = addr + ACP3x_I2STDM_REG_END; + + adata->res[2].name = "acp3x_i2s_bt"; + adata->res[2].flags = IORESOURCE_MEM; + adata->res[2].start = addr + ACP3x_BT_TDM_REG_START; + adata->res[2].end = addr + ACP3x_BT_TDM_REG_END; + + adata->res[3].name = "acp3x_i2s_irq"; + adata->res[3].flags = IORESOURCE_IRQ; + adata->res[3].start = pci->irq; + adata->res[3].end = adata->res[3].start; 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 (IS_ERR(adata->pdev)) { - dev_err(&pci->dev, "cannot register %s device\n", - pdevinfo.name); - ret = PTR_ERR(adata->pdev); - goto unmap_mmio; + pdevinfo[0].name = "acp3x_rv_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 = "acp3x_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 = "acp3x_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 < ACP3x_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 unmap_mmio; + } } break; default: @@ -113,6 +137,9 @@ static int snd_acp3x_probe(struct pci_dev *pci, unmap_mmio: pci_disable_msi(pci); + for (i = 0 ; i < ACP3x_DEVS ; i++) + platform_device_unregister(adata->pdev[i]); + kfree(adata->res); iounmap(adata->acp3x_base); release_regions: pci_release_regions(pci); @@ -124,9 +151,13 @@ static int snd_acp3x_probe(struct pci_dev *pci, static void snd_acp3x_remove(struct pci_dev *pci) { + int i; struct acp3x_dev_data *adata = pci_get_drvdata(pci); - platform_device_unregister(adata->pdev); + if (adata->acp3x_audio_mode == ACP3x_I2S_MODE) { + for (i = 0 ; i < ACP3x_DEVS ; i++) + platform_device_unregister(adata->pdev[i]); + } iounmap(adata->acp3x_base); pci_disable_msi(pci); @@ -151,6 +182,7 @@ static struct pci_driver acp3x_driver = { module_pci_driver(acp3x_driver); +MODULE_AUTHOR("Vishnuvardhanrao.Ravulapati@amd.com"); MODULE_AUTHOR("Maruthi.Bayyavarapu@amd.com"); MODULE_DESCRIPTION("AMD ACP3x PCI driver"); MODULE_LICENSE("GPL v2");