Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1370128pxv; Fri, 16 Jul 2021 07:54:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb8Pxy/xd1YpQz3+H1n6Kn5L4l3zNNbln0XKX7S8H0PqQUe5G6lLOB1/UBctR7bmByIdl/ X-Received: by 2002:a17:906:b0c1:: with SMTP id bk1mr12132267ejb.202.1626447264215; Fri, 16 Jul 2021 07:54:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626447264; cv=pass; d=google.com; s=arc-20160816; b=jLuOo2PGla5iZeFpALk6rvJyL7fQlI3k6dczlsdNOD546NVI6pZQsiQuhkWZGlJghy 2YRudquLyRcHdr79oHroeNMPg6sF8Uw/Jep7QMBc4ifzXHIQX+i+2suepIqjcHNLLC9H awF7Pb3GyZGbn8Jvw/a6U/iXXZFVdBocpSX9mh1z8cKxbPHRFC1OJXc3+OtNbbw+CY4L KjnsIz7N2O96QSsOoj1K2FhIDXpheLjqaQYRrqgGFRAjSEGup3rEMkMch6wARnpsovel RuJ75fzJTL9eIinD5UL5Y9QAsOGIqtZfGKbm4ntSggWcUrjRhjudWPrAcIPDtqEWSkRT IY0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zaljDr17sNECrlZi387V8jBinuF272xJ1/DIjDMp4WQ=; b=ixO6qL7Bhdj0DDp4M22Su2XF7La+LpA040EzKEAY799wdfD/Tvx1CCv85Bo1cNy4I+ 2Z2Gchm2Vx+krGG2v8TyMtNjtA1OJfxoa4qAnw1TVi1kPlk5zkGwE7Q32jPkqoYO2BQD I4IXM7JHjrxwwSpSP+D7gzgKe4cPPJZOGJ7dxlnVsMlotSp90lKumjABz9QviNESP/wC y47JC+u4eMNm8ZATu0M0esMvA7TJ8tgPfRRbbz2lO8jqctEAhyslbzUD7MOS4NF25dI2 GxnO8kCOd0mFeEgSLWQl8XNDcrYHRYxVS1kj2AehKehpqwfD+uCOQq2BQ6JpM0S+pc7v hQEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NBqXV+T4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx16si10961267edb.96.2021.07.16.07.54.00; Fri, 16 Jul 2021 07:54:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NBqXV+T4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240548AbhGPOzP (ORCPT + 99 others); Fri, 16 Jul 2021 10:55:15 -0400 Received: from mail-bn7nam10on2051.outbound.protection.outlook.com ([40.107.92.51]:3041 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240205AbhGPOzO (ORCPT ); Fri, 16 Jul 2021 10:55:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C4l3ze421vs98frlIhQTPKcXwRd/kWG3E9bhmLcO1tH/KoZ7ruE+iQzAjvd7xZNdP0kOKjIudI+iNftmisOjjTWGHgVgJ+YvvuDYEJgk3+sr9parPTquN1TmOg0Vw72SoMQ4G6uonFqsVX+AkFJTBg8tcWgx7kIdwK648BwRY+5ZRm1n3m2TCD8rgw8ZCCt5TMOJgtW1PaLVQKQD6OMR/9r1zQ3UhGyh+3VhAfhMKzc4keMA4xEn+H94mS+G+4l78uI9xSpcV5xIYHxTHYztLFvallpe+fRRxGSorP4orwVyxzCuWU9fQXJ4c9thGY5dERj944OQ08dtGi56W41e4w== 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=zaljDr17sNECrlZi387V8jBinuF272xJ1/DIjDMp4WQ=; b=GWelYcO/ASF7139sKywCHPYcqTtmK/fWlhnJCr0S6wiUaKlo1WxapVEWWNbkZU1xEipubX9C8pNnOkHCsJIRH3u/t1RuXaDy4Gtl/FoPyOE4m3DI8tohLXIjZG2RjBUIcZU7rcmXGlzxknLQpafnOeokLLfPZJGnDQdi2WpGKGx+dWmk6sa8qRSSJH2nrxC/xF+cxmUccoB4yNdY96DNhilpUkh/ZHiW0D0BtDOCHtZjvoi98kKNXTm+mBtuBrYshs+u+XBKrYj2OHACiSJBJY/nhlHP+/+P39tvgkI75JdvWoKnIvnqVUnrpq4uhHGx99tUWYp3r8fCJM7dhsJsmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zaljDr17sNECrlZi387V8jBinuF272xJ1/DIjDMp4WQ=; b=NBqXV+T4wISvIDLIJ2zZ4M3wg6fWr5R43wFfJqEUUYHhnHn8CuUFomLK8iTaAkbOP5bvlTPr2orCt7id7ZI1XneX5DAuLaCXzhko5J+KzuI7GK4vQsuN2tuxNTIzS3N9TDpe/aFETcStzpZbsJ+R+AJOKWCQel/WDr1TOpgKJNo= Received: from DM5PR08CA0048.namprd08.prod.outlook.com (2603:10b6:4:60::37) by MWHPR12MB1485.namprd12.prod.outlook.com (2603:10b6:301:4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Fri, 16 Jul 2021 14:52:15 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:4:60:cafe::2b) by DM5PR08CA0048.outlook.office365.com (2603:10b6:4:60::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Fri, 16 Jul 2021 14:52:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Fri, 16 Jul 2021 14:52:15 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2242.4; Fri, 16 Jul 2021 09:52:13 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2242.4; Fri, 16 Jul 2021 09:52:13 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Fri, 16 Jul 2021 09:52:05 -0500 From: Vijendar Mukunda To: , CC: , , "Vijendar Mukunda" , Vijendar Mukunda , Liam Girdwood , "Jaroslav Kysela" , Takashi Iwai , open list Subject: [PATCH V2 05/12] ASoC: amd: add ACP5x PCM platform driver Date: Fri, 16 Jul 2021 20:38:02 +0530 Message-ID: <20210716150809.21450-6-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210716150809.21450-1-vijendar.mukunda@amd.com> References: <20210716150809.21450-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0120581-a7c4-4f79-72d3-08d948694d20 X-MS-TrafficTypeDiagnostic: MWHPR12MB1485: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L7WkO9oFMhEFPnCoh+I3hrVobvFGfwiv3ll7G9GoFcCOGAPyqxQSfYPtuLtwFWfZislFkYgwvPhS914h5S2/sqtDRRj1Bpzzz4Jdww+ryItcxJ4emFiY4d1IkI+HQp2xmpn7SB8XZ2blug9D3X41/K+OXT4DKHMGUE/Eu5efBG32zf20pNnt0CfGx29G1aZ9tIsMpXAJh0swIIFeUxKwyXtaguUzbllCMeQ2Z/do4eo8fBDKn9AKPjmY+y1USu/Udm9F9lry0cSoqb0WeurlxZ+5iE6Ne9/DotGJGCFIxJg3iU2OR3ZffqLRpCxb1BtJgwC+ZDXpB7PGUdkZ/hFKsrlLwNmbWFekwxvPFj0BhE8kNw7thZAEdetMLRkrTntwM1Z2LAzCyDmkqNExDI94EiAaNCSqBCd2YryzgSprYbK/3ObTQNYHN0LswforuLk9k3oryVJBCCNGklnXQLl316xvmLsftlnx0fubC1G3W/hI3oaRs2WGVDboj852iGO1vnFLjzWWXBzTSQsTOen8pbcKB9o+DBZTKslVcDvOeu7Gg109FnqOHlJj81BSPwIuV3yW+gDxMakj/TRRiUAWyMngygablo67hzOtp5iTYIRuzMjewgFmNbrSbx0fYlYy4fzGA49rImqdF1QCi8GfOUNMvOhZFPOHZjR9s2LTwiBKIAzOjP8KhxWt4dRZBnkNQ8HE2tBJ8OAuCp3M7AtCHqg44SGKhlAGIIdkxZ/TCMLaY/F4BaqMqHWkGEw6oD99 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(346002)(376002)(39860400002)(396003)(136003)(46966006)(36840700001)(4326008)(426003)(44832011)(2616005)(8936002)(1076003)(478600001)(8676002)(336012)(316002)(110136005)(70206006)(6666004)(54906003)(186003)(26005)(356005)(7696005)(5660300002)(82740400003)(36756003)(86362001)(81166007)(70586007)(36860700001)(83380400001)(47076005)(2906002)(82310400003)(32563001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2021 14:52:15.1344 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0120581-a7c4-4f79-72d3-08d948694d20 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1485 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PCM platform driver binds to the platform device created by ACP5x PCI device. PCM driver registers ALSA DMA components with ASoC framework. Signed-off-by: Vijendar Mukunda --- v1 -> v2: drop acp5x_audio_remove() API --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 73 +++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 77 insertions(+) create mode 100644 sound/soc/amd/vangogh/acp5x-pcm-dma.c diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c new file mode 100644 index 000000000000..2ff11bb88305 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// AMD ALSA SoC PCM Driver +// +// Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acp5x.h" + +#define DRV_NAME "acp5x_i2s_dma" + +static const struct snd_soc_component_driver acp5x_i2s_component = { + .name = DRV_NAME, +}; + +static int acp5x_audio_probe(struct platform_device *pdev) +{ + struct resource *res; + struct i2s_dev_data *adata; + int status; + + if (!pdev->dev.platform_data) { + dev_err(&pdev->dev, "platform_data not retrieved\n"); + return -ENODEV; + } + irqflags = *((unsigned int *)(pdev->dev.platform_data)); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENODEV; + } + + adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + if (!adata) + return -ENOMEM; + + adata->acp5x_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (!adata->acp5x_base) + return -ENOMEM; + dev_set_drvdata(&pdev->dev, adata); + status = devm_snd_soc_register_component(&pdev->dev, + &acp5x_i2s_component, + NULL, 0); + if (status) { + dev_err(&pdev->dev, "Fail to register acp i2s component\n"); + return -ENODEV; + } + return 0; +} + +static struct platform_driver acp5x_dma_driver = { + .probe = acp5x_audio_probe, + .driver = { + .name = "acp5x_i2s_dma", + }, +}; + +module_platform_driver(acp5x_dma_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP 5.x PCM Driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index bbf29fd2b12f..d2853738eb17 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -32,6 +32,10 @@ #define I2S_MODE 0x00 #define ACP5x_I2S_MODE 0x00 +struct i2s_dev_data { + void __iomem *acp5x_base; +}; + /* common header file uses exact offset rather than relative * offset which requires substraction logic from base_addr * for accessing ACP5x MMIO space registers -- 2.17.1