Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp10803pxv; Wed, 21 Jul 2021 14:03:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWxANWo44ATYmocmIc5iFEqIPr7jPeUlIoiqa1YR8wLQpLdx3uPgQg1KN2RehFBw43HVG7 X-Received: by 2002:a05:6e02:e82:: with SMTP id t2mr25381942ilj.218.1626901429021; Wed, 21 Jul 2021 14:03:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626901429; cv=pass; d=google.com; s=arc-20160816; b=cLeu0nJty6lku+wFelxTPbTfwvct8K9mzAuuw/XqpGFtT9QvERL1R9fHsKX9SA2+9X Aru+GWSWpwb/mvKmJjkwzUO9ieg+3+nR4/a05c4o+jsP2WJuBlKkyTmuooY9sfAo5r2M dfCeolDHC6RhA/j/XeUkIYoNfFDvgcnWQrYRzcRtB566Ms9qTT9sZf28QgZrFrLf1owo Aq80eXklX95OczwMQEsIjYhbGhG01J97sa70+tdRzZp3ByjHLBSB4beNfHNtPQPuTz7u fM+brplrdYyeOTXu5VT/w3rKNNS2mXw78RYsCqAGUkaP5+me7+ZbwS2O09wOlaCcFfk/ kFrQ== 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=+XISOAolU8i+aFK4hcHuxnITjp2m0ga7wCg0cmhI8+U=; b=RlVrLiZLsJVdGlvVt652MiCud8YEtVuvUhf9V15lpShEVdszCVcUwD2Ft/6ibtqDbF CRHSoFghDzmxtjWR2N5a8qYx9gjJHA+wSYeIiwbSrgx7Abxq0IU6fBtATVdKNw6fD2/z Xb9zFZd3DqOj5KABglXO9baUw97Br0y+4yXuuhHg0l0HHkgfmrPGEL8gJ/eDs+cnO3Gl wb7nE03nBy9FmO6jVR0YAcVo3EqgFrWhckYpmeXznpu6RySoa7uwFtlN9yUpWOpnEbCK Z/gMDFCQDVN93MO3itQTziYN+71op++a6gAW8sGm8uzwTz0aZfXTV8R0etFN9xS2mTdi jC+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="BsMas/fk"; 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 h29si18217851jav.81.2021.07.21.14.03.37; Wed, 21 Jul 2021 14:03:49 -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="BsMas/fk"; 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 S237279AbhGURHp (ORCPT + 99 others); Wed, 21 Jul 2021 13:07:45 -0400 Received: from mail-mw2nam08on2084.outbound.protection.outlook.com ([40.107.101.84]:52434 "EHLO NAM04-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237170AbhGURHo (ORCPT ); Wed, 21 Jul 2021 13:07:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuAbCu4onoA1f/+PB2RWAo/Dqz0fw0NuX3EsEx6ylwVNGtntBqr8Y4cSnjtBuFGqsfUouiJo6OOuGn2GnD1NRmmKAPSBzxBflDMPUIB8ZifINqzPwfftaP2dBrWHgMARPmB/TClDx/VOjxOf/N7WAjhFAyAYy6H6rxrNXVVeApLwmwLW2N+iSbXcbEDcZG2cQgngxTkObxCYcDU2ysfdSyy1sIMpKcPhneHazY+1nxC0uB+N1kW59yC1FHQb8btDOjB+XBgKjJ82UtiKWn/kZYykqiKar+XzxGUR7FMVxRyqUuBjIhLjw5uQddGFELwokb/M7CyaImhCkLEiu415vA== 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=+XISOAolU8i+aFK4hcHuxnITjp2m0ga7wCg0cmhI8+U=; b=Iz//SykkPfQSVHu3xJc6P8rzDEiUmael0Palfyu7orkOQ9ffalEeXIMihYyIPnaff7kTT8C2TBgzKWT/7NkYm0DDFXPOiEVJJUuCMuSypVPsmGzZW211eV9C8aHtOg8QzfGCH94Ihx68+YHCvvK1EtAeIOLOLB/F9oh7sbtq5SmOLbPEeiaFzzaZaHCfoeGGOmofa0oZTr73nVBwTC576LzrF4aCywson0W/9yrIP3A81RRmxIuofiUXTWZq9+Vzi0z3cPnWkApS3toB/SSi5Z8ZaUMJMbbKOKSkn87gNiDntmTM+D50jdi27TvALwrdFvkv2ahrLeu6Q8exa2lmyg== 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=+XISOAolU8i+aFK4hcHuxnITjp2m0ga7wCg0cmhI8+U=; b=BsMas/fkQADnMX9SrH+sWAUMtZcf90S9HCJpu5i79bFA2Z0SW8gKjiQS/UrFeIseMAEPunFkXykX3lKHAo66UHuPZAwOsSFwBTdTzT+E3TO2eaVQoUTw7gXv7SkST6yvg99Lf7pl7iN3ldO66qQKpciaT+rh+csoj4f/qHin/8c= Received: from BN9PR03CA0245.namprd03.prod.outlook.com (2603:10b6:408:ff::10) by SN6PR12MB4669.namprd12.prod.outlook.com (2603:10b6:805:7::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.31; Wed, 21 Jul 2021 17:48:18 +0000 Received: from BN8NAM11FT042.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ff:cafe::73) by BN9PR03CA0245.outlook.office365.com (2603:10b6:408:ff::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Wed, 21 Jul 2021 17:48:18 +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 BN8NAM11FT042.mail.protection.outlook.com (10.13.177.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:48:18 +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; Wed, 21 Jul 2021 12:48:16 -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; Wed, 21 Jul 2021 12:48:16 -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; Wed, 21 Jul 2021 12:48:12 -0500 From: Vijendar Mukunda To: , CC: , , , , Vijendar Mukunda , Liam Girdwood , "Jaroslav Kysela" , Takashi Iwai , open list Subject: [PATCH v5 05/12] ASoC: amd: add ACP5x PCM platform driver Date: Wed, 21 Jul 2021 23:34:21 +0530 Message-ID: <20210721180430.11571-6-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-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: 65af3378-21b5-43cb-1e2d-08d94c6fb97f X-MS-TrafficTypeDiagnostic: SN6PR12MB4669: 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: Xei1twDXkEoZSQ9Ri6g9Bzu+TGTSKRJqAC0YCdsicwVRrKSJXCo4l+hTiuDMW3yhVenlensCYPx/sFMwbsz3zMQhPHOjKfq4OptzCOC8djKZB+UYtdcPNCVfAJ9iiofblbWRf0Z92v7ccDD/a3oWBq2OGLfoGwJlUZae0Z8SmAru7YzLMWrtxd+EYuBohLOJrZ4QtxTZw0xfCXSW0GtMhYSDnQCwDQV+IMKgmDW/8IH1i4b7BGoTAnlo1CwJeHYpn/wgvws9t1hWObiyZhIXo1zJE6mxAqXcoZxAG+2xu5E7Lwei4ti6cnYiiPWUwBuMLNKTLjoaYtpEoyvMd1pHIKBSVeXiKwGGts89y/4VYozFnl7hTxlf0SqK0qE7arrneUaTLJJWpkcqmOjGKJZGiVwld6HBsNlyIBJw/Hydye64txaskBGkT7Btu+DnW2gOVKzX8SWHaPV0EvvUxl/7GoztvsKHqV+DbDEb4tU7wbT3/OPP8refCpFdJ7FfEpU5EiJxEbnGOb+oojDOm+9FMWi/W8TSFms2SiRPCRtPbnKmsuImNng/IZFoygU7V78//fxP7ZsES+sXg+9oeTHQqd1Tv01I3BaYX7iL6KMh1NzAvM7ed/uwjWuwxdz5hT0pdkzuyE8TtH1jd9r2oh2bzlOEG8SygwIpkf2gSk9ozU4+Fh+Cx6gNS2z9MKeZFIUQRoeiVn5E79liBBX/bSdj9bYJeGQhuZEcD7u8X71wm5DXWznz4pHs54GdEza3DiaD 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)(396003)(376002)(39860400002)(136003)(46966006)(36840700001)(110136005)(478600001)(81166007)(54906003)(70586007)(70206006)(83380400001)(1076003)(82310400003)(4326008)(7696005)(316002)(186003)(5660300002)(36860700001)(26005)(82740400003)(2616005)(2906002)(426003)(356005)(86362001)(8936002)(6666004)(8676002)(47076005)(36756003)(336012)(32563001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:48:18.6302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65af3378-21b5-43cb-1e2d-08d94c6fb97f 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: BN8NAM11FT042.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4669 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. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 72 +++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 76 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..60d752adfb81 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -0,0 +1,72 @@ +// 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 status; +} + +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 32e5db10c1c8..e450fb32d680 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -33,6 +33,10 @@ #define ACP5x_I2S_MODE 1 #define ACP5x_RES 4 +struct i2s_dev_data { + void __iomem *acp5x_base; +}; + /* common header file uses exact offset rather than relative * offset which requires subtraction logic from base_addr * for accessing ACP5x MMIO space registers -- 2.17.1