Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2899375pxb; Mon, 18 Oct 2021 04:24:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytyGMgYPI9kNF2rxH1eT39IMEbC4nUEu4zBKzeXcNs7PwGBzOh5tAZl2NjIL9Nd7cZKrC7 X-Received: by 2002:a17:902:e846:b0:13f:551b:ba23 with SMTP id t6-20020a170902e84600b0013f551bba23mr26206164plg.77.1634556245936; Mon, 18 Oct 2021 04:24:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1634556245; cv=pass; d=google.com; s=arc-20160816; b=T2OBmTvmwmPZdD2hBIDIz+ymH3P90hVwzHFNaHnRkcBLe8ABZBIYpKAvAXQHcL4ZN3 4DxV1p7f6Svk/a0YyC0/AWH8vOO/nK2VmJnjpNsj80Ri9o9BWQ7WY5U5llv7pjSQuquo pKcMvnmjvqvNtpDzVh8ScEs3bA+c16s36p2PIfVAYt95GhohNg5bwwAQ39yUOcOSZw8S L+Xss87coMi2QpFwkY++UQes8X6nU2+LJoG06+RVNd1xs9tvPSXPRpsMXm2QXaD2cwAB nSo5PxmbHRSxKcYIp6qlzyLUcOd5pn/Zvkzhn7WfqiQmT/mMx/X5rtK18S4KS8V892iF VN8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BfBypYHqDkZQI1TcyN7GA6pZlno7kmEnbtz2fdb8ttM=; b=NSglUYVcBqjikeKk9a7SSYjNXfAQoqLvLtoFMEqwIufNx5bC6QsEx9rIhp3UWDM5Qq cCLFd5Uyt4CDAS1D7vfSTsoO/euGV+ykPk9to/jw0QwE/Wny1OL4m8RgTp/QiFLtz6rs gXG8do9VaAbng1gZcgn3YmqNuVoxvFQ33cI+9ILhGE18tmn1Uquic1s3/trQn9Wkv5+o VdE+V4lsxZ9siSkqxqQZC3guoOY5P/a2+Aq1La24FMpfsaIg/n7gwQ9HT/1TmhmlD0D7 bxPoFhwg7essQlYvuUARssyk7k5CuWTEkLoXotYmjtJ4ofkrx/GtyhVpSbDFtQNUMhEF hSPQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IwNpysQ3; 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 s20si19883604pfk.186.2021.10.18.04.23.30; Mon, 18 Oct 2021 04:24:05 -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=IwNpysQ3; 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 S230436AbhJRLYZ (ORCPT + 99 others); Mon, 18 Oct 2021 07:24:25 -0400 Received: from mail-mw2nam10on2066.outbound.protection.outlook.com ([40.107.94.66]:61281 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230476AbhJRLYY (ORCPT ); Mon, 18 Oct 2021 07:24:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hm6F4Yf3xVKWwY+0/o6m4dh9DVZNpUBWMOiHG4LYWcCsYgbx39O46dYICCIbZvgTH8Z11idop+IdK6HvA5/90EhCPOZZnK+CQF2CIZRwNNAwaAPadmjkSayb+wKkFBZeql5LyeDLAN58lxzs840RmSBqwXjo6KL5N6rucJH4u3q0/QZasmeDWbuctxZOIsuhQ/lw0M3B0zmXqvASt5cHWuwyeLfEvRE+2qnBk+Clpw8Ts5RnRg0ExssuN16QHmtk7DpNbw/I7dmXxOB2f1D+cxPJ4XEwh/6U7XpUttgms0A4aai6s933lgIqfokE4bPd4i5w429Hk/hLuLNWu3hjNA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BfBypYHqDkZQI1TcyN7GA6pZlno7kmEnbtz2fdb8ttM=; b=n/yWnVQ3PfbEC4NtBC+bDsq2hmQQ0NualyXDdqzGHQFcDh0k6A4ESaWKIqoH1sluLuK/O/BHTw4vqJ+g1N45aM1bLifUARJcbL1WIMx53zEziVz6Q6kJqJ9hp4DNZ0TuwhYF6xZG1UCcp0/MqYQMisSfBtO58ll5BKToyJff5ywCIy8U8Eix6Y25AYITZv+wFuT34CDIvVhB+oNcOU3DPqle6A9QRVp+UhTWkd7ALfoTsgx1/NNB3TeogXlmctL+f214ONi0RzLjzVnso1CMQXW3CKfz+Q76caOi6MZ+WS+1BURRXlkPHMITtmMNO9fqaq3BJYHFQsLE2DWC4m3AnA== 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=BfBypYHqDkZQI1TcyN7GA6pZlno7kmEnbtz2fdb8ttM=; b=IwNpysQ3GPyfavIffveVf1CC/FiCWLDakeelBQqgMLK+9aQJ7oH4ZwJ1E26//sxcuAwBtRKKNtAGQBGP/ru+7gBRTCdsoPujvLt5QizUA1zdSOUcUx0OORDKq5tBWLk7WrEdXimYkq2h64m+iHJhoL42EK3Ht4qCK8lsqJMqFOE= Received: from DM5PR22CA0003.namprd22.prod.outlook.com (2603:10b6:3:101::13) by BYAPR12MB3480.namprd12.prod.outlook.com (2603:10b6:a03:aa::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Mon, 18 Oct 2021 11:22:11 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:3:101:cafe::57) by DM5PR22CA0003.outlook.office365.com (2603:10b6:3:101::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 11:22:11 +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 DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Mon, 18 Oct 2021 11:22:11 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.2308.15; Mon, 18 Oct 2021 06:22:10 -0500 Received: from vijendar-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2308.15 via Frontend Transport; Mon, 18 Oct 2021 06:22:06 -0500 From: Vijendar Mukunda To: , CC: , , , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , open list Subject: [PATCH V2 05/13] ASoC: amd: add acp6x pdm platform driver Date: Mon, 18 Oct 2021 16:50:36 +0530 Message-ID: <20211018112044.1705805-6-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211018112044.1705805-1-Vijendar.Mukunda@amd.com> References: <20211018112044.1705805-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37ef4cda-9a12-48e9-03ab-08d99229875b X-MS-TrafficTypeDiagnostic: BYAPR12MB3480: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:38; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TF38WTZYFUEMa4V7+tJSOE757aX87HXgZdjmhuhhYjQ3HG7NxmqUTt7FdbWPEiOltZsici1Ig17YeNPlfnMWKxrS6Tnx1WZgx6bn753oBk5ZhcC+5gjejtX8xrdDf9Fod/Z9eY4zMjS+dXthU9a1CLjgp1X5VM864EAzfjIoW+an89CtzFDTfM0gaJL1A/CJu6V1PL1QrBdbhuVkfG7mBzVQZ6wAAs1VnlMFktXtH+OXzIsCuhHdbx/QlZV5hVsKthvrUt8zf62b7HclSOXPOrXIx3Jwm9qBA8oXkXacRqs5DPNhb6GQ4Bj6xUVLEuYAYSiZgwzrJiR+R9PBU+4Y40SUBV5+fQ40H5QDYPqIp+TIO24VrgtRcagEF/3ZCuQPbE+q3khDWqGH2iM4qUJsiJKEvzAJxlMTmMUpD258JoSi3LQqGnK9m2Nd/UqKGr0r5XMuL7C0ggFc90vv69VcTq31Ydg8xhN2l/qhoH3k5GZbRfeUtczntGXK8ss3q0cD4LqDQZ/U8QBdLlhSlUYxvcxziihasnroLoP/Pdz01lRvn4EKU3cznPNGQgfMSKUnBGCI1lcwFcqX23kr5ynnp2UgESArPg08BJFFm8gmoMjFAbXPxAUfu7j30ScZVd11s/VJvnPH2qh6uUA2cAgXlIe8/D0h7aB2Ve1TlbT1eqBU0MU6akcBNvwdi+dniUrtFG1SaurG+7AVQg2erl/0anbacSRqTVyG5DpI3z16UknNfV8sUqlnHlaPD7FQzrM+fOiXBpRaDMn88JangBSsYg== 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)(36840700001)(46966006)(5660300002)(186003)(47076005)(81166007)(2616005)(6666004)(8936002)(2906002)(7696005)(316002)(36756003)(356005)(1076003)(26005)(508600001)(110136005)(54906003)(36860700001)(86362001)(70206006)(426003)(336012)(4326008)(8676002)(70586007)(82310400003)(32563001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2021 11:22:11.1039 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37ef4cda-9a12-48e9-03ab-08d99229875b 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: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3480 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PDM platform driver binds to the platform device created by ACP6x PCI device. PDM driver registers ALSA DMA and CPU DAI components with ASoC framework. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/yc/acp6x-pdm-dma.c | 81 ++++++++++++++++++++++++++++++++ sound/soc/amd/yc/acp6x.h | 5 ++ 2 files changed, 86 insertions(+) create mode 100644 sound/soc/amd/yc/acp6x-pdm-dma.c diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c new file mode 100644 index 000000000000..75228ce74da1 --- /dev/null +++ b/sound/soc/amd/yc/acp6x-pdm-dma.c @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * AMD ALSA SoC Yellow Carp PDM Driver + * + * Copyright 2021 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "acp6x.h" + +#define DRV_NAME "acp_yc_pdm_dma" + +static struct snd_soc_dai_driver acp6x_pdm_dai_driver = { + .capture = { + .rates = SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 48000, + .rate_max = 48000, + }, +}; + +static const struct snd_soc_component_driver acp6x_pdm_component = { + .name = DRV_NAME, +}; + +static int acp6x_pdm_audio_probe(struct platform_device *pdev) +{ + struct resource *res; + struct pdm_dev_data *adata; + int status; + + 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->acp6x_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!adata->acp6x_base) + return -ENOMEM; + + adata->capture_stream = NULL; + + dev_set_drvdata(&pdev->dev, adata); + status = devm_snd_soc_register_component(&pdev->dev, + &acp6x_pdm_component, + &acp6x_pdm_dai_driver, 1); + if (status) { + dev_err(&pdev->dev, "Fail to register acp pdm dai\n"); + + return -ENODEV; + } + return 0; +} + +static struct platform_driver acp6x_pdm_dma_driver = { + .probe = acp6x_pdm_audio_probe, + .driver = { + .name = "acp_yc_pdm_dma", + }, +}; + +module_platform_driver(acp6x_pdm_dma_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP6x YC PDM Driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/sound/soc/amd/yc/acp6x.h b/sound/soc/amd/yc/acp6x.h index 63bdea3188ea..d6b2c70ce9c8 100644 --- a/sound/soc/amd/yc/acp6x.h +++ b/sound/soc/amd/yc/acp6x.h @@ -45,6 +45,11 @@ enum acp_config { ACP_CONFIG_15, }; +struct pdm_dev_data { + void __iomem *acp6x_base; + struct snd_pcm_substream *capture_stream; +}; + static inline u32 acp6x_readl(void __iomem *base_addr) { return readl(base_addr - ACP6x_PHY_BASE_ADDRESS); -- 2.25.1