From patchwork Mon May 22 13:31:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 97436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1454261vqo; Mon, 22 May 2023 06:35:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zP3n6A2FaqTLCf6pvFtz/TpqDijC7taLRa5wLHBQTa4Gj/pmtTO7JlHLHY8qyMrL0hTbm X-Received: by 2002:a17:903:1d1:b0:1a1:d54b:71df with SMTP id e17-20020a17090301d100b001a1d54b71dfmr11913475plh.0.1684762535261; Mon, 22 May 2023 06:35:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684762535; cv=pass; d=google.com; s=arc-20160816; b=HtP/jyJNdRBF3rr4aO/yBWdSnH+7SCJF4bRy5hyYPuKeVcxj9nA7fpXm0Fd9ooGyv/ Sf/FMUl5m9wGjJ5b8DpxuyppTVY7/DYLM0x2+IQv996xMjn6i7aDVks9TY+kSoNhDwM9 fGgvVDq+DbCEGljtBF44RAol5WNWfvobV+UERmkuis/Uzh183/qAznVSfkwvq02sbxYV ko9beGuRiOxS9mXyNA80xTjJg/o4A+bTlCp5x7C1RAc/qGz8LCVWMvKvoaZ7BQUw/6SL Ew9rmB9U6df9jhMCWBWf8/hlYrxf7fbuQFfvSV510tkjbHtXpmyIn8A4OMasBG42KJEY /WiQ== 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=oInXiL7CeKXlK9T9YeD3FEO2IDbCnscFb2CJJibNE4Y=; b=0wpLE/J9KF50f5R1BKHLuzszyd8bR4hyepzrTuFDeR8hLFWN6W4Djbb58LNwViLTkg Ms00C9Np040ToAG5TT3xKN0l8lbFLYHrO7aIRLsoX49rUvGgk/6SPOFra1HCSDC27kVN WsvB2ozwK+cZ5ztPIzYWlBz/wbJSGUuQ7DdkjvcaMzvd7il/eKzgj+PSlyCicW4GvvZV MMUWyAzHf33kw6uRgQyzKBCU8p53CQRuTmvJzdY2rfX6bWbZaCDCJuJNl0DFNcnNXOyH OFjR9kE0umoB4ER+d0AONza6feYkCpP3GQZukwdMVxVwMLXULJm2MZQyApdz+WudLM/p /nUw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2l5a+dMy; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ij17-20020a170902ab5100b001aadf9e2d15si4586761plb.491.2023.05.22.06.35.21; Mon, 22 May 2023 06:35:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2l5a+dMy; 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 2620:137:e000::1:20 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 S233577AbjEVN1D (ORCPT + 99 others); Mon, 22 May 2023 09:27:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234012AbjEVN05 (ORCPT ); Mon, 22 May 2023 09:26:57 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2069.outbound.protection.outlook.com [40.107.212.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CDC5B4 for ; Mon, 22 May 2023 06:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KRqnkgyTINQVTiwWBZhPOmFDnIIn9mbil6oslz9yreVXNRgVUSkFTYSAUMTi55OwhKT0s12UhmLYueoschEt+k4F78P11hNUKw/Ajmh8lXABZ6sIPfjm6CRfXNst84Uu4t+wfs06PoIlbiOhWKWR5G0QUgoq8j1CXMwPqxXZrtw+Pgc/ebzX5us8v0T8jNCGHQQnc9U0pTSIiMJSBHkLeIOxd0Kelz0ka/JtxWIzNShYIJcaFGJJt5S12wOS2f0ihZvD3whJ9fJ41Iq2/uFpX9f/Pmr1oRWapwDJiRcUSaboScwV7k2THo5RghknnQ3FfQxhgEwqCJypWpJFKcC3Vg== 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=oInXiL7CeKXlK9T9YeD3FEO2IDbCnscFb2CJJibNE4Y=; b=IeOluBde6JIkXwvUtYzlvW7aiYLigW8BpWkpp7V0Sf1iXMzTf2hQzWL8Vk+3rmLcwGwV8Rng/F31aHKx7bZT3E/gfMiCTjSdg+MlbwWJMcZklA1RUt1v8Ss4zftWGHu5fOaT7EoA7BD4LLCdnrm915r44g+y1PS+qbRteoxhej5UTnrIaY1bx48P7u+W2ipFRKMs2NmT1Lc0XSVJjHuSuA2mJ8kZ3ufC425oXcDlFCSulBtC+kgbASEoOD7FdqwNMSbpFanh5rxzEaizBC14YycUHnXyOIlqPOHN9HIz8pPsSfEd2aiKcWjI8rphPnTQRcY4ZmCXXOh2v9fqVHwV3w== 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=oInXiL7CeKXlK9T9YeD3FEO2IDbCnscFb2CJJibNE4Y=; b=2l5a+dMyVx+7Eu5TLBGPhPnA0s5cwmsOfNHeM/xnXwE5+Lm0RwrFkLqTCXxb5RsBoC9XutVP0Mwnxl7/ecAtDDYXRiCAix2PWd2WAN8OKuSOXRWLwd8Nw6W0efOY6xeAgX4mbJshC9afB9rIGG5fC32t1BeK1eGF8MN8L5vgnOE= Received: from SJ0P220CA0009.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::25) by CO6PR12MB5442.namprd12.prod.outlook.com (2603:10b6:5:35b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Mon, 22 May 2023 13:26:45 +0000 Received: from CO1NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:41b:cafe::5b) by SJ0P220CA0009.outlook.office365.com (2603:10b6:a03:41b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28 via Frontend Transport; Mon, 22 May 2023 13:26:45 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT003.mail.protection.outlook.com (10.13.175.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.28 via Frontend Transport; Mon, 22 May 2023 13:26:45 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 22 May 2023 08:26:44 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 22 May 2023 06:26:44 -0700 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 22 May 2023 08:26:40 -0500 From: Vijendar Mukunda To: CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , open list Subject: [PATCH V2 3/9] ASoC: amd: ps: add SoundWire dma driver Date: Mon, 22 May 2023 19:01:16 +0530 Message-ID: <20230522133122.166841-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230522133122.166841-1-Vijendar.Mukunda@amd.com> References: <20230522133122.166841-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT003:EE_|CO6PR12MB5442:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c958248-513e-4870-7143-08db5ac8305c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1llBD0xI4Q/I7qIF2RdhyPQgmR0EvRe61GzFx/eWNopoPZVzNqnb9ZKEfAAjo3kxGEETpwy3Bzg5vK8dcQrXJVzjB6jQ8yAWQOzAT3nFH+1zEbJ3R8WNswCXHPSNNjkGkcVXJFtQP5PGKLrR0w0VQ0wD0boMh40+xtewktlGwBIs5KZ5kPJZQYNMRPQrFPfXpGeDwUtVzhC4pEBjZKKCAzyiA1QvQN1DsyID/h6qvilSVO1nYn+09PJ3xbobA1lxKO6J7zhOKnt2AE51RNEKzk1KQIqDSdNjk35eCRijHSJknrUEHekthbPivhdBMp5fCZSpe1g+0IAFJMBMXyfBR6lsRBrjrfQ66fnHkdJg6hgQpTd0IwbFg6EwXsbtbvZ7ezy2F5WJl8QLqp7r3w+S5PLtLTtKEEigrYw2bmHcUC2Fw8NN4TwUvHar7t+qtCFraMANGllv91E0fg8svSqBFYB4D/WrNxgvGd8GWNEG3sThEAHRvtMYJk2Bp4u5kbjn+1XTluNM8Oe5KAjG/bEeZ3zDqHcmQrQwe0sA75SmxMEtAegN1i4WHyuP5df58SJyEQv7YYdxZ5A+iM6DFFcIqzgd4pBsUC3DLf0Ox4c0iA3I41kIwxdIivhsS3GOFJ6LvdH4nXFFB3q29Qe7op+BM98s7UTOEunsiFVjbhviJUiJRYJYpmbHteQrnZBQDmg6PLRCaSUW+HlJycatqBJkdnMikySwb8e0PXp1wH019+RfoG/vApU9zY7dj/YAme8SfdXEqDqD8YAmTonrVrayRA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199021)(40470700004)(46966006)(36840700001)(478600001)(54906003)(26005)(5660300002)(41300700001)(6666004)(7696005)(186003)(316002)(4326008)(6916009)(1076003)(336012)(8936002)(8676002)(426003)(2906002)(47076005)(2616005)(36860700001)(83380400001)(70206006)(70586007)(82740400003)(356005)(81166007)(36756003)(40460700003)(86362001)(82310400005)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2023 13:26:45.2818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c958248-513e-4870-7143-08db5ac8305c 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5442 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766601560006827711?= X-GMAIL-MSGID: =?utf-8?q?1766601560006827711?= 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 | 70 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 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 d296059be4f0..eec58da7ec8b 100644 --- a/sound/soc/amd/ps/acp63.h +++ b/sound/soc/amd/ps/acp63.h @@ -148,6 +148,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..f41849fd035c --- /dev/null +++ b/sound/soc/amd/ps/ps-sdw-dma.c @@ -0,0 +1,70 @@ +// 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 status; +} + +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);