From patchwork Tue May 16 10:35:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13242905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 14230C77B7F for ; Tue, 16 May 2023 10:32:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0C24510E; Tue, 16 May 2023 12:32:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0C24510E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1684233177; bh=nVMbEER0ELf4mzQYGmFTSeUYyKoh+KoblhmmSSj5qqo=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ELQNCJnsD2uu9usFdoZKoCCF3loWRhtzNKh+muEJlKLIrSXkU8jV6enpS45RkLxVj HdvbVYcUh4PMTXrarzw9T3zfkPCDmfgpHZ7oiP7lDSW9R3BDeJapF8cLYRFGybOrtT el+NqdKGByCBt79wJCSQqJ2yXWciqJLX1sifGlM8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2C81DF8058C; Tue, 16 May 2023 12:31:13 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id AF923F8058C; Tue, 16 May 2023 12:31:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 70675F80567; Tue, 16 May 2023 12:31:08 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20601.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::601]) (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 4FC5AF80549 for ; Tue, 16 May 2023 12:31:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4FC5AF80549 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=b2s82C+D ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nXQixsyTj5T/BwtKM/FC2YoY6RJi/8EgTpoNfF+0xXDplCDm8lPnDgmwUZZg1bo8dUKpLbBAEz/kWlS/no9BhThFPW2hDZNtyJ87mxI9K748hMXvAcjqYurL35fL5sz7f+IuyBBMJkohAyRfqtYffUizCQHoMgdBCDJbgMT1bYAYj4SbTE2TVJgNE/TNU+sHE0utmLjc1n7YbI+DfhMHi1Nh94J0OK1C4rroun8NtGLm9F85ue2ARETGImt1uV393/mSPN7eKQU68Q4MH//GOfrXsniTIO8vHqHAgyRD73P7MFAtp8vN3rVZ/qJkBsgNWIMsy9QCp/lgOSHyJa2aWw== 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=HmRtY0Txh3nYKUzW8rrx2Q5E0dHFV9b/LKE7cEM8gJ8=; b=PzxZ1NBc2FvBS/FWf/vb2BjpaMMk32+R/zkbTxlPFLn27A1EnGGVtqDcRn20uZv3mwm/dNV2apE9R8CtowgrOUP6I+FWYbELXRg3EzU7C/h4QjAop9nUhk+WX0MBqlqchkfhpvwLvUotDpio9AH18JGDI1YVRnXp+FJbFkYpDTC+Ftg5D3yUR5IImxEAN/iItx7LjjDAfVZWuLSIhEPB9/cc2lgbeelqDT4NlqvbfIdYx4e3OjmSbrtTuP5xV1jdv9HJYXNIk6RjyIwAlS8rRXd+FTA6wg8Gm9I/ozD2WjLPobOqVuk8T0gZTwzYlo+Zn14KI6ZJbCNB6nHtOXfVpw== 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=HmRtY0Txh3nYKUzW8rrx2Q5E0dHFV9b/LKE7cEM8gJ8=; b=b2s82C+D2CXvDszVmzyL0RfySmNEH7s/0ksehkZB+ATROiUyhjQl4abTvG71OxiL/424c28uJcDNz7vzrxCfDMaw7iVpvlTTN5gix1Tquv1RScZEfXzz7tJf3Aad6jIJqKDwWxQGG2j4uCUHsBqWzJq+zJYginIMRwMbaSj6nSE= Received: from DM6PR05CA0065.namprd05.prod.outlook.com (2603:10b6:5:335::34) by SA0PR12MB7463.namprd12.prod.outlook.com (2603:10b6:806:24b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.33; Tue, 16 May 2023 10:30:57 +0000 Received: from DM6NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::f9) by DM6PR05CA0065.outlook.office365.com (2603:10b6:5:335::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.14 via Frontend Transport; Tue, 16 May 2023 10:30:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT029.mail.protection.outlook.com (10.13.173.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.15 via Frontend Transport; Tue, 16 May 2023 10:30:57 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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.2375.34; Tue, 16 May 2023 05:30:57 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 16 May 2023 05:30:56 -0500 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 16 May 2023 05:30:52 -0500 From: Vijendar Mukunda To: <--to=broonie@kernel.org> CC: , , , , , Vijendar Mukunda , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "Syed Saba Kareem" , Mario Limonciello , open list Subject: [PATCH 3/9] ASoC: amd: ps: add soundwire dma driver Date: Tue, 16 May 2023 16:05:37 +0530 Message-ID: <20230516103543.2515097-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516103543.2515097-1-Vijendar.Mukunda@amd.com> References: <20230516103543.2515097-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT029:EE_|SA0PR12MB7463:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fe1cb05-6305-4579-a387-08db55f8a2eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xJyfE3S6fealWsf5uHTUcHzc5COhLLVldu6cGAfh9bl5mrf1p7r2RryyH3m0AgydSY3ypA7qLKYJB1pVc/hW/Q9UaqoZsYMn8iOcF1Aou8cJBMnk81hpqoJb++JZuegOrZCDt/9kfrjDrcucEaDDtBfTRK0QjKcIjjac6iM964eSKz1ab3DxzbnC3MyGMM/4YpBL28qSJ+VaXjwVFdRhSTKxidjH1vlHKDzYAl0hTqXb3YsGprX6R3xp/asYTwZM2rRuF4hode5gqSD528z4vRawRXv288XfASZxFwTHAnc91/p41p3L2MZX+0TyCgb3JU0Mf5Rfxxd8n+Y+nfSw7MvMscfSpUQFbi1CcUuvW2n8S+hivk05dTBo6QIwWgdBLxYoqaK1BQB2DpQ9sHrZwXWyhKN4CQaQgR+F12/Od29XPedyQYm2AJyvfubUIpue0y8byh5OgcQyqFint2JgEJcLwW1z76S40MYRq25ENoEVXT9y/MUTtdtIh3CQ7EPwiaTBTIMBIgve71BMcflZv7e1nh8I5H5DbW4k/kzhuwL6Vd61lOIE1QuFrPcX6H2Q4hQs+sXDA5dX7oyxAq8Z/K9x7bI5poYa1KzSuw2IQ2q7Vnkg6XIUwt8wN/mFIRP0jpLJIzTWjmWtKqBRj3tw9BSpQdvVelgeyLgjlsiVEuNy2o8JPQGz05e+i4ztdcwsJqu01Pl4DMC6QJrgz/IAqxwa7eeGlhC/0KV0J0TCa8gXg8rRgdQ6sEb/8Iq9Kfwzyx7cTBXGeFJCLduW+hdOAQ== 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:(13230028)(4636009)(136003)(376002)(346002)(39860400002)(396003)(451199021)(36840700001)(40470700004)(46966006)(36756003)(86362001)(54906003)(316002)(70586007)(70206006)(4326008)(478600001)(7696005)(40480700001)(6666004)(82310400005)(8936002)(8676002)(5660300002)(41300700001)(2906002)(81166007)(82740400003)(356005)(2616005)(336012)(1076003)(186003)(26005)(426003)(36860700001)(83380400001)(47076005)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2023 10:30:57.5878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fe1cb05-6305-4579-a387-08db55f8a2eb 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: DM6NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7463 Message-ID-Hash: ISN3DWZZDIERIG5AH5LP65GYZAMDSP7G X-Message-ID-Hash: ISN3DWZZDIERIG5AH5LP65GYZAMDSP7G X-MailFrom: Vijendar.Mukunda@amd.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Soundwire DMA platform driver binds to the platform device created by ACP PCI device. Soundwire DMA driver registers ALSA DMA component with ASoC framework. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/acp63.h | 5 +++ sound/soc/amd/ps/ps-sdw-dma.c | 71 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 sound/soc/amd/ps/ps-sdw-dma.c diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h index faf7be4d77c2..f86c60cd1565 100644 --- a/sound/soc/amd/ps/acp63.h +++ b/sound/soc/amd/ps/acp63.h @@ -111,6 +111,11 @@ struct pdm_dev_data { struct snd_pcm_substream *capture_stream; }; +struct sdw_dma_dev_data { + void __iomem *acp_base; + struct mutex *acp_lock; /* used to protect acp common register access */ +}; + /** * struct acp63_dev_data - acp pci driver context * @acp63_base: acp mmio base diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c new file mode 100644 index 000000000000..0d0889842413 --- /dev/null +++ b/sound/soc/amd/ps/ps-sdw-dma.c @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * AMD ALSA SoC Pink Sardine Soundwire DMA Driver + * + * Copyright 2023 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "acp63.h" + +#define DRV_NAME "amd_ps_sdw_dma" + +static const struct snd_soc_component_driver acp63_sdw_component = { + .name = DRV_NAME, +}; + +static int acp63_sdw_platform_probe(struct platform_device *pdev) +{ + struct resource *res; + struct sdw_dma_dev_data *sdw_data; + int status; + + if (!pdev->dev.platform_data) { + dev_err(&pdev->dev, "platform_data not retrieved\n"); + return -ENODEV; + } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENODEV; + } + + sdw_data = devm_kzalloc(&pdev->dev, sizeof(*sdw_data), GFP_KERNEL); + if (!sdw_data) + return -ENOMEM; + + sdw_data->acp_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!sdw_data->acp_base) + return -ENOMEM; + + sdw_data->acp_lock = pdev->dev.platform_data; + dev_set_drvdata(&pdev->dev, sdw_data); + status = devm_snd_soc_register_component(&pdev->dev, + &acp63_sdw_component, + NULL, 0); + if (status) { + dev_err(&pdev->dev, "Fail to register sdw dma component\n"); + return -ENODEV; + } + return 0; +} + +static struct platform_driver acp63_sdw_dma_driver = { + .probe = acp63_sdw_platform_probe, + .driver = { + .name = "amd_ps_sdw_dma", + }, +}; + +module_platform_driver(acp63_sdw_dma_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP6.3 PS SDW DMA Driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME);