Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1726983ybg; Sat, 19 Oct 2019 01:11:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIft6GT7Is+YR01WPYObKepoWR2UHm99qkuq0aC34oJdtnXqD4dZ4h/3hlVVfXf1vDyeXX X-Received: by 2002:aa7:ce8e:: with SMTP id y14mr13891657edv.5.1571472664146; Sat, 19 Oct 2019 01:11:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1571472664; cv=pass; d=google.com; s=arc-20160816; b=A/cENyH+llaS2NuNct/QTrsHUwX5hV6BpS1tVjwai55pNDC+6yVlZToQUSsXIyf/Jl f8sj+tYnDN47RxNktLB/vF79EpSqPgKKpUMqIKsvcBwWqJE+Pf9dEJEa0zXPQHkJ1wtQ 9psOjEzfksZMX6yZ1xfyxEevEUhvSphjil0z7KVKTFhP2U44C6j9zdfMtjZKLefnfSFA j5rTJeKIR+KtXZ9Iz10Il2xxTMtYtWJZHLv3kNh/Y970YQ4Yyr2Xb7WoT8VjGHuhlk1W /eEqWc4vjiiEi9gwWrgorCi+HSsID3HJw2lzt2yYOpRwCiU+vgp24dDvyln7uq/ORrZG uvUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:mime-version:message-id:date:subject :cc:from:dkim-signature; bh=bYbWF7THp7M8LiDv66VvQJKysD+JSWCD9On1hobs03s=; b=H9J9TOPX7CnMq2llXUINzO7liU8psJW0r4HzsJCx4/nE1+3ij8Nr2hGEApvm8GpbnQ CXszsN9Cf+yOv6pnD3OWhNaYyyeMJGzbCisSdqmAcbczxkaV1pgJTBEKlyYc8ljL+t/l PE5Bkq7QWJzcJorWKC8BphMqRB7m/Bj2YQ93IA1TWYazDKYP6vmuVyaqnMoD/aKag0XP 2mKBcAIh4hKqdgGHv4Ik6+bGb29EfMy8guQ/HdCTqFcrXasSPwXjHJIzp4eUPSz0KZgA 5X3dDPsH1g0oUrv17aca9lH09O6l+u3ByRVnkuGEkKiIv3/NIjoypwKLYPr7y4x6QC1h 3fkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=KW5fTSjB; arc=pass (i=1); 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 k18si554926ede.144.2019.10.19.01.10.40; Sat, 19 Oct 2019 01:11:04 -0700 (PDT) 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=selector2-amdcloud-onmicrosoft-com header.b=KW5fTSjB; arc=pass (i=1); 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 S2633338AbfJRKNa (ORCPT + 99 others); Fri, 18 Oct 2019 06:13:30 -0400 Received: from mail-eopbgr710087.outbound.protection.outlook.com ([40.107.71.87]:22336 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387545AbfJRKN3 (ORCPT ); Fri, 18 Oct 2019 06:13:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ae2r1HTfpwJKIggc74/I6emJoBR0mFY5bNlmgvJ+6dh1vhTsTxO0A5Hg40A2skNeiVnnFxwgOVwOfKAUkHiLwfv+OejyoRsUiR/1Fof8ysMxpUWT5eiqhves0yF8e4UgmYkZ6vi+zWTN0OdNZ8H5T5wd37JVG8x1A/dA2FOGkP2FxhrcOJT4OqeZrV1z5YDuZptAWEQKe4StprYAt/P9dbCLASu635sD/vRvoBfd6OghjqLX8NuVnFAn3nYrc59BUR43RpxKlVle3dKhTwVxthe0sZRoPTrhiw1NqV/cTyS5hl9FZTPn3Eoj9JaZDT/gc1oPA1shLdrmSG8S4yGeGA== 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=bYbWF7THp7M8LiDv66VvQJKysD+JSWCD9On1hobs03s=; b=n+e6ozPdSgrmEvtuGOfGIHFJTH2tYoq+yU8xSKhnCF3XK6Ps3ocjKgUfW5d9ufMVCukfVtXbYf1EkEvFQzfss4iGxrQ1/nfEc/iyU5xBvLnN7biRfpwBZxF3a7KTuAzCiTYjC4PMEEZpjvkdtZC7UknZuSUQ5HkJXTxTQQPX/dQZD7O4vOa7m0IdJP+daAJ7sOgwbFCn66EI7ECtizDsk02RuBzqscfZwv2TGNhfnKm/gsLqdwQt+i/UcVYedOPaDiStg6zGjPe+DKaYfEE8wtBhi38VuZWPP2lxWp8enGVnGj0AzV5mg0UPQdG0MnI+MNUiUJEI/ed55+gkkAfMlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.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=bYbWF7THp7M8LiDv66VvQJKysD+JSWCD9On1hobs03s=; b=KW5fTSjBwal6o4yaol4Fk9NHN5ShHy+YNP/qL60WLfq2gHo6kBLRkHQU8m4p13/sF3efWF7I640RRHatPLnLVfVCmQIxwolc2XfTbExO9g5iXnpJ7wIHCge3IMRH7LnWvQyCSg4tRIg0xFcV2qI8loVtWraaXS5WokL9Jzui7gw= Received: from DM6PR12CA0011.namprd12.prod.outlook.com (2603:10b6:5:1c0::24) by MW2PR12MB2553.namprd12.prod.outlook.com (2603:10b6:907:9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.18; Fri, 18 Oct 2019 10:13:11 +0000 Received: from BY2NAM03FT059.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::209) by DM6PR12CA0011.outlook.office365.com (2603:10b6:5:1c0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.20 via Frontend Transport; Fri, 18 Oct 2019 10:13:11 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.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 SATLEXMB02.amd.com (165.204.84.17) by BY2NAM03FT059.mail.protection.outlook.com (10.152.85.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2367.14 via Frontend Transport; Fri, 18 Oct 2019 10:13:11 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 18 Oct 2019 05:13:10 -0500 Received: from SATLEXMB02.amd.com (10.181.40.143) 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.1713.5; Fri, 18 Oct 2019 05:13:10 -0500 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; Fri, 18 Oct 2019 05:13:01 -0500 From: Ravulapati Vishnu vardhan rao CC: , Ravulapati Vishnu vardhan rao , Liam Girdwood , Mark Brown , Jaroslav Kysela , "Takashi Iwai" , Vijendar Mukunda , "Maruthi Srinivas Bayyavarapu" , Alex Deucher , Sanju R Mehta , "Colin Ian King" , Dan Carpenter , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH 1/7] ASoC: amd: Create multiple I2S platform device endpoints. Date: Sat, 19 Oct 2019 02:35:39 +0530 Message-ID: <1571432760-3008-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> X-Mailer: git-send-email 2.7.4 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)(4636009)(346002)(376002)(39860400002)(136003)(396003)(428003)(199004)(189003)(2616005)(4326008)(47776003)(50466002)(478600001)(6666004)(356004)(476003)(126002)(486006)(51416003)(186003)(26005)(86362001)(70586007)(426003)(70206006)(7696005)(53416004)(2906002)(48376002)(1671002)(36756003)(50226002)(109986005)(316002)(8936002)(8676002)(81156014)(81166006)(336012)(305945005)(5660300002)(16586007)(54906003)(266003);DIR:OUT;SFP:1101;SCL:1;SRVR:MW2PR12MB2553;H:SATLEXMB02.amd.com;FPR:;SPF:None;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67a21d9f-f867-4cb8-3b40-08d753b3c7be X-MS-TrafficTypeDiagnostic: MW2PR12MB2553: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:182; X-Forefront-PRVS: 01949FE337 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7MxOuWCpqKQcizlYsNh8CauH2I6e307L3YZVK8Lq5KnOatzWExup/7Txwo++5VLCaGkG9pyQlM5lqIGn4LzCU9A79bsLbHKj2S3Hkip+cbSco6BfQyeW/dkMQu3dMrTdTIT7hgr22fDEQHcYZk3dErpBYzCOzLjECvSFLskaVq10p8wMUooVEyBHGuTb2MvsGmxteR26tK8dKx2e2CxWLNyJFhh7QbWoJxGAFMKMfUfcvcep0LsdROiPRVw/Ivhp9PY7ewGKw+8/6kTunGiXq7n3wO4pKSayVrEGH6A0SpiQAb+es58OVqSHL3VILauAcLwRXhOeTrUNGxgBC6+zS5EKKrPoRMMfMHM4E3jF20N71jCRiST8UIQczcxsnn1AejRU2GMip4Azt4o1Yzl+dJHhGu5GUpbszxSsZX3GWa8= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2019 10:13:11.0307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67a21d9f-f867-4cb8-3b40-08d753b3c7be 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=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2553 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 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 | 83 +++++++++++++++++++++++++++-------------- 2 files changed, 60 insertions(+), 28 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..7f435b3 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,39 +80,61 @@ 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 (adata->pdev[i] == NULL) { + dev_err(&pci->dev, "cannot register %s device\n", + pdevinfo[i].name); + ret = -ENODEV; + goto unmap_mmio; + } } break; - default: - dev_err(&pci->dev, "Invalid ACP audio mode : %d\n", val); - ret = -ENODEV; - goto unmap_mmio; } return 0; 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 +146,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 +177,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"); -- 2.7.4