From patchwork Mon Jan 22 09:24:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525008 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92DDE39FC0; Mon, 22 Jan 2024 09:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915503; cv=fail; b=DeYYpQAAOS6/0iVGJ4bcC1aKv+mdOG/viRfBxbJKT4+x7keRt2wFMeQaccDSJBHMABMLddaDAhF64S2Op9gxKP9oESkPqdeW0cYni4aDkjsfjDLyAwz36B6raXBpudLw95dfAdAhX4pjq0X0NvJBpowvm5k+nkM/b7AaEsyvOIA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915503; c=relaxed/simple; bh=c8pyGPpBIPuuzo3IuY/HnWAHT2Hq/EMvv52T1XmEyBE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=swAxJ0ok3pCfRDGyB9kyqmbO1AuF9xceTW2W5elHjGSXTHaOlcQb0HMsiaufQnonSH0qWjlEvKKVs98CelBKp06rGqt2/ZaH71bTj5Atog6gJEo0XxCWlGXTH4ttYstMOr8wDRKL5LnXwaKtUSqNBTqoNk56ICJiYMXTsBqug2E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=ccy0XWIH; arc=fail smtp.client-ip=40.107.237.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ccy0XWIH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jtdgBJI9GKUgbCUz+av+Bn3DDIVgIaZLO6rRd0OPpbWsBRZmcOoESWg+XvpluwhtDD+9m6Cs1h3XaAv0DbuQrMse0PTaT65v9CxpUdQ95jUp4Iudz3u/XWiDOyts/KvOE5kNjQ7rzW/50YMiMxxeLRgt4d6HIWZuvBDm/0xbLwu+ckQFF73f4SZHg98zb2qTPYoOyY3ldRBij8HaDOaP3Yb2pghWgkQmEDFxdL2A0aYD5QQ8ppibQNgwQ9xN5L/uRLwOmI7rpz+eYquoQKDAbkQoxHcDtc079A5KNJGfu2zAOW1d3vH1uNwTmXIJzT2ImRGwdLLptOKMd3Hlc1g5Qg== 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=fOhMtVCesN+ur8N0oWmzRRCxIH3/QbXj3Wrd5lQ7D7M=; b=DqfwXob22F6tejRoTHsWwOuf9R24lL6FllbnharuTTVNWeSXFJBSiEudCAmoTP2tyJe3DC6Qs8VGn3mR0VBz88oFGeVPyQ5Iqhbr0yWIdjNJ0i/GFtYYWk2gS8m+pIkNzWs3Va8AxcRBVQgyR2agLzuBylabt71NdxbBbqBfnhHcVBFUxv3iZJ7yN1czIIeOvK5TkzvQfeIbeUd29R1Eal/NdL4rZdDzFBcrkk9Ux0ofRXI7zYgEhDBKkd+H6F2kZJK88kpThaYQ426VUKd8egjTVye/0pYGKgOY7tu9RMpwNvKaCBkpYtsz2cRePh1+Ltt3YAi+P2ZGPNHG5dgkng== 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 (0) 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=fOhMtVCesN+ur8N0oWmzRRCxIH3/QbXj3Wrd5lQ7D7M=; b=ccy0XWIHwdx55C7icibTtE2g1HdxbICt33l5qv7URqjSRxTNMaxh8hUpj0CFb0bDa+yJX4tXcAdI68zRA64fEnCpV1UWJv4fNswmzZJVoikTYLsS51GAtj/Em4aLndaxxFZL6SEdWa25JyT1AZ1B0nszFEfjxq6UfWbuP6gAlI0= Received: from DS7PR03CA0248.namprd03.prod.outlook.com (2603:10b6:5:3b3::13) by IA1PR12MB6434.namprd12.prod.outlook.com (2603:10b6:208:3ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.29; Mon, 22 Jan 2024 09:24:58 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::fe) by DS7PR03CA0248.outlook.office365.com (2603:10b6:5:3b3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34 via Frontend Transport; Mon, 22 Jan 2024 09:24:58 +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 CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:24:58 +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.2507.34; Mon, 22 Jan 2024 03:24:57 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:24:57 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:24:52 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Sanyog Kale , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , "Syed Saba Kareem" , Arnd Bergmann , "Marian Postevca" , open list , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." Subject: [PATCH V3 01/13] ASoC/soundwire: implement generic api for scanning amd soundwire controller Date: Mon, 22 Jan 2024 14:54:23 +0530 Message-ID: <20240122092435.3791175-2-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|IA1PR12MB6434:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b101eb4-cef1-4455-b6b9-08dc1b2c00a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RX9tVpMF6yuX5/957+0a6Ey/qjvo36YyOGglkDZCAD0oaUtNdv4rImteq7uAGzwNg6Mx9YrH4Ar4AUqxMstPVI3I28D2l2RySTEOUPnPLv9AG49i4UGhYoHwAsGSj0BeDjHpFYmkz5ApyGCxQVNjchTZh+h+hOEhi0NDQ4Q/TReqUOGcniLsI1WIa3/8dPbm7L/ANmFWW+sFkJjyR7RBAtHugFZ/urX1ANCp2lgb4iszPKOtiRsyBq5NW5ur6mLQBAxbsrJcY8gjQZQLFJRbxNg60LeDBZ4iMP5gF9qsCIHwR7p+SF/SDm1jI/5MadCQZWJWNx9UvNr5D/g/cWDyPHlBwDeDhbkByZLVqM+firrTEdOxP82Wo1AzvC64wTOgUHnkSE0pkYaJxIsYi44S01HS+dU9Ds2nrNMhnSjk7X52a7sY8z52LYveP04M2zBq/chFgMxqtI7iqPJ78MtDF+UdKL+3/0xG6J0/d1XIuuUCSNlhBKqmye2gKUWVg4cIq0chiSaXGogTusGN5yFfBJJLYUr7lR4drjwKz9RzuH5CA6SyfRRbJvpe8OROcm0X2ta2uD2bR8bgVIKPMvy6vq2PLQ+6OGE8nQIgaX9aLmnP0vVEIce4FTxntGzkkEQ6UZOHghuGp2jLL74TIKAwuWw6WvNR7RX68zf5jU1JSQogv7D2Vpd30/XpFzLirXSTPp1E4uG7MXh2x7X/Ib4riAJmAbF7U0bRQJJXkoladkHu7fBqXvRyyT5wxM8d4p/viNVhH5wy3yLyDiFxMUKazTi54gqVnPpkgL5ImGhIr08= 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:(13230031)(4636009)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(1800799012)(186009)(64100799003)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(81166007)(356005)(82740400003)(86362001)(36756003)(316002)(110136005)(478600001)(70206006)(54906003)(7696005)(70586007)(6666004)(2906002)(8936002)(8676002)(7416002)(5660300002)(4326008)(47076005)(41300700001)(40480700001)(36860700001)(1076003)(426003)(336012)(26005)(83380400001)(40460700003)(2616005)(41533002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:24:58.2004 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b101eb4-cef1-4455-b6b9-08dc1b2c00a2 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: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6434 Implement generic function for scanning SoundWire controller. Same function will be used for legacy and sof stack for AMD platforms. Signed-off-by: Vijendar Mukunda Acked-by: Vinod Koul --- include/linux/soundwire/sdw_amd.h | 15 ++++++++ sound/soc/amd/acp/Kconfig | 7 ++++ sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/amd-sdw-acpi.c | 62 +++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 sound/soc/amd/acp/amd-sdw-acpi.c diff --git a/include/linux/soundwire/sdw_amd.h b/include/linux/soundwire/sdw_amd.h index ceecad74aef9..41dd64941cef 100644 --- a/include/linux/soundwire/sdw_amd.h +++ b/include/linux/soundwire/sdw_amd.h @@ -6,6 +6,7 @@ #ifndef __SDW_AMD_H #define __SDW_AMD_H +#include #include /* AMD pm_runtime quirk definitions */ @@ -106,4 +107,18 @@ struct amd_sdw_manager { struct sdw_amd_dai_runtime **dai_runtime_array; }; + +/** + * struct sdw_amd_acpi_info - Soundwire AMD information found in ACPI tables + * @handle: ACPI controller handle + * @count: maximum no of soundwire manager links supported on AMD platform. + * @link_mask: bit-wise mask listing links enabled by BIOS menu + */ +struct sdw_amd_acpi_info { + acpi_handle handle; + int count; + u32 link_mask; +}; + +int amd_sdw_scan_controller(struct sdw_amd_acpi_info *info); #endif diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index 84c963241dc5..b3105ba9c3a3 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -101,6 +101,13 @@ config SND_SOC_AMD_MACH_COMMON help This option enables common Machine driver module for ACP. +config SND_AMD_SOUNDWIRE_ACPI + tristate "AMD SoundWire ACPI Support" + depends on ACPI + help + This options enables ACPI helper functions for SoundWire + interface for AMD platforms. + config SND_SOC_AMD_LEGACY_MACH tristate "AMD Legacy Machine Driver Support" depends on X86 && PCI && I2C diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index ff5f7893b81e..1fd581a2aa33 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -10,6 +10,7 @@ snd-acp-i2s-objs := acp-i2s.o snd-acp-pdm-objs := acp-pdm.o snd-acp-legacy-common-objs := acp-legacy-common.o snd-acp-pci-objs := acp-pci.o +snd-amd-sdw-acpi-objs := amd-sdw-acpi.o #platform specific driver snd-acp-renoir-objs := acp-renoir.o @@ -33,6 +34,7 @@ obj-$(CONFIG_SND_AMD_ASOC_REMBRANDT) += snd-acp-rembrandt.o obj-$(CONFIG_SND_AMD_ASOC_ACP63) += snd-acp63.o obj-$(CONFIG_SND_AMD_ASOC_ACP70) += snd-acp70.o +obj-$(CONFIG_SND_AMD_SOUNDWIRE_ACPI) += snd-amd-sdw-acpi.o obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o obj-$(CONFIG_SND_SOC_AMD_SOF_MACH) += snd-acp-sof-mach.o diff --git a/sound/soc/amd/acp/amd-sdw-acpi.c b/sound/soc/amd/acp/amd-sdw-acpi.c new file mode 100644 index 000000000000..babd841d3296 --- /dev/null +++ b/sound/soc/amd/acp/amd-sdw-acpi.c @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Authors: Vijendar Mukunda + +/* + * SDW AMD ACPI scan helper function + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int amd_sdw_scan_controller(struct sdw_amd_acpi_info *info) +{ + struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle); + u32 sdw_bitmap = 0; + u8 count = 0; + int ret; + + if (!adev) + return -EINVAL; + + /* Found controller, find links supported */ + ret = fwnode_property_read_u32_array(acpi_fwnode_handle(adev), + "mipi-sdw-manager-list", &sdw_bitmap, 1); + if (ret) { + dev_err(&adev->dev, + "Failed to read mipi-sdw-manager-list: %d\n", ret); + return -EINVAL; + } + count = hweight32(sdw_bitmap); + /* Check count is within bounds */ + if (count > info->count) { + dev_err(&adev->dev, "Manager count %d exceeds max %d\n", + count, info->count); + return -EINVAL; + } + + if (!count) { + dev_dbg(&adev->dev, "No SoundWire Managers detected\n"); + return -EINVAL; + } + dev_dbg(&adev->dev, "ACPI reports %d SoundWire Manager devices\n", count); + info->link_mask = sdw_bitmap; + return 0; +} +EXPORT_SYMBOL_NS(amd_sdw_scan_controller, SND_AMD_SOUNDWIRE_ACPI); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_DESCRIPTION("AMD SoundWire ACPI helpers"); From patchwork Mon Jan 22 09:24:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525021 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 8A7A5C4725D for ; Mon, 22 Jan 2024 09:26:11 +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 CBF277F1; Mon, 22 Jan 2024 10:25:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CBF277F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705915569; bh=7z13QeROUfU/Amsr7nVs73fALXrwGUWGWRgbui52WHY=; 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=suR7NcAIIRwL5fDk0U/xrUmCyNKdRJ0/OuYvyQCUW68xRqomN7M6FfohOeSxqmwSr WLX1UTEdQFbh8SD5GGia8aQMJ+U+ce+8FQrajeVMeGiykq+/qzA4i+ZdA0kO+EnFYh sjG3a1QaApZKDPr/WLJ2DG9Zs9iBoVdlaI+LBuIw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4F8E1F805EB; Mon, 22 Jan 2024 10:25:20 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3FFCAF805E9; Mon, 22 Jan 2024 10:25:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 791A0F8028D; Mon, 22 Jan 2024 10:25:15 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2416::600]) (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 96B9DF8056F for ; Mon, 22 Jan 2024 10:25:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 96B9DF8056F 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=mtwvnp1g ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MxXSEtpVXPbeDW1PSimycXFEiSlOumIZUb+KXxNVUmRwBzofgKtAxiqav+Yil/fauRhhiGR0bfp3YW9j5KE0PGJGzuxhvq2loROJpQp8esFVJNQ2aBohgyFNyFgzuakPiuS0stz8ot7S+A6e8WOTomHk5tZioIdEdnKhDkJybywawb0q3KpmZXe5DtzjO1XPh3nBRI+iLGU0zqQDGNR9bXJ/NcttnsfoZXsv0WdIYsEzM1S6z/EYQ3Q5PEpaVEcQ3s1TMlJ87ZoqB84YGPfYrW/FVDy621WiWG7KH5R9ZyWEpBJzDYgB4lVyIuKDsNv/WEoPUVCClrhniwY4iOZw2A== 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=RlNQyoxzY+Wi5nmdDaMQA5mOdyGEOSzOl0U+uSSPLWM=; b=CTb4B49S10Uuj+AUvoLlyM+27FbvPZ5sPPBl94WqeLIOS8dKKGGWso6O7i2jsZNNSNRQ+EYGA0gVH/8J9mNI9CKcYRDLaVWooR/3pM99SK+jS+ZcLxgg8jkcahYFIMDyu46mRl2PxF2Ek9pbGFYXtz0EJH98CuZ3XlOXOzFXL2oeG/Dqwi3J01be1e3l1XHyF/mFnDD9Z3+Lrf2K0Enjbb9eUYQSYibI/Lp/h+Vp13GBhw9aLPPO7wwz8TGjpOL+BCPWJWobTRFhsH94xUeje67HppJ3+xP1khz/UfSTPMQtwqInbpRBKZGeHKM4CGVLs2PuETcR1UwJ5fKM7HeZvw== 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 (0) 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=RlNQyoxzY+Wi5nmdDaMQA5mOdyGEOSzOl0U+uSSPLWM=; b=mtwvnp1gq5BAGw3mJoK05eXGkv0R+couvDr0tHVOQlIEhFmIKb1p1NnHEmU3O+CepmSDfatgdSi7FTXR4xrazt4ll4a7z2PWUSR9+A/FYxqzGUNAN7cPpY9OqCD6Qop6mKJPeCqj+2Oa+NhXc7VmLEWxyJX+5vAMVdHkoejN3YE= Received: from CY8PR10CA0034.namprd10.prod.outlook.com (2603:10b6:930:4b::11) by CY5PR12MB6130.namprd12.prod.outlook.com (2603:10b6:930:26::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Mon, 22 Jan 2024 09:25:02 +0000 Received: from CY4PEPF0000E9D7.namprd05.prod.outlook.com (2603:10b6:930:4b:cafe::4) by CY8PR10CA0034.outlook.office365.com (2603:10b6:930:4b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 09:25:02 +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 CY4PEPF0000E9D7.mail.protection.outlook.com (10.167.241.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:25:01 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2507.34; Mon, 22 Jan 2024 03:25:01 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 22 Jan 2024 01:25:00 -0800 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:24:57 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Sanyog Kale , open list Subject: [PATCH V3 02/13] soundwire: amd: update license Date: Mon, 22 Jan 2024 14:54:24 +0530 Message-ID: <20240122092435.3791175-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D7:EE_|CY5PR12MB6130:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b08bf57-56b9-4b14-a144-08dc1b2c02d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lv1aJ9DGUCsFjx2xaUeh50orEnNjaU8PMHaXEO3CDmtonxcm7rZs+R+hyQpbM9mFrJ65k6D728oR33VKDC18EJhCEl6/5z2cZeMRm+QyHd+EP2EFVtAhIHVmGNmyCh3WwTSbYQ6xuLF0np1yyWs8xlx1IhT3bfX6lTWtMamDy81EgyYGhqur6DT8Al1eiX0hwXL/LCNeNywAaxURJdoHg6uYNd6df5RQlXkTLnjpYEQgKyzmUjPLljtPRMr2cYYa65JadALwIYQozQkjPSoZFwIeWAX9p8vbqOR7ER7OAT264XEX3h+KIDNZjjo50N9UBZo0Xcs7UPMgE9SBQXeFXqyQzDmFca73yneIZtUz+nR0W4ECiO79xqE1WZuZDfE+YcD/x/flrC+oNezHqbs69CVKCF5gAcMQepR0PQsVp2imo+8VBz3UYoRDGI1l9GHylYhkEuRLLTZfmDypPOB4i4QJ+P9WFcWTS4e2x/DpbH8PCEZGxLfucl4jKVzzCXw+pLpitxlp2v4Ufhf6PjF1Cl5HNk5jzZWukmf/QUXTag1CfvwzjM59GKEQpkUFD9xgxQ9WNEoj1/ATmFupJX2fhve2oxpAytAk+HgnWcGsy2ebgCpqZgQTB0SPvUKBSFi7DSIQVPh73updTHkfzQT5v/q5inzDy4GGoSpf4B3cGL37bUkW62PAw98yL7LdMSLzC7F3D136t6FzZbKjD7faygrcf4u1T1Oyc9RwCEeMZ5qXNW0q/Oy9w86a5gd47076fN4+SKz2taqMI6euyjGpXQ== 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:(13230031)(4636009)(136003)(39860400002)(376002)(346002)(396003)(230922051799003)(451199024)(186009)(64100799003)(82310400011)(1800799012)(40470700004)(46966006)(36840700001)(40460700003)(40480700001)(86362001)(478600001)(36756003)(26005)(1076003)(81166007)(356005)(2616005)(82740400003)(426003)(336012)(47076005)(83380400001)(36860700001)(8676002)(2906002)(110136005)(15650500001)(316002)(5660300002)(8936002)(7696005)(6666004)(4326008)(54906003)(41300700001)(70586007)(70206006)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:25:01.8543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b08bf57-56b9-4b14-a144-08dc1b2c02d2 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: CY4PEPF0000E9D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6130 Message-ID-Hash: MQ65NRMVQRE3PMJX77W6YCTC3IUBCMV5 X-Message-ID-Hash: MQ65NRMVQRE3PMJX77W6YCTC3IUBCMV5 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.9 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: Update license to dual license to align with Sound Open Firmware (SOF) driver as SOF uses dual license. Signed-off-by: Vijendar Mukunda --- drivers/soundwire/amd_manager.c | 4 ++-- drivers/soundwire/amd_manager.h | 2 +- include/linux/soundwire/sdw_amd.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c index 3a99f6dcdfaf..afa2d83b7e69 100644 --- a/drivers/soundwire/amd_manager.c +++ b/drivers/soundwire/amd_manager.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) /* * SoundWire AMD Manager driver * @@ -1207,5 +1207,5 @@ module_platform_driver(amd_sdw_driver); MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); MODULE_DESCRIPTION("AMD SoundWire driver"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("Dual BSD/GPL"); MODULE_ALIAS("platform:" DRV_NAME); diff --git a/drivers/soundwire/amd_manager.h b/drivers/soundwire/amd_manager.h index 5f040151a259..f57165bbb9d9 100644 --- a/drivers/soundwire/amd_manager.h +++ b/drivers/soundwire/amd_manager.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ /* * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. */ diff --git a/include/linux/soundwire/sdw_amd.h b/include/linux/soundwire/sdw_amd.h index 41dd64941cef..56b4117c087a 100644 --- a/include/linux/soundwire/sdw_amd.h +++ b/include/linux/soundwire/sdw_amd.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ /* * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. */ From patchwork Mon Jan 22 09:24:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525022 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 EE0EEC4725D for ; Mon, 22 Jan 2024 09:26:30 +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 C9CD7B65; Mon, 22 Jan 2024 10:26:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C9CD7B65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705915588; bh=I48p3FJYrdqBq+qB7J9cth7qpgrcQCD76Ylex+9CBRo=; 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=qZWWDNTVn6yp7o7qYA01vsBOJZXiMdY9rnoiv50fFIwEbesJE2qe9SWUsf5y+8qt0 qiOZVzW9/Wjmt1Ui8tNidvxujBctR67dA8mzhZ6G0rhbweyYNKxQzNgHd9zQJEdqN9 RzfNxvpdV/9QU5WKRBEajMaM5HAasvuCDMeZcAac= Received: by alsa1.perex.cz (Postfix, from userid 50401) id AAD07F80587; Mon, 22 Jan 2024 10:25:50 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 4014AF80571; Mon, 22 Jan 2024 10:25:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 58A7AF8028D; Mon, 22 Jan 2024 10:25:47 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20601.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::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 D7C2AF80149 for ; Mon, 22 Jan 2024 10:25:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D7C2AF80149 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=QMaZS1gH ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OU6aYVBYQdBVQvgZrhmYIyKkMf3NRxi5XlKHsOITLtXIkMyagU8uSWc+YqX+CN73zgVEjbzYItXAeP5PBN2JWDa5YagutR+fSwuu/ubH4rfPanYB/4NQmzmu983sopy/qQLcPTEBO36dcU44s/B0AjB8XbOwxNNN9phmaTmNz0vvj95bpELkXoKBSRwHIFpfmxwUwDOQSE0wTvlFcTOQTAmE6pyZUUTKjY+l2kYOUpRCRo3PTjBoQNLr1qinnViSxGZEDrR5bMqrFc16DRkPSfgtAgy0npxGYq8SSMJh64TNqJ90JA4xJKqiKsSOYW+2HZwUK6ka3wxlD8VMR6nyZw== 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=x3rsuiLG/ffVyByi+S/ebYQm2FWLXFkmTlfmDuiOlks=; b=k68Gzw+W5km37pdDZEVUJ/DzQaya4tkx7N4ErpDw9AUZUKcE9Cw2Oh0DKK0QcL8eEaHhDR9tP/O6q4ARGJbcw6HZf8ytXPNNtgUkHAoNMUIpHTq2WI65OzVoGusUJxyYAP30mdl+smulX3zNYO2bUuColSs8qUqx/ZMbWBhHaMJ/yCc9JBnCSwMnxnAj3bkjr1mo8+vkL+GCLkVlGS20EhZZ0aQzqFtGQ7sXE/iSQrPPc8rct+RHfDT8JUkfhQAUGUrrrkrFNDh4cQrBhQhg1HnhwNjiIbuoJ2ViXT1WA+y9cIeMwlnIxLxiynBanmQlrdOr+luId/ggkPuWWRHVZQ== 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 (0) 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=x3rsuiLG/ffVyByi+S/ebYQm2FWLXFkmTlfmDuiOlks=; b=QMaZS1gHF1uoxTEb/H90Sx9e/wVmpsrMswfGNgLF6Umo1RhllYUTCN9hi1f7h+Lv54XG7k0FTODneGJ0U+LxDioMNuuQhF2+tohS7FJwB2haRcO+kA2OyAPFa5kAP8xJPK4tjAxszCBm+wNH3qqwr+KeDHAygDsPPRQocZNRxwk= Received: from DS7PR03CA0253.namprd03.prod.outlook.com (2603:10b6:5:3b3::18) by DS7PR12MB5911.namprd12.prod.outlook.com (2603:10b6:8:7c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 09:25:28 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::5b) by DS7PR03CA0253.outlook.office365.com (2603:10b6:5:3b3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 09:25:28 +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 CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:25:27 +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.2507.34; Mon, 22 Jan 2024 03:25:18 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:25:07 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:25:04 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Sanyog Kale , open list Subject: [PATCH V3 03/13] soundwire: amd: refactor amd soundwire manager device node creation Date: Mon, 22 Jan 2024 14:54:25 +0530 Message-ID: <20240122092435.3791175-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|DS7PR12MB5911:EE_ X-MS-Office365-Filtering-Correlation-Id: 68a690c4-ca42-4303-88cc-08dc1b2c124d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eZjORHLe1mM/dBckF9VVAhO1BIapO/XzoCkeYU2dvowxQxPvN6Vz5Eh/LXON0srY/q7c49Oex8308HnqBWVRzTmComMts2cPR/LwMiW2bkh8njBRZsZXFxCZfWNU+JvSXMQyoQBsWQCHHVIvYv68RgnGO6r3KOhUgUgJXA7FjbjvU6iim04/edOZwlYedO/igmqZsf+qgykwND8G3aM5jK/2Qc03kQsiMMXsirlHVWraZM1i0SnJkwXgJmS7+GvKBPfenfMXNu7kjxdbChzJgpqj9GeWxk8YaPBEIBXQYrlaTD3QABY+hqNKAtBIusdZPVXiPwY54dPHOhjgXiB8x+OGDw4QppJ7BADPby5UKKelx5r4LfFfESGpnEIWVVlI/tT+GRckWbfPF1UJYxEmlX7RqfK0hr+5bEgs+hpPwR/JmXS/k8LGd9xV/KXnLOucYcdLk1i11Ich5cqETwZ8/zR6gU5HCxWwfpmwjb+4wdDNEiyiqW53XY5g/Azdbjd7B5qsbc8zkxboR+zFrSlMHbIloRgwS8AKTYkuCjlSvNAzpJ9YS9Ajbmffs8V1ToPnpQ3GfgVqCQct0g30b8wA7SOgP0wud72RMs7udf+IN33soP22Q6/3uVhEkulgOtf+1lqy4eFFQcaO4ZvhUvU5Sjsoggx/tbZV4tTQLLvnSe/21ivsl+zxpS1TaHxC3shnibPsrqJrOeB12D5jKAWzHKuJsitMAmzswwYG5yTMzpm6x9nSAdeTWzx2ZuFRPQRlT0hpMubM7W3WO+BPvS8kEQ== 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:(13230031)(4636009)(39860400002)(136003)(376002)(396003)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(82310400011)(46966006)(40470700004)(36840700001)(356005)(26005)(1076003)(426003)(7696005)(336012)(6666004)(2616005)(36860700001)(83380400001)(5660300002)(2906002)(47076005)(30864003)(8936002)(8676002)(70586007)(54906003)(478600001)(316002)(70206006)(4326008)(110136005)(41300700001)(81166007)(86362001)(82740400003)(36756003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:25:27.8256 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68a690c4-ca42-4303-88cc-08dc1b2c124d 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: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5911 Message-ID-Hash: WN5ZC4WLIKGDP6V2H4DYKRHV3VTORPEL X-Message-ID-Hash: WN5ZC4WLIKGDP6V2H4DYKRHV3VTORPEL 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.9 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: Refactor amd SoundWire manager device node creation logic and implement generic functions to have a common functionality for SoundWire manager platform device creation, start and exit sequence for both legacy(NO DSP) and SOF stack for AMD platforms. These functions will be invoked from legacy and SOF stack. Signed-off-by: Vijendar Mukunda --- drivers/soundwire/Makefile | 2 +- drivers/soundwire/amd_init.c | 147 ++++++++++++++++++++++++++++++ drivers/soundwire/amd_init.h | 13 +++ drivers/soundwire/amd_manager.c | 16 +--- include/linux/soundwire/sdw_amd.h | 54 ++++++++++- 5 files changed, 218 insertions(+), 14 deletions(-) create mode 100644 drivers/soundwire/amd_init.c create mode 100644 drivers/soundwire/amd_init.h diff --git a/drivers/soundwire/Makefile b/drivers/soundwire/Makefile index 657f5888a77b..e80a2c2cf3e7 100644 --- a/drivers/soundwire/Makefile +++ b/drivers/soundwire/Makefile @@ -20,7 +20,7 @@ soundwire-bus-y += irq.o endif #AMD driver -soundwire-amd-y := amd_manager.o +soundwire-amd-y := amd_init.o amd_manager.o obj-$(CONFIG_SOUNDWIRE_AMD) += soundwire-amd.o #Cadence Objs diff --git a/drivers/soundwire/amd_init.c b/drivers/soundwire/amd_init.c new file mode 100644 index 000000000000..d732ab0bfd59 --- /dev/null +++ b/drivers/soundwire/amd_init.c @@ -0,0 +1,147 @@ +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) +/* + * SoundWire AMD Manager Initialize routines + * + * Initializes and creates SDW devices based on ACPI and Hardware values + * + * Copyright 2023 Advanced Micro Devices, Inc. + */ + +#include +#include +#include +#include +#include + +#include "amd_init.h" + +static int sdw_amd_cleanup(struct sdw_amd_ctx *ctx) +{ + int i; + + for (i = 0; i < ctx->count; i++) { + if (!(ctx->link_mask & BIT(i))) + continue; + platform_device_unregister(ctx->pdev[i]); + } + + return 0; +} + +static struct sdw_amd_ctx *sdw_amd_probe_controller(struct sdw_amd_res *res) +{ + struct sdw_amd_ctx *ctx; + struct acpi_device *adev; + struct resource *sdw_res; + struct acp_sdw_pdata sdw_pdata[2]; + struct platform_device_info pdevinfo[2]; + u32 link_mask; + int count, index; + + if (!res) + return NULL; + + adev = acpi_fetch_acpi_dev(res->handle); + if (!adev) + return NULL; + + if (!res->count) + return NULL; + + count = res->count; + dev_dbg(&adev->dev, "Creating %d SDW Link devices\n", count); + + /* + * we need to alloc/free memory manually and can't use devm: + * this routine may be called from a workqueue, and not from + * the parent .probe. + * If devm_ was used, the memory might never be freed on errors. + */ + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return NULL; + + ctx->count = count; + ctx->link_mask = res->link_mask; + sdw_res = kzalloc(sizeof(*sdw_res), GFP_KERNEL); + if (!sdw_res) { + kfree(ctx); + return NULL; + } + sdw_res->flags = IORESOURCE_MEM; + sdw_res->start = res->addr; + sdw_res->end = res->addr + res->reg_range; + memset(&pdevinfo, 0, sizeof(pdevinfo)); + link_mask = ctx->link_mask; + for (index = 0; index < count; index++) { + if (!(link_mask & BIT(index))) + continue; + + sdw_pdata[index].instance = index; + sdw_pdata[index].acp_sdw_lock = res->acp_lock; + pdevinfo[index].name = "amd_sdw_manager"; + pdevinfo[index].id = index; + pdevinfo[index].parent = res->parent; + pdevinfo[index].num_res = 1; + pdevinfo[index].res = sdw_res; + pdevinfo[index].data = &sdw_pdata[index]; + pdevinfo[index].size_data = sizeof(struct acp_sdw_pdata); + pdevinfo[index].fwnode = acpi_fwnode_handle(adev); + ctx->pdev[index] = platform_device_register_full(&pdevinfo[index]); + if (IS_ERR(ctx->pdev[index])) + goto err; + } + kfree(sdw_res); + return ctx; +err: + while (index--) { + if (!(link_mask & BIT(index))) + continue; + + platform_device_unregister(ctx->pdev[index]); + } + + kfree(sdw_res); + kfree(ctx); + return NULL; +} + +static int sdw_amd_startup(struct sdw_amd_ctx *ctx) +{ + struct amd_sdw_manager *amd_manager; + int i, ret; + + /* Startup SDW Manager devices */ + for (i = 0; i < ctx->count; i++) { + if (!(ctx->link_mask & BIT(i))) + continue; + amd_manager = dev_get_drvdata(&ctx->pdev[i]->dev); + ret = amd_sdw_manager_start(amd_manager); + if (ret) + return ret; + } + + return 0; +} + +int sdw_amd_probe(struct sdw_amd_res *res, struct sdw_amd_ctx **sdw_ctx) +{ + *sdw_ctx = sdw_amd_probe_controller(res); + if (!*sdw_ctx) + return -ENODEV; + + return sdw_amd_startup(*sdw_ctx); +} +EXPORT_SYMBOL_NS(sdw_amd_probe, SOUNDWIRE_AMD_INIT); + +void sdw_amd_exit(struct sdw_amd_ctx *ctx) +{ + sdw_amd_cleanup(ctx); + kfree(ctx->ids); + kfree(ctx); +} +EXPORT_SYMBOL_NS(sdw_amd_exit, SOUNDWIRE_AMD_INIT); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD SoundWire Init Library"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/soundwire/amd_init.h b/drivers/soundwire/amd_init.h new file mode 100644 index 000000000000..f710703ffae9 --- /dev/null +++ b/drivers/soundwire/amd_init.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ +/* + * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. + */ + +#ifndef __AMD_INIT_H +#define __AMD_INIT_H + +#include + +int amd_sdw_manager_start(struct amd_sdw_manager *amd_manager); + +#endif diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c index afa2d83b7e69..0fcf8f8545b1 100644 --- a/drivers/soundwire/amd_manager.c +++ b/drivers/soundwire/amd_manager.c @@ -19,6 +19,7 @@ #include #include #include "bus.h" +#include "amd_init.h" #include "amd_manager.h" #define DRV_NAME "amd_sdw_manager" @@ -864,10 +865,8 @@ static void amd_sdw_irq_thread(struct work_struct *work) writel(0x00, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_0TO7); } -static void amd_sdw_probe_work(struct work_struct *work) +int amd_sdw_manager_start(struct amd_sdw_manager *amd_manager) { - struct amd_sdw_manager *amd_manager = container_of(work, struct amd_sdw_manager, - probe_work); struct sdw_master_prop *prop; int ret; @@ -876,11 +875,11 @@ static void amd_sdw_probe_work(struct work_struct *work) amd_enable_sdw_pads(amd_manager); ret = amd_init_sdw_manager(amd_manager); if (ret) - return; + return ret; amd_enable_sdw_interrupts(amd_manager); ret = amd_enable_sdw_manager(amd_manager); if (ret) - return; + return ret; amd_sdw_set_frameshape(amd_manager); } /* Enable runtime PM */ @@ -889,6 +888,7 @@ static void amd_sdw_probe_work(struct work_struct *work) pm_runtime_mark_last_busy(amd_manager->dev); pm_runtime_set_active(amd_manager->dev); pm_runtime_enable(amd_manager->dev); + return 0; } static int amd_sdw_manager_probe(struct platform_device *pdev) @@ -964,11 +964,6 @@ static int amd_sdw_manager_probe(struct platform_device *pdev) dev_set_drvdata(dev, amd_manager); INIT_WORK(&amd_manager->amd_sdw_irq_thread, amd_sdw_irq_thread); INIT_WORK(&amd_manager->amd_sdw_work, amd_sdw_update_slave_status_work); - INIT_WORK(&amd_manager->probe_work, amd_sdw_probe_work); - /* - * Instead of having lengthy probe sequence, use deferred probe. - */ - schedule_work(&amd_manager->probe_work); return 0; } @@ -978,7 +973,6 @@ static void amd_sdw_manager_remove(struct platform_device *pdev) int ret; pm_runtime_disable(&pdev->dev); - cancel_work_sync(&amd_manager->probe_work); amd_disable_sdw_interrupts(amd_manager); sdw_bus_master_delete(&amd_manager->bus); ret = amd_disable_sdw_manager(amd_manager); diff --git a/include/linux/soundwire/sdw_amd.h b/include/linux/soundwire/sdw_amd.h index 56b4117c087a..1e5ff4c46365 100644 --- a/include/linux/soundwire/sdw_amd.h +++ b/include/linux/soundwire/sdw_amd.h @@ -26,6 +26,7 @@ #define AMD_SDW_POWER_OFF_MODE 2 #define ACP_SDW0 0 #define ACP_SDW1 1 +#define AMD_SDW_MAX_MANAGER_COUNT 2 struct acp_sdw_pdata { u16 instance; @@ -63,7 +64,6 @@ struct sdw_amd_dai_runtime { * @reg_mask: register mask structure per manager instance * @amd_sdw_irq_thread: SoundWire manager irq workqueue * @amd_sdw_work: peripheral status work queue - * @probe_work: SoundWire manager probe workqueue * @acp_sdw_lock: mutex to protect acp share register access * @status: peripheral devices status array * @num_din_ports: number of input ports @@ -87,7 +87,6 @@ struct amd_sdw_manager { struct sdw_manager_reg_mask *reg_mask; struct work_struct amd_sdw_irq_thread; struct work_struct amd_sdw_work; - struct work_struct probe_work; /* mutex to protect acp common register access */ struct mutex *acp_sdw_lock; @@ -120,5 +119,56 @@ struct sdw_amd_acpi_info { u32 link_mask; }; +/** + * struct sdw_amd_ctx - context allocated by the controller + * driver probe + * @count: link count + * @num_slaves: total number of devices exposed across all enabled links + * @link_mask: bit-wise mask listing SoundWire links reported by the + * Controller + * @ids: array of slave_id, representing Slaves exposed across all enabled + * links + * @pdev: platform device structure + */ +struct sdw_amd_ctx { + int count; + int num_slaves; + u32 link_mask; + struct sdw_extended_slave_id *ids; + struct platform_device *pdev[AMD_SDW_MAX_MANAGER_COUNT]; +}; + +/** + * struct sdw_amd_res - Soundwire AMD global resource structure, + * typically populated by the DSP driver/Legacy driver + * + * @addr: acp pci device resource start address + * @reg_range: ACP register range + * @link_mask: bit-wise mask listing links selected by the DSP driver/ + * legacy driver + * @count: link count + * @mmio_base: mmio base of SoundWire registers + * @handle: ACPI parent handle + * @parent: parent device + * @dev: device implementing hwparams and free callbacks + * @acp_lock: mutex protecting acp common registers access + */ +struct sdw_amd_res { + u32 addr; + u32 reg_range; + u32 link_mask; + int count; + void __iomem *mmio_base; + acpi_handle handle; + struct device *parent; + struct device *dev; + /* use to protect acp common registers access */ + struct mutex *acp_lock; +}; + +int sdw_amd_probe(struct sdw_amd_res *res, struct sdw_amd_ctx **ctx); + +void sdw_amd_exit(struct sdw_amd_ctx *ctx); + int amd_sdw_scan_controller(struct sdw_amd_acpi_info *info); #endif From patchwork Mon Jan 22 09:24:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525024 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 572CFC4725D for ; Mon, 22 Jan 2024 09:27:04 +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 BC1EEE64; Mon, 22 Jan 2024 10:26:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BC1EEE64 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705915622; bh=IFEot5bHMABYq7lhA8Lmyy1rUd/zj2YzvOCv6zifuJw=; 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=hq7Ng0oBVnwnHqecjSrKXaSEAa/dTHifOI/aY+e621hSox370fcj17IaAnkLBmHbd wcbzfyDF0TIiAQD1WoymjmZDqCUOnZKt8zMUK0DvBv5tfFbMqTUYSlNgN9ldhDjCM8 IoBxW3x8KoRRdJeH+z6tAWijEzfDrspaNbzbqz8g= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C998EF805AE; Mon, 22 Jan 2024 10:26:06 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3114EF8060B; Mon, 22 Jan 2024 10:26:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 02C03F805B3; Mon, 22 Jan 2024 10:25:58 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2412::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 0C27DF8022B for ; Mon, 22 Jan 2024 10:25:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0C27DF8022B 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=Lr7Tn8dp ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CnLF3ZhCqFhZSitIdoI27GL1eMCZYOPelX7bTjNcfAoJmuoJ4W1eJUDmPcJtOfFxlSVb4J1Zw1NxB03+PCecy3V/K9pEplAUFOjtk4RQwJmt4EpznREg9an38cgFPYgYd0U6tfVWuqmox2VdY6GJJwsxjUcURZb1k4pORL3+ZFzX0zxg2IQv0Rv3uEN47qFdcYQM7pUZo3YDkT+F8idlXPKUIh1zuJN3rt8O3HgFnPCbaX9kKM2RDVIXvk8KzpPgliOXU+6Ip0W5Jmnox5bxse1SAwuClqT1SMK2Y8UG3XMJ4Hi42sfwXf7onPFbkwIlLQhrdhAEI/9jQrfCiezKkg== 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=CFdBQFK594SUzT/rZ/nQ4zQ3K2GAlXJIQYpqFZzwPoU=; b=Zaa/B5KYA+XotM+Y3QUVFwNYEPR01H8y/EFnglGYx6vyyvbB6d04wMaQ5RjM4wzezPtJQcRydhTsMqUzJllgfQ97GkQ+WDJtB9m1Yydq3MIwNEqJSRAnKuc17U0qUvWW+Ij6L5mWqke4HrZsk9yTI/z9gpy+71A5YD2SfTwZaSRRH3Du5wTnh1xF3xHU2emh3eKpdcstYWhFiBm3dRsVvVK0EFci1+0Evt/XAMQ53kgP355fL4R1RyVASFnm+zOt9hArS/TyvwP0UmV//BUpBztSvNkJVFt+N/OGNi5CvTpinYzHEo336vLXHbMyokKRIO+pzyvnEB3AJIVwgabipw== 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 (0) 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=CFdBQFK594SUzT/rZ/nQ4zQ3K2GAlXJIQYpqFZzwPoU=; b=Lr7Tn8dptst+NG1nVETogNvZ4woSjIT//Q0uJyyUu8ZDIpUZtsuW+NxX2M+WrlDXGxryjHGooFQojPkk3F4uJ4RyqYZDAB6CP0O6eaZ0LsFjHdiT5PWMaExEE9hZ21MIgZKTTF/F4ZQttG8vTCSYkHmMenpdwGL8InEFx+mxxJo= Received: from CH5P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:1f3::26) by PH7PR12MB6466.namprd12.prod.outlook.com (2603:10b6:510:1f6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Mon, 22 Jan 2024 09:25:28 +0000 Received: from DS3PEPF000099D8.namprd04.prod.outlook.com (2603:10b6:610:1f3:cafe::49) by CH5P223CA0012.outlook.office365.com (2603:10b6:610:1f3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 09:25:28 +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 DS3PEPF000099D8.mail.protection.outlook.com (10.167.17.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Mon, 22 Jan 2024 09:25:27 +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.2507.34; Mon, 22 Jan 2024 03:25:18 -0600 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.2507.34; Mon, 22 Jan 2024 03:25:11 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:25:07 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Sanyog Kale , open list Subject: [PATCH V3 04/13] soundwire: amd: implement function to extract slave information Date: Mon, 22 Jan 2024 14:54:26 +0530 Message-ID: <20240122092435.3791175-5-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D8:EE_|PH7PR12MB6466:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f33a64d-0b9b-4216-a226-08dc1b2c1247 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ljlIOA0tTWFqZ1JqznuU+QUakOBtVpuT+H3n8y9F7y9Qfs3Z6ctt+fzqXfXeO0MFUAeWY5EYiMkW33mpKa7Poic9sOgljIdgxj0mv6t834yCZ9YaDqh7erADc7F1xR39ZShlTaZn+JGvJCJKYYRdFAokUOfdHcwPTtOiiKKkj6N5dOvxUKlo28AQHD4yhyZB9MvbB+xafzI/dWdRKF7PiSvXUAmCL5vBG7Ex2F5RuLvD7huHEQqJkzQZ+O+KXs5NTqozxQkWYhMg0s7/RmrGNR9LngSxjpu7xTEe6UpNifSRSQvfJB/lJ5o7LEq2z+JgKZFmb5lQ/4lBz/mCLAsPIWRp1ax700D7dnqNBC+xxexTe59++VSYvzdqjKV8qNGWLmBmf5NSDv0ltwrE6HtEe8WgKX7LBZfjIubk5ym2DgO3A1z3RN24YpnwXxYpk5/XOK+FmbHu7aaSqm+4tz9CTP0EdGKFoVScQWxq35WKzlaX3SywcAVr/UXEPobjVja8vfcFZevDXUBLwI+FUFShlODXkidO5HgeO9Cz0I+Fqs6twOe3WBtaJJx8V65Z5t5L6Rk0M6cpULTopc/3WCusFGZ76xVaFcDReRbvW8IOaGyPNw21ZlNOysGBfKCyWREKx2WiwzdQEkNIrR6RMvi+3FOvCtAwpq5wAZWseTtvVw/EsmbSng4zDiFWt3HNlhOXZ9gNThaiKCBUp7XUhgze4W/Q0OFIcXi35gJkiVnu55fmCnVD+AnL9VsKIItr7ikBXJNV1wLR0ZuecF+XsRl5VA== 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:(13230031)(4636009)(346002)(136003)(376002)(39860400002)(396003)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(1800799012)(46966006)(40470700004)(36840700001)(478600001)(6666004)(7696005)(110136005)(70206006)(70586007)(8676002)(8936002)(316002)(54906003)(47076005)(36860700001)(1076003)(26005)(426003)(336012)(2616005)(2906002)(4326008)(5660300002)(41300700001)(36756003)(81166007)(356005)(82740400003)(86362001)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:25:27.8181 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f33a64d-0b9b-4216-a226-08dc1b2c1247 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: DS3PEPF000099D8.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6466 Message-ID-Hash: 4TU3MEMBHTI3AILXGT4DUO2APIAO6NS6 X-Message-ID-Hash: 4TU3MEMBHTI3AILXGT4DUO2APIAO6NS6 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.9 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: Implement function to extract slaves information connected on the bus. This information is required during machine select logic. This function will be called from machine select logic code. Signed-off-by: Vijendar Mukunda --- drivers/soundwire/amd_init.c | 43 +++++++++++++++++++++++++++++++ include/linux/soundwire/sdw_amd.h | 2 ++ 2 files changed, 45 insertions(+) diff --git a/drivers/soundwire/amd_init.c b/drivers/soundwire/amd_init.c index d732ab0bfd59..5c9569d9ad01 100644 --- a/drivers/soundwire/amd_init.c +++ b/drivers/soundwire/amd_init.c @@ -142,6 +142,49 @@ void sdw_amd_exit(struct sdw_amd_ctx *ctx) } EXPORT_SYMBOL_NS(sdw_amd_exit, SOUNDWIRE_AMD_INIT); +int sdw_amd_get_slave_info(struct sdw_amd_ctx *ctx) +{ + struct amd_sdw_manager *amd_manager; + struct sdw_bus *bus; + struct sdw_slave *slave; + struct list_head *node; + int index; + int i = 0; + int num_slaves = 0; + + for (index = 0; index < ctx->count; index++) { + if (!(ctx->link_mask & BIT(index))) + continue; + amd_manager = dev_get_drvdata(&ctx->pdev[index]->dev); + if (!amd_manager) + return -ENODEV; + bus = &amd_manager->bus; + /* Calculate number of slaves */ + list_for_each(node, &bus->slaves) + num_slaves++; + } + + ctx->ids = kcalloc(num_slaves, sizeof(*ctx->ids), GFP_KERNEL); + if (!ctx->ids) + return -ENOMEM; + ctx->num_slaves = num_slaves; + for (index = 0; index < ctx->count; index++) { + if (!(ctx->link_mask & BIT(index))) + continue; + amd_manager = dev_get_drvdata(&ctx->pdev[index]->dev); + if (amd_manager) { + bus = &amd_manager->bus; + list_for_each_entry(slave, &bus->slaves, node) { + ctx->ids[i].id = slave->id; + ctx->ids[i].link_id = bus->link_id; + i++; + } + } + } + return 0; +} +EXPORT_SYMBOL_NS(sdw_amd_get_slave_info, SOUNDWIRE_AMD_INIT); + MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); MODULE_DESCRIPTION("AMD SoundWire Init Library"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/include/linux/soundwire/sdw_amd.h b/include/linux/soundwire/sdw_amd.h index 1e5ff4c46365..ae53664f87cb 100644 --- a/include/linux/soundwire/sdw_amd.h +++ b/include/linux/soundwire/sdw_amd.h @@ -170,5 +170,7 @@ int sdw_amd_probe(struct sdw_amd_res *res, struct sdw_amd_ctx **ctx); void sdw_amd_exit(struct sdw_amd_ctx *ctx); +int sdw_amd_get_slave_info(struct sdw_amd_ctx *ctx); + int amd_sdw_scan_controller(struct sdw_amd_acpi_info *info); #endif From patchwork Mon Jan 22 09:24:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525023 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 EBD57C47DAF for ; Mon, 22 Jan 2024 09:26:51 +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 6EC96828; Mon, 22 Jan 2024 10:26:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6EC96828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705915609; bh=tyEZPTEeR7iWKSi9Zhc2/tPj3NPkCZH6BZVfjFCsVZQ=; 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=uJv807xFwXLoWyo2WrGwZogs/hX9PpZpWLh1dRixk9sMLiB+w8vmaZ7GH2xCnWn9D K5W6tPoQlM0csMZ95ruFmuIRB/nbU2ruGAIKBNOXFPMZ0q5SJxehloxqarRtGozcsa BSmk3sShVYcjiWenad8x+CPzoGleEPhSkOYCsCSE= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3EAF4F804F1; Mon, 22 Jan 2024 10:26:03 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E87F2F805F7; Mon, 22 Jan 2024 10:26:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DA9ACF805BE; Mon, 22 Jan 2024 10:25:57 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:200a::600]) (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 1810FF804E7 for ; Mon, 22 Jan 2024 10:25:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1810FF804E7 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=xxwoL6PW ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kX/C+6+fVIvrxcdf4DTBJNEhRjScwCyg4lU5T8aDjG+dH1fXQ21WkO8fosH7AgSfzg95Uvh4lJYA3fZYUz2v5obArlcScdLWumqPETwHq9aX52JewyHS3dLlKcpgAhQNa8CcTr3MCWwadwpQUPBALEacIsPRe9kQPwjLpJLqOxAn6xjNRrA7JSbadycnEdi9ZDdU6krjh/x174uPgu76fUDtyA0daOhmYzeCCETNIWp6YjIBWaDPftWjwgt2tBFVNLyldpWaeUT82Q5TV0Ay1hSAFKLr7gxGWoiGBUpTTcFBtJftyP471SW8nki8kvxGvj3VV5uOel/SoO7s1UTqEA== 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=IacFn7eqF5kdZGkhlqH0YD9/OWDzYxwStCzDix+z0ns=; b=i+tKyboZB1Cdo0bjrZl3OXRV9+LHpyd3kIsA/UbjBO8DCPiPVPJguIPiqqrgPQoUqogo+CigaJTKzfNadex25uLJjX8vf48QVKbOnbVszZevvIYTMWTjJ9HmDiaQmMNspt/YImL7H3mfRE9I/FCsexhVI3vxoTHYgDdgleQbfHFriOQW4h7v7jIBbT3uqMeNBZI0A1FxCasZeTU0sZTZuzVFjl7HWqo/Uwu9fxbTP16O4I74pz0Zi9lZOX+N/tkaOtvY3IOa+2OfMzJWw1ajUMa4oiFRLnfplQ/Y/Wn0mqwV2wpnTfy/6qFc8IhCo//MBml7peh+aCwRpOYNymjHYg== 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 (0) 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=IacFn7eqF5kdZGkhlqH0YD9/OWDzYxwStCzDix+z0ns=; b=xxwoL6PWYKfd2Y0hYWcRBO5/refXykfr1whZw7MsgDyLydwSvyyLOpSM4qj6WwO3Xnuss36fNSk7vbfSj9dc08pI+4MoiQ6gmCWSAWQo+PjDwLih057N1w0XWCHu0SR/B8Sd9dQp3BTeXTcLQz+nUOn2lk3ssb0NSwFFZkxgBB0= Received: from DS7PR03CA0244.namprd03.prod.outlook.com (2603:10b6:5:3b3::9) by PH8PR12MB7325.namprd12.prod.outlook.com (2603:10b6:510:217::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Mon, 22 Jan 2024 09:25:29 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::71) by DS7PR03CA0244.outlook.office365.com (2603:10b6:5:3b3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.30 via Frontend Transport; Mon, 22 Jan 2024 09:25:28 +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 CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:25:28 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:25:18 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:25:11 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Sanyog Kale , open list Subject: [PATCH V3 05/13] soundwire: amd: refactor soundwire pads enable Date: Mon, 22 Jan 2024 14:54:27 +0530 Message-ID: <20240122092435.3791175-6-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|PH8PR12MB7325:EE_ X-MS-Office365-Filtering-Correlation-Id: ecd653b9-7c70-40a9-5dc2-08dc1b2c12a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VWDnIITSj7shPxtodUuXmFoH2/qyXb971cd5qvWTd6q941Vl9a9mDZdxFw9emGyDrVkEFvonEY0sDhs0PYHo/ZZO8Pn4ITcQjm0JFgu9xJgZ2+YqNYYKRYTv+QlJXxoOh1KRMApYJbD8bCSmh4fXTnJtbmAwmxelp0wQVK8vwvhK+AIJkBMQSD0V6JPRqWF2KgzBG9/N9G5B0P9oFt7EwYRKZnftHHTNkobNnRcaO4M4jq08f/CbnEYCqkDwl7jwU/jR4VemA1eRVlg4tnQZQ/gdByp/6alNgb3qDYkgjkTj5ERo9fzAigQjoyINZr2VX/z55NDJYJo0zT7iYErP8fhblV55Tq0zqB/gCc9ghVOPjc7htS8fY31Bu3KE9dii7O+rY8M5uIxNCJu5ajsTW2QOLRS2S2vk8tftNYvGlrwn7e69PMzVLp4FVYg6Rnr8MCBbuxvbXnkJJGmcXFVhYspsJQPSUzIYT/Nn7LCwZlTdpEAs0wxpy9AEqYrB19k5RUTdon4DNmPRk7zljrIznJ/BTwvbZJdTr2LhNU0cVcoSVINRBoN/CIaFb8jLt+HhfGkJJt7Y4uBykSa5j4K+n8kUOYCuAdb6P3EV9flvxYThNSavVKVOfZGZ9TZMuKN8uHmOxZy0pt1e8o4MhJDppr1m/isjAWZ8rU2JRNF+Rc2dlCa90wI05lGHmzbJZ7H5ONcH12fm8l8dpiZcFVphA4+khT9AEC98JWrUIslGGR1RWmzb0xovoa00FIhuFxZjypmXxrvs2ud8urq/qc2h/Q== 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:(13230031)(4636009)(396003)(39860400002)(346002)(376002)(136003)(230922051799003)(64100799003)(1800799012)(82310400011)(451199024)(186009)(40470700004)(36840700001)(46966006)(41300700001)(336012)(1076003)(6666004)(47076005)(426003)(83380400001)(40480700001)(40460700003)(26005)(7696005)(8936002)(54906003)(70206006)(70586007)(110136005)(316002)(82740400003)(86362001)(478600001)(2616005)(36860700001)(81166007)(36756003)(356005)(8676002)(2906002)(5660300002)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:25:28.4037 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ecd653b9-7c70-40a9-5dc2-08dc1b2c12a3 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: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7325 Message-ID-Hash: JQQVYR33H2LYFEGEYP23NQJ3DSP3OFAX X-Message-ID-Hash: JQQVYR33H2LYFEGEYP23NQJ3DSP3OFAX 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.9 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: As sdw pads enable sequence is executed only once, invoke it from probe sequence. Program required pads for both manager instances based on link_mask during probe sequence. This will avoid acquiring mutex lock. Remove unnecessary delay after programming ACP_SW_PAD_KEEPER_EN register. Signed-off-by: Vijendar Mukunda --- drivers/soundwire/amd_init.c | 45 +++++++++++++++++++++++++++++++++ drivers/soundwire/amd_manager.c | 18 ------------- 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/drivers/soundwire/amd_init.c b/drivers/soundwire/amd_init.c index 5c9569d9ad01..b3b3c7266384 100644 --- a/drivers/soundwire/amd_init.c +++ b/drivers/soundwire/amd_init.c @@ -15,6 +15,47 @@ #include "amd_init.h" +#define ACP_PAD_PULLDOWN_CTRL 0x0001448 +#define ACP_SW_PAD_KEEPER_EN 0x0001454 +#define AMD_SDW_PAD_PULLDOWN_CTRL_ENABLE_MASK 0x7f9a +#define AMD_SDW0_PAD_PULLDOWN_CTRL_ENABLE_MASK 0x7f9f +#define AMD_SDW1_PAD_PULLDOWN_CTRL_ENABLE_MASK 0x7ffa +#define AMD_SDW0_PAD_EN_MASK 1 +#define AMD_SDW1_PAD_EN_MASK 0x10 +#define AMD_SDW_PAD_EN_MASK (AMD_SDW0_PAD_EN_MASK | AMD_SDW1_PAD_EN_MASK) + +static int amd_enable_sdw_pads(void __iomem *mmio, u32 link_mask, struct device *dev) +{ + u32 val; + u32 pad_keeper_en_mask, pad_pulldown_ctrl_mask; + + switch (link_mask) { + case 1: + pad_keeper_en_mask = AMD_SDW0_PAD_EN_MASK; + pad_pulldown_ctrl_mask = AMD_SDW0_PAD_PULLDOWN_CTRL_ENABLE_MASK; + break; + case 2: + pad_keeper_en_mask = AMD_SDW1_PAD_EN_MASK; + pad_pulldown_ctrl_mask = AMD_SDW1_PAD_PULLDOWN_CTRL_ENABLE_MASK; + break; + case 3: + pad_keeper_en_mask = AMD_SDW_PAD_EN_MASK; + pad_pulldown_ctrl_mask = AMD_SDW_PAD_PULLDOWN_CTRL_ENABLE_MASK; + break; + default: + dev_err(dev, "No SDW Links are enabled\n"); + return -ENODEV; + } + + val = readl(mmio + ACP_SW_PAD_KEEPER_EN); + val |= pad_keeper_en_mask; + writel(val, mmio + ACP_SW_PAD_KEEPER_EN); + val = readl(mmio + ACP_PAD_PULLDOWN_CTRL); + val &= pad_pulldown_ctrl_mask; + writel(val, mmio + ACP_PAD_PULLDOWN_CTRL); + return 0; +} + static int sdw_amd_cleanup(struct sdw_amd_ctx *ctx) { int i; @@ -37,6 +78,7 @@ static struct sdw_amd_ctx *sdw_amd_probe_controller(struct sdw_amd_res *res) struct platform_device_info pdevinfo[2]; u32 link_mask; int count, index; + int ret; if (!res) return NULL; @@ -50,6 +92,9 @@ static struct sdw_amd_ctx *sdw_amd_probe_controller(struct sdw_amd_res *res) count = res->count; dev_dbg(&adev->dev, "Creating %d SDW Link devices\n", count); + ret = amd_enable_sdw_pads(res->mmio_base, res->link_mask, res->parent); + if (ret) + return NULL; /* * we need to alloc/free memory manually and can't use devm: diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c index 0fcf8f8545b1..7ccafd8eab7d 100644 --- a/drivers/soundwire/amd_manager.c +++ b/drivers/soundwire/amd_manager.c @@ -26,23 +26,6 @@ #define to_amd_sdw(b) container_of(b, struct amd_sdw_manager, bus) -static void amd_enable_sdw_pads(struct amd_sdw_manager *amd_manager) -{ - u32 sw_pad_pulldown_val; - u32 val; - - mutex_lock(amd_manager->acp_sdw_lock); - val = readl(amd_manager->acp_mmio + ACP_SW_PAD_KEEPER_EN); - val |= amd_manager->reg_mask->sw_pad_enable_mask; - writel(val, amd_manager->acp_mmio + ACP_SW_PAD_KEEPER_EN); - usleep_range(1000, 1500); - - sw_pad_pulldown_val = readl(amd_manager->acp_mmio + ACP_PAD_PULLDOWN_CTRL); - sw_pad_pulldown_val &= amd_manager->reg_mask->sw_pad_pulldown_mask; - writel(sw_pad_pulldown_val, amd_manager->acp_mmio + ACP_PAD_PULLDOWN_CTRL); - mutex_unlock(amd_manager->acp_sdw_lock); -} - static int amd_init_sdw_manager(struct amd_sdw_manager *amd_manager) { u32 val; @@ -872,7 +855,6 @@ int amd_sdw_manager_start(struct amd_sdw_manager *amd_manager) prop = &amd_manager->bus.prop; if (!prop->hw_disabled) { - amd_enable_sdw_pads(amd_manager); ret = amd_init_sdw_manager(amd_manager); if (ret) return ret; From patchwork Mon Jan 22 09:24:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525025 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 88D06C47DAF for ; Mon, 22 Jan 2024 09:27:22 +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 6F344B70; Mon, 22 Jan 2024 10:27:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6F344B70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705915640; bh=xtnWNxMlZ/kFUbpB1SCxK9crj+rv9OD5nBPgbH1ApHw=; 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=inq7mipohRJFGrR+5sH64EeQprO3h6SBr1/5cQd4YfgXuNpHAZYWtctB/8lXhga7H z7/fqWypAqH4JXTRUGpt9F81ewlbxY567IFiM8ZBukEvKIXmOSBsJqqEfR3YyYOd3r MNGAUvY53HzRE/ARG2EkKSXXLJpZVhSmexiXGndk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4F9E6F8063D; Mon, 22 Jan 2024 10:26:09 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 427D9F805EA; Mon, 22 Jan 2024 10:26:09 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 42579F805B3; Mon, 22 Jan 2024 10:25:58 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::600]) (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 125F0F802BE for ; Mon, 22 Jan 2024 10:25:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 125F0F802BE 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=QgtIotrs ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B0+pn2F6YJde49U/c+tcyN8O18V5JwHA0jMLuowvhUvHtbodhENrSPS1i2f9foqf0dDNNgXomIJ3bR3lOj+ZUaQMEjumOPfBAfoohLGgNcIEbYuYnBjGMh66htcXYwIXyq9YooRXU7cs1b/Wa+BEq9vpwy1vGfdPrXMqk8nn36A5ROK5YcVILibzBJNFsBEWXlbcjMgAFuE/1iuLSBF3QpLjM7NR8PUASt+Bd5O2eCcF7GnFXGVysAYw2bQCzcIQlNQZfHroeMx1+wtwC+jMqO9tV9DIWO3wpM6/1R8yjiebIj4WLmB7RXx/T2WRyeE5CLVS/NhpzxmkwsOwth61+g== 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=Xj1JFc79FiePafhI2kF+P2W/uJVnyNwBTnBQWQ8j/Vk=; b=bjNelNBJc1l1ZqjWhVFkgjVl/PWAovq4qnse+ROnidbaC3eqC6yPU2xVEtQkY/lQfjR7A6rBSQADoRxFa0NGJk1HblMryfilzSFEFAl9NfciP12RB8PFVgoBUyl4uTPK54plnCz7z/BgFFiF76EqCaVr3IV2rqxJsEuTXckBOoiwaS53hfUB8JR8zQWYoK8iBqe7Astl3TNIFVG2/9x1s74Ka1hLWMq5xH/+oQhd3ejVXncUL3RNF5PnNDp9uref5OIelA8P+GKSRil5rLDyAl65sAuwsxA8fVKBQ8dRniQ/6U81C0uR6mrDWKk1+dLXfF9XzjRLNNO0X/zJN03pHw== 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 (0) 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=Xj1JFc79FiePafhI2kF+P2W/uJVnyNwBTnBQWQ8j/Vk=; b=QgtIotrsuN8ObRpf0zi0tcTARMec6w6MPHpNMgwhb3JgQW9i4yerL+yCBhBMF/r6nsYF6WQk27OH4Lvx9f1RW+JfcIWcN+vGeshe580d6E/WR9VYcrtFXx/uPAq+zVuqCVPVOkr1F6TTrf2nPA3pcbB99qTYfA2bypvLZIPT63U= Received: from DS7PR03CA0270.namprd03.prod.outlook.com (2603:10b6:5:3b3::35) by SA1PR12MB6822.namprd12.prod.outlook.com (2603:10b6:806:25d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Mon, 22 Jan 2024 09:25:29 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::46) by DS7PR03CA0270.outlook.office365.com (2603:10b6:5:3b3::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.31 via Frontend Transport; Mon, 22 Jan 2024 09:25:29 +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 CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:25:29 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:25:22 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:25:19 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Sanyog Kale , open list Subject: [PATCH V3 06/13] soundwire: amd: refactor register mask structure Date: Mon, 22 Jan 2024 14:54:28 +0530 Message-ID: <20240122092435.3791175-7-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|SA1PR12MB6822:EE_ X-MS-Office365-Filtering-Correlation-Id: 5eac99eb-76ca-48cb-6adb-08dc1b2c1332 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BhAeI2xMG+d+Zs7eL52S2ytPkCVAZa0mSNzL16mcx1z7/mqn7tWtRw/onbZps7lRgf7RKFJpCBz8FZMFTUzhxEIal4Sm9R+/2WXGb6pyOZ0OWvd9sLuxEyEz/X3+m3gNxiKb5HK282D6T068npbGWuCs1AgoEkTJj4Vtyf3yc8cALBw49mgNQ7GcoOpDMqItXP8CMyXKjEeTj+pzsTkPGyu03w+LE8c10AINLv/tPzYMSmPZ44IQh9rNsiOagziIhvLa2gGjXB11eI6j+NKQ3vtI8twqTGBkUx/63pwDBK6N9Nf6xVFF38G7X1Vzqo9Z6m8QrQ1qpIpPVWUoiKXkazJPZk27A+0S9bO3CYU5++01VmHPZsH8xN+88ItoAtA/vfDzzIxlaA3F0jOWuxuGkXTf7ia+7j3ZTf64mKXMq4ALwZVBbTq4ZyszQUBFogoG/WrWWNwpVBKRvCZKpuEgcvNr08eB+RJsj2sxBeaYMaH240xeSpAONGf3GNVQLJagMe/1zf+Qj7EZjL157+detUjjn+v1kgLEsM840ANOmm4XxDYPYETVoZmf5bafMbVdGJC6dBydbIIFVdv39kcolI5F34yMXr672tHZCZtfI1LAawywC2ldBp66z3BYH2nkA0YqhH2Jl1ncmlUUyx84g5qR9coq4TOAoWtLAGWTVTjI11BiC29aNbJM3cKe4QUmq99mPB8mN1eED8p95MgD7pUNEB0e093O37n2b05OOdH+iOoykKUZb4Z5Sw7k87Bi2NoZvED9llkUZOTcxTyW/VCx5gHFXrkxaVVJygPLLp36sOXdNJpSrbrYuawmIBP0 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:(13230031)(4636009)(396003)(39860400002)(346002)(376002)(136003)(230173577357003)(230273577357003)(230922051799003)(1800799012)(186009)(82310400011)(451199024)(64100799003)(40470700004)(36840700001)(46966006)(81166007)(356005)(82740400003)(36756003)(40480700001)(40460700003)(86362001)(83380400001)(336012)(426003)(26005)(1076003)(2616005)(316002)(110136005)(70586007)(8936002)(8676002)(54906003)(7696005)(70206006)(478600001)(6666004)(36860700001)(47076005)(2906002)(41300700001)(4326008)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:25:29.3412 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5eac99eb-76ca-48cb-6adb-08dc1b2c1332 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: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6822 Message-ID-Hash: 7OJQTCFTKUZNUZGPZ6FASE7UFJEEIQEM X-Message-ID-Hash: 7OJQTCFTKUZNUZGPZ6FASE7UFJEEIQEM 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.9 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: Register mask array structure is no longer needed as except interrupt control masks, rest of the register masks are not used in code. Use array for interrupt masks instead of structure. Signed-off-by: Vijendar Mukunda --- drivers/soundwire/amd_manager.c | 7 ++----- drivers/soundwire/amd_manager.h | 12 ++---------- include/linux/soundwire/sdw_amd.h | 8 -------- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c index 7ccafd8eab7d..111891cb601d 100644 --- a/drivers/soundwire/amd_manager.c +++ b/drivers/soundwire/amd_manager.c @@ -86,12 +86,11 @@ static int amd_disable_sdw_manager(struct amd_sdw_manager *amd_manager) static void amd_enable_sdw_interrupts(struct amd_sdw_manager *amd_manager) { - struct sdw_manager_reg_mask *reg_mask = amd_manager->reg_mask; u32 val; mutex_lock(amd_manager->acp_sdw_lock); val = readl(amd_manager->acp_mmio + ACP_EXTERNAL_INTR_CNTL(amd_manager->instance)); - val |= reg_mask->acp_sdw_intr_mask; + val |= sdw_manager_reg_mask_array[amd_manager->instance]; writel(val, amd_manager->acp_mmio + ACP_EXTERNAL_INTR_CNTL(amd_manager->instance)); mutex_unlock(amd_manager->acp_sdw_lock); @@ -104,12 +103,11 @@ static void amd_enable_sdw_interrupts(struct amd_sdw_manager *amd_manager) static void amd_disable_sdw_interrupts(struct amd_sdw_manager *amd_manager) { - struct sdw_manager_reg_mask *reg_mask = amd_manager->reg_mask; u32 val; mutex_lock(amd_manager->acp_sdw_lock); val = readl(amd_manager->acp_mmio + ACP_EXTERNAL_INTR_CNTL(amd_manager->instance)); - val &= ~reg_mask->acp_sdw_intr_mask; + val &= ~sdw_manager_reg_mask_array[amd_manager->instance]; writel(val, amd_manager->acp_mmio + ACP_EXTERNAL_INTR_CNTL(amd_manager->instance)); mutex_unlock(amd_manager->acp_sdw_lock); @@ -922,7 +920,6 @@ static int amd_sdw_manager_probe(struct platform_device *pdev) return -EINVAL; } - amd_manager->reg_mask = &sdw_manager_reg_mask_array[amd_manager->instance]; params = &amd_manager->bus.params; params->max_dr_freq = AMD_SDW_DEFAULT_CLK_FREQ * 2; params->curr_dr_freq = AMD_SDW_DEFAULT_CLK_FREQ * 2; diff --git a/drivers/soundwire/amd_manager.h b/drivers/soundwire/amd_manager.h index f57165bbb9d9..f877492a8c55 100644 --- a/drivers/soundwire/amd_manager.h +++ b/drivers/soundwire/amd_manager.h @@ -243,16 +243,8 @@ static struct sdw_manager_dp_reg sdw1_manager_dp_reg[AMD_SDW1_MAX_DAI] = { ACP_SW_AUDIO1_RX_OFFSET, ACP_SW_AUDIO1_RX_CHANNEL_ENABLE_DP0} }; -static struct sdw_manager_reg_mask sdw_manager_reg_mask_array[2] = { - { - AMD_SDW0_PAD_KEEPER_EN_MASK, - AMD_SDW0_PAD_PULLDOWN_CTRL_ENABLE_MASK, - AMD_SDW0_EXT_INTR_MASK - }, - { - AMD_SDW1_PAD_KEEPER_EN_MASK, - AMD_SDW1_PAD_PULLDOWN_CTRL_ENABLE_MASK, +static u32 sdw_manager_reg_mask_array[AMD_SDW_MAX_MANAGER_COUNT] = { + AMD_SDW0_EXT_INTR_MASK, AMD_SDW1_EXT_INTR_MASK - } }; #endif diff --git a/include/linux/soundwire/sdw_amd.h b/include/linux/soundwire/sdw_amd.h index ae53664f87cb..c5bc44cd150a 100644 --- a/include/linux/soundwire/sdw_amd.h +++ b/include/linux/soundwire/sdw_amd.h @@ -34,12 +34,6 @@ struct acp_sdw_pdata { struct mutex *acp_sdw_lock; }; -struct sdw_manager_reg_mask { - u32 sw_pad_enable_mask; - u32 sw_pad_pulldown_mask; - u32 acp_sdw_intr_mask; -}; - /** * struct sdw_amd_dai_runtime: AMD sdw dai runtime data * @@ -61,7 +55,6 @@ struct sdw_amd_dai_runtime { * @dev: linux device * @mmio: SoundWire registers mmio base * @acp_mmio: acp registers mmio base - * @reg_mask: register mask structure per manager instance * @amd_sdw_irq_thread: SoundWire manager irq workqueue * @amd_sdw_work: peripheral status work queue * @acp_sdw_lock: mutex to protect acp share register access @@ -84,7 +77,6 @@ struct amd_sdw_manager { void __iomem *mmio; void __iomem *acp_mmio; - struct sdw_manager_reg_mask *reg_mask; struct work_struct amd_sdw_irq_thread; struct work_struct amd_sdw_work; /* mutex to protect acp common register access */ From patchwork Mon Jan 22 09:24:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525009 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2071.outbound.protection.outlook.com [40.107.102.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58E443A1B7; Mon, 22 Jan 2024 09:25:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915542; cv=fail; b=CnxR21y0OV+bwfobRMRspjdzZqW6iVChKz5EBUD8/WRRHuvbRskhglrHmobhGq+VSarUOhDtCle1y7btw4ZrPl0X+NUXzcv9aeMi9F7vyjlGZtHnmJYqqu2E2bmiBDVkjlBLywmFowmklJgMAMA6V1rvzZV4+juDIDjKOl91GOM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915542; c=relaxed/simple; bh=70tYyohuzJBuHeIMEu8qAErJX0isonNJlXcOljksQBU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=URiL+evv3XRqnk0cuYeKyZtlN25N+JVZudG3fIGVKn1p114AOx1b7khIV/5TP19gMGBCL6E5I/gS+4sj6ocyJd5GlRuTAzmVpTLyQwC05ThizCRlt+2YaeW6LJtxSfLE5zEXfEF9XFWMbn8st3I/hrnjmXZ8KKDz4PD232Gi5n8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=0fp898Np; arc=fail smtp.client-ip=40.107.102.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="0fp898Np" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d8pvzLppyGVh8bOyM4XfogG9LJ8/rpl1w0kM8mHJA9f9a+cRKZZoEtNSC9Kru9hAwjgYrqRaHhK9KRGt+AbMY5VmMs/ft2Qk2VDmtOC/xyTXplvmdg6cjbYTeVB5/oNY4vuhZhJcvv+IcDtRJmwVzD+48LoL7ZyMTLQLCvjk1eKcRYJE8hpEEb9cNrJryTDi1k8mQ+MOY8eNXrTM5iJjABbcyZsd3TfAP415uAMMB5nm6DUaiWh7vZFYUotmOQPascEcrj1h5HleHHyAO59Vlhf5huE38QTmSJNWp7Updh0271iE51WLXBzEpCHEsp4dOQVkpUTK92lZop94L0kQEw== 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=1zC5WRwtu6+qO+9CXnFzJPWrGYlpkczne7vfVG5jg8k=; b=iPSeyilKf/cXmG/NxJWYvCl8JCuQwE4ZkMoEtRKBym9V/g1PxcqUMsvgo2UMtBUHpdjouJseGClaKgFaN6z9ZvX4R/whHLNScujKQ3siKLijfMq7YGem6LNbdCJiRp0PrYPVGwS+YJMhIczCvwAmhwD+JCFYXuG5ScDzWW/05Zfcjk8ujZOZ/5Mp+RNPMP6JyjD9LbAZ2wKth+fAFdZ6t5dDpjtjDLcZ3nvjNVT0o3D26/ib0LjIe60QXqBH4j2GNdxJmhi1dm3OMY7c/mvGEwJLhiFaAPNdRzfppVhtGXKj33Fu0dH3hj+Od38kRqhzSOG/WyqfuQlZrw78Nvnd6Q== 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 (0) 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=1zC5WRwtu6+qO+9CXnFzJPWrGYlpkczne7vfVG5jg8k=; b=0fp898Np1gB5p/fy3pPSrjM2oa1fq48BDzb9zK7+WFxHkf/t7EKT/a1M4sVwfT0sDA+kcNBeD2qIL9K35phGtHAkxx3wAd3uyz9nNn7mUvQkl7S2lUuC8ZF+qdcFnRKOvpZVkdYYC17RFZN0B1DZXIgw86FMnHr2zdNlSLMShf4= Received: from DM6PR10CA0028.namprd10.prod.outlook.com (2603:10b6:5:60::41) by IA0PR12MB7776.namprd12.prod.outlook.com (2603:10b6:208:430::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 09:25:38 +0000 Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:5:60:cafe::40) by DM6PR10CA0028.outlook.office365.com (2603:10b6:5:60::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.33 via Frontend Transport; Mon, 22 Jan 2024 09:25:38 +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 CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Mon, 22 Jan 2024 09:25:38 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2507.34; Mon, 22 Jan 2024 03:25:37 -0600 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.2507.34; Mon, 22 Jan 2024 03:25:37 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:25:31 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Peter Ujfalusi , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Mastan Katragadda , Rander Wang , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH V3 07/13] ASoC: SOF: amd: add code for invoking soundwire manager helper functions Date: Mon, 22 Jan 2024 14:54:29 +0530 Message-ID: <20240122092435.3791175-8-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE32:EE_|IA0PR12MB7776:EE_ X-MS-Office365-Filtering-Correlation-Id: a0c8a35e-de0b-4c28-78ef-08dc1b2c1878 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K0W0tvCgKNfoq1HEq0Zc6v+mjnYFZNbkfDCoNS1DNfPtM6ZbrmO1r86KSJH+f7Xif/fHpqSiJNPOe955cj3dD8tuCaWc6fQmxyfzo3o5mxpP6e7NKlVeqpbw2QBK84vZAVQrUho4UXLsCY5s8mf1e0N4uiU7GnBPIGk8V5aULWH5K0mLCb4/nj+nE6oE9hANH01fWHTdAvIZ0M2M4oHRMIfFk+HOQHof2JrUNvkAwwpw5s8Ag06zIV2+CFJ0V1EMGSKpe7hh6Y+MbAXzp6mI78T+gysvo6ZfEIgO511Ih5AwuWi6V32sVVXrZ8Wp6qfy4Vrj2YxG7Et6Rh/CtIf0kHfgCgzsTTU69D+UFA1y++JEmkZVS7U4Gx3WezOXXKQlzT5SlifgqxhwLmRcjaKpAKhtOFUdlK+ErgqL7KNgxeKIyvyMpca1orrvX5g8wEZa/P4T6G6Fmp2QFvtRXfI2H0wWmmhR/jgV046hKqXxb4u9IxEW8c3j2jBeoPUfPnoU2asdPcbrVGg7PvrsVcnlNXTcfuwdGexsHY4wcNtQax64mf78OV6F6tIKZGnlHrDpFkb2eT8kyTbE1XMn3XM2R6EateV47BakurtT6cbRgEVXv0H1q6zijYJcFzhl/uC4aq1Fhf0c/vZhYU9heLfjSBQJBYW4rHqgn+G2cwvEBJiDl3S6IwXONIOgYEAfwPAv0rkQZtGRCaTZWju9kCoWZ+3y1p6Jh9ClYyUuQanpReXYBKfFF/I7ahbkPXWyxjWQBouzCLop5GcdsG2j6fpucQ== 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:(13230031)(4636009)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(64100799003)(186009)(82310400011)(451199024)(1800799012)(36840700001)(40470700004)(46966006)(83380400001)(47076005)(26005)(336012)(2616005)(426003)(1076003)(82740400003)(36860700001)(4326008)(8676002)(8936002)(5660300002)(478600001)(2906002)(7416002)(41300700001)(7696005)(54906003)(70586007)(70206006)(316002)(110136005)(36756003)(356005)(81166007)(86362001)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:25:38.1889 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0c8a35e-de0b-4c28-78ef-08dc1b2c1878 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: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7776 Add code for invoking Soundwire manager helper functions when SoundWire configuration is selected. Signed-off-by: Vijendar Mukunda --- sound/soc/sof/amd/Kconfig | 17 +++++++ sound/soc/sof/amd/acp.c | 99 ++++++++++++++++++++++++++++++++++++++- sound/soc/sof/amd/acp.h | 15 +++++- 3 files changed, 129 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/amd/Kconfig b/sound/soc/sof/amd/Kconfig index 19c5e27a193f..1cea1d75130c 100644 --- a/sound/soc/sof/amd/Kconfig +++ b/sound/soc/sof/amd/Kconfig @@ -60,6 +60,23 @@ config SND_SOC_SOF_ACP_PROBES This option is not user-selectable but automatically handled by 'select' statements at a higher level +config SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE + tristate + select SOUNDWIRE_AMD if SND_SOC_SOF_AMD_SOUNDWIRE != n + select SND_AMD_SOUNDWIRE_ACPI if ACPI + +config SND_SOC_SOF_AMD_SOUNDWIRE + tristate "SOF support for SoundWire based AMD platforms" + default SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE + depends on SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE + depends on ACPI && SOUNDWIRE + depends on !(SOUNDWIRE=m && SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=y) + help + This adds support for SoundWire with Sound Open Firmware + for AMD platforms. + Say Y if you want to enable SoundWire links with SOF. + If unsure select "N". + config SND_SOC_SOF_AMD_ACP63 tristate "SOF support for ACP6.3 platform" depends on SND_SOC_SOF_PCI diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 32a741fcb84f..f24cd6b7490f 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -491,6 +491,81 @@ int amd_sof_acp_resume(struct snd_sof_dev *sdev) } EXPORT_SYMBOL_NS(amd_sof_acp_resume, SND_SOC_SOF_AMD_COMMON); +#if IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_SOUNDWIRE) +static int acp_sof_scan_sdw_devices(struct snd_sof_dev *sdev, u64 addr) +{ + struct acpi_device *sdw_dev; + struct acp_dev_data *acp_data; + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); + + if (!addr) + return -ENODEV; + + acp_data = sdev->pdata->hw_pdata; + sdw_dev = acpi_find_child_device(ACPI_COMPANION(sdev->dev), addr, 0); + if (!sdw_dev) + return -ENODEV; + + acp_data->info.handle = sdw_dev->handle; + acp_data->info.count = desc->sdw_max_link_count; + + return amd_sdw_scan_controller(&acp_data->info); +} + +static int amd_sof_sdw_probe(struct snd_sof_dev *sdev) +{ + struct acp_dev_data *acp_data; + struct sdw_amd_res sdw_res; + int ret; + + acp_data = sdev->pdata->hw_pdata; + + memset(&sdw_res, 0, sizeof(sdw_res)); + sdw_res.addr = acp_data->addr; + sdw_res.reg_range = acp_data->reg_range; + sdw_res.handle = acp_data->info.handle; + sdw_res.parent = sdev->dev; + sdw_res.dev = sdev->dev; + sdw_res.acp_lock = &acp_data->acp_lock; + sdw_res.count = acp_data->info.count; + sdw_res.link_mask = acp_data->info.link_mask; + sdw_res.mmio_base = sdev->bar[ACP_DSP_BAR]; + + ret = sdw_amd_probe(&sdw_res, &acp_data->sdw); + if (ret) + dev_err(sdev->dev, "SoundWire probe failed\n"); + return ret; +} + +static int amd_sof_sdw_exit(struct snd_sof_dev *sdev) +{ + struct acp_dev_data *acp_data; + + acp_data = sdev->pdata->hw_pdata; + if (acp_data->sdw) + sdw_amd_exit(acp_data->sdw); + acp_data->sdw = NULL; + + return 0; +} + +#else +static int acp_sof_scan_sdw_devices(struct snd_sof_dev *sdev, u64 addr) +{ + return 0; +} + +static int amd_sof_sdw_probe(struct snd_sof_dev *sdev) +{ + return 0; +} + +static int amd_sof_sdw_exit(struct snd_sof_dev *sdev) +{ + return 0; +} +#endif + int amd_sof_acp_probe(struct snd_sof_dev *sdev) { struct pci_dev *pci = to_pci_dev(sdev->dev); @@ -527,7 +602,9 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) } pci_set_master(pci); - + adata->addr = addr; + adata->reg_range = chip->reg_end_addr - chip->reg_start_addr; + mutex_init(&adata->acp_lock); sdev->pdata->hw_pdata = adata; adata->smn_dev = pci_get_device(PCI_VENDOR_ID_AMD, chip->host_bridge_id, NULL); if (!adata->smn_dev) { @@ -549,6 +626,21 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) if (ret < 0) goto free_ipc_irq; + /* scan SoundWire capabilities exposed by DSDT */ + ret = acp_sof_scan_sdw_devices(sdev, chip->sdw_acpi_dev_addr); + if (ret < 0) { + dev_dbg(sdev->dev, "skipping SoundWire, not detected with ACPI scan\n"); + goto skip_soundwire; + } + ret = amd_sof_sdw_probe(sdev); + if (ret < 0) { + dev_err(sdev->dev, "error: SoundWire probe error\n"); + free_irq(sdev->ipc_irq, sdev); + pci_dev_put(adata->smn_dev); + return ret; + } + +skip_soundwire: sdev->dsp_box.offset = 0; sdev->dsp_box.size = BOX_SIZE_512; @@ -596,6 +688,9 @@ void amd_sof_acp_remove(struct snd_sof_dev *sdev) if (adata->smn_dev) pci_dev_put(adata->smn_dev); + if (adata->sdw) + amd_sof_sdw_exit(sdev); + if (sdev->ipc_irq) free_irq(sdev->ipc_irq, sdev); @@ -607,4 +702,6 @@ void amd_sof_acp_remove(struct snd_sof_dev *sdev) EXPORT_SYMBOL_NS(amd_sof_acp_remove, SND_SOC_SOF_AMD_COMMON); MODULE_DESCRIPTION("AMD ACP sof driver"); +MODULE_IMPORT_NS(SOUNDWIRE_AMD_INIT); +MODULE_IMPORT_NS(SND_AMD_SOUNDWIRE_ACPI); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index c645aee216fd..e88d01330ec7 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -12,7 +12,7 @@ #define __SOF_AMD_ACP_H #include - +#include #include "../sof-priv.h" #include "../sof-audio.h" @@ -191,6 +191,10 @@ struct sof_amd_acp_desc { u32 acp_clkmux_sel; u32 fusion_dsp_offset; u32 probe_reg_offset; + u32 reg_start_addr; + u32 reg_end_addr; + u32 sdw_max_link_count; + u64 sdw_acpi_dev_addr; }; /* Common device data struct for ACP devices */ @@ -199,6 +203,12 @@ struct acp_dev_data { const struct firmware *fw_dbin; /* DMIC device */ struct platform_device *dmic_dev; + /* mutex lock to protect ACP common registers access */ + struct mutex acp_lock; + /* ACPI information stored between scan and probe steps */ + struct sdw_amd_acpi_info info; + /* sdw context allocated by SoundWire driver */ + struct sdw_amd_ctx *sdw; unsigned int fw_bin_size; unsigned int fw_data_bin_size; unsigned int fw_sram_data_bin_size; @@ -207,6 +217,9 @@ struct acp_dev_data { const char *fw_sram_data_bin; u32 fw_bin_page_count; u32 fw_data_bin_page_count; + u32 addr; + u32 reg_range; + u32 blk_type; dma_addr_t sha_dma_addr; u8 *bin_buf; dma_addr_t dma_addr; From patchwork Mon Jan 22 09:24:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525010 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2EF03A1A0; Mon, 22 Jan 2024 09:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915557; cv=fail; b=Y/dZeB1sfW3YDp5JbLOWFMGLS0Z73NBcS55Csp15ICGf65eD/nUjhyL5bSDCbfAQb4tlRXWns05C0X/XGKIxwBYrW1jfOOFxusu3krtZj9Ya9ZwfYv/4dBwvJSf89OIOGeMi626j77Y+6uwxAyBCwUG7BcIDsRLZxW/TRst/xzo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915557; c=relaxed/simple; bh=31D+/hqwgpKoYAVDBrZ6wrGvL8bVEyF9/My6LklWUaI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cVGdDHr4Hju0jsceNyG0g/HyIDp4lRZKMnQmMhQi3hssW7gQ5GLiJGQ8PDnJLZkIRzoXzz+Qm/EzECW/MeE4s0LtnlwVEAKgsPNxGTIzNxYzXM+14UiG7oVuSu+iMqamceKH6RT3BJkGIzshZ5LWef5ctEzb4QqyfGW5/Bxb8l4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=zxXPv4WU; arc=fail smtp.client-ip=40.107.220.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="zxXPv4WU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WzLwel/QtPm1RD57aYF86XkZtQ5cmrna6uh9gwMIFmsqddG1+sQlReUNwmYd1jB7BOkTuSmxbFTYjUj30AyoEg3IJ59ICBZ9qFBzGwZLMZOeq1Xl7moIZU8knerlxjDEvEwhRTZGeSxA/b5whWXpsI/9GXsd/sq2iLEud81SZzCQKEEv2PIZCTqcJj8wrn0TZvnw5RgpOnyYbV6WQY0y0yhuIRykRz1ZSeounhzjgth8e1I3CKnDAd9rpvR06SvIhPv/H4Z+94rQxPI7QI4NSCecIl9IeFckArWlfmSqUR46BmPiwCi8eMxmhmI0fqIwRrw3D2Xn9E77qvHZJEaZtw== 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=WmSvbdZheoMbrfrMOra1kGeyoKcwdWWrtw+v++Bk0J8=; b=Bp3G+vVC5ex5mBPxBgxkOLUh2rjDgaQxOmvQOh9xtXPvrNDDh25oSYvkysoDshXc25Fha0LJze7F0+JSCGM7Mf4PdnPzE4V5sltUkJI0RD3fGTizyl2Fy27fc8hW7SMXNvBo16R5qbe126Aq5x22wVN1pRwjPKuxIZJQZx60IVG6w/gnkbrP31jLavm0M88hZ8iA9q//ffPexdgiuKvaoV5eqcFqGyj+6g+YhP/AZSszS5iAHXDMYoeRuF2/e+X/4MYFG7RLSY2fIlHgEdhejAVAstXj/G7F+s37FgyT7vF5spRFNogNd+lhku8OCoMJDkBl/b2OhBEhugATp+2nYw== 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 (0) 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=WmSvbdZheoMbrfrMOra1kGeyoKcwdWWrtw+v++Bk0J8=; b=zxXPv4WUbQCs8NIOA+bqIhalrD/vCYG4NS86GlZ8ZO65tJKTAjtWiSHubhqav4hRzRf+BtFl1af0qu1vXWB6NoXlovgtSlQmUE8SlY+M20+t2eq7P0GFA98E9GRJJM2P6yRIpXSTTXlDse/z3b7ho4w4s4OnKzEASEyOEXGgF6o= Received: from CY5P221CA0015.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:b::24) by LV2PR12MB5965.namprd12.prod.outlook.com (2603:10b6:408:172::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.29; Mon, 22 Jan 2024 09:25:53 +0000 Received: from CY4PEPF0000EE35.namprd05.prod.outlook.com (2603:10b6:930:b:cafe::9c) by CY5P221CA0015.outlook.office365.com (2603:10b6:930:b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 09:25:52 +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 CY4PEPF0000EE35.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Mon, 22 Jan 2024 09:25:52 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:25:51 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:25:46 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Peter Ujfalusi , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , Mastan Katragadda , V sujith kumar Reddy , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , "open list" Subject: [PATCH V3 08/13] ASoC: SOF: amd: add interrupt handling for SoundWire manager devices Date: Mon, 22 Jan 2024 14:54:30 +0530 Message-ID: <20240122092435.3791175-9-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE35:EE_|LV2PR12MB5965:EE_ X-MS-Office365-Filtering-Correlation-Id: a3022274-a6e8-429a-c2df-08dc1b2c2109 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ykObGMo0ZFmzr8bXObNGwFxvau3BxcEGaCB78PScgYYsNDaWvObvkM6f9640RJb/U1vouQGn7oqdeSjc4godb6XqxSOAI+3/nc3isCMY3LH94tOF35qUMGTzOM8EvGBCxZAe+JJoFHKIQCCps/eI6zLbwegLs1NI6SMxP/jlGot7sP+c7m/rb2TnDVtJVHfYdHQTlHagP9GiRATRa4YHst+AKqroTP2bmcAnKiaFNWkjTCqcqC8UpSlhYQog3riSh/gteIcCGoDmddFJxskZ7ojHKQGncCKAIXF5ghnK8utLO65VmU7PDqvlw7JKNmUjcBPps6Iral019xp7F9+XBuvaz/WH8ITXyYsmjIraPxrfUOUKyPQ8YSYKiXKhIL56LaT8xfAcwhiDXxTm9n+Fbv7/MdaaNrLujMSkThlMMb3UkrGGOPAhX9TMmttP+dzR0ms0dh/InF4e2jtSLOsi+CaqBoGeXUp4+9WChkrJfNPjx21Z69rzGhlc+t81nMOUFnLWtCbktER5LgCbwiEsIz9SEmH31SSKeZ9cR7otWfPEanZQj+u8uSyFjN9hmv2jCQ2y3wOawjk2hfP9MGOb8zDpdnB9qlRkoWsyoCl2utBkuH1zeFa0E3cydybUwty4g8uBiNpln22uOU4HxhHGHf+XBJBN8kiJERvT4Kaoff8K0GC9azHudRYbEjqkNJtJsuQOU5B7j2DCt4cOTS0QvHWMVpHKToawb0arSBnYsgw1YGLleegGmSJUowz45I19AjZkjfCd53ZwEDxhV38kLQ== 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:(13230031)(4636009)(136003)(39860400002)(346002)(396003)(376002)(230922051799003)(82310400011)(451199024)(1800799012)(186009)(64100799003)(36840700001)(46966006)(40470700004)(7416002)(8676002)(5660300002)(8936002)(2906002)(4326008)(70586007)(316002)(110136005)(86362001)(70206006)(54906003)(36756003)(36860700001)(47076005)(82740400003)(81166007)(356005)(2616005)(7696005)(6666004)(83380400001)(478600001)(26005)(1076003)(336012)(426003)(41300700001)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:25:52.5472 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3022274-a6e8-429a-c2df-08dc1b2c2109 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: CY4PEPF0000EE35.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5965 Add support for interrupt handling for soundwire manager platform devices. Signed-off-by: Vijendar Mukunda --- sound/soc/sof/amd/acp-dsp-offset.h | 4 ++++ sound/soc/sof/amd/acp.c | 38 +++++++++++++++++++++++++++++- sound/soc/sof/amd/acp.h | 5 ++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/amd/acp-dsp-offset.h b/sound/soc/sof/amd/acp-dsp-offset.h index a913f1cc4c80..7ba6492b8e99 100644 --- a/sound/soc/sof/amd/acp-dsp-offset.h +++ b/sound/soc/sof/amd/acp-dsp-offset.h @@ -78,6 +78,10 @@ #define ACP5X_AXI2DAGB_SEM_0 0x1884 #define ACP6X_AXI2DAGB_SEM_0 0x1874 +/* ACP common registers to report errors related to I2S & SoundWire interfaces */ +#define ACP_SW0_I2S_ERROR_REASON 0x18B4 +#define ACP_SW1_I2S_ERROR_REASON 0x1A50 + /* Registers from ACP_SHA block */ #define ACP_SHA_DSP_FW_QUALIFIER 0x1C70 #define ACP_SHA_DMA_CMD 0x1CB0 diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index f24cd6b7490f..7a34faae9889 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -375,10 +375,13 @@ static irqreturn_t acp_irq_thread(int irq, void *context) static irqreturn_t acp_irq_handler(int irq, void *dev_id) { + struct amd_sdw_manager *amd_manager; struct snd_sof_dev *sdev = dev_id; const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); + struct acp_dev_data *adata = sdev->pdata->hw_pdata; unsigned int base = desc->dsp_intr_base; unsigned int val; + int irq_flag = 0; val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + DSP_SW_INTR_STAT_OFFSET); if (val & ACP_DSP_TO_HOST_IRQ) { @@ -387,7 +390,38 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id) return IRQ_WAKE_THREAD; } - return IRQ_NONE; + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->ext_intr_stat); + if (val & ACP_SDW0_IRQ_MASK) { + amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev); + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_stat, ACP_SDW0_IRQ_MASK); + if (amd_manager) + schedule_work(&amd_manager->amd_sdw_irq_thread); + irq_flag = 1; + } + + if (val & ACP_ERROR_IRQ_MASK) { + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_stat, ACP_ERROR_IRQ_MASK); + snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + ACP_SW0_I2S_ERROR_REASON, 0); + snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + ACP_SW1_I2S_ERROR_REASON, 0); + snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + ACP_ERROR_STATUS, 0); + irq_flag = 1; + } + + if (desc->ext_intr_stat1) { + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->ext_intr_stat1); + if (val & ACP_SDW1_IRQ_MASK) { + amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev); + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_stat1, + ACP_SDW1_IRQ_MASK); + if (amd_manager) + schedule_work(&amd_manager->amd_sdw_irq_thread); + irq_flag = 1; + } + } + if (irq_flag) + return IRQ_HANDLED; + else + return IRQ_NONE; } static int acp_power_on(struct snd_sof_dev *sdev) @@ -443,6 +477,8 @@ static int acp_reset(struct snd_sof_dev *sdev) if (desc->ext_intr_enb) snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_enb, 0x01); + if (desc->ext_intr_cntl) + snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_cntl, ACP_ERROR_IRQ_MASK); return ret; } diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index e88d01330ec7..2058dae32659 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -93,6 +93,9 @@ #define PROBE_STATUS_BIT BIT(31) #define ACP_FIRMWARE_SIGNATURE 0x100 +#define ACP_ERROR_IRQ_MASK BIT(29) +#define ACP_SDW0_IRQ_MASK BIT(21) +#define ACP_SDW1_IRQ_MASK BIT(2) #define ACP_DEFAULT_SRAM_LENGTH 0x00080000 #define ACP_SRAM_PAGE_COUNT 128 @@ -184,7 +187,9 @@ struct sof_amd_acp_desc { unsigned int host_bridge_id; u32 pgfsm_base; u32 ext_intr_enb; + u32 ext_intr_cntl; u32 ext_intr_stat; + u32 ext_intr_stat1; u32 dsp_intr_base; u32 sram_pte_offset; u32 hw_semaphore_offset; From patchwork Mon Jan 22 09:24:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525011 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2048.outbound.protection.outlook.com [40.107.100.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDA6D3A1A0; Mon, 22 Jan 2024 09:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915567; cv=fail; b=CiSVbhz0rWRuG62ESuctAhKfB9fiyvZfazcNwdp1wH3ssvM7vmq+Kd28qlcnH501vK9zTXMZvT3ohAwvuEAHFVuQDmBk7t8olHhlWmscITPAV/Gi5ZiMGdgEzn9vGV98CRJMgcnSJgd6sNZI1DL/AfD+rekiTQDiJqWB8gchIMU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915567; c=relaxed/simple; bh=6Oh0AeqAs3GSRQ7LlJY6ezIsZ7gv2kjaHXykuOEAlAk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MAxUflbZj19949LshdhnDucco7bh5Jhh2HINqVyaSiQLuLeH1lln004lghjqLB6m4EjDrcxrSmVpxXoE3Ylg9Sow4XJbN5Ja5mbDEITvpEu9v8rGjPWgiwf3t1t46pelLs0rzyblQtErramURXbFAAhON+c4isZZgBMJLghMX/Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=X0wrMtiO; arc=fail smtp.client-ip=40.107.100.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="X0wrMtiO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cA9XNmCar8AQkkDXNIJVUXHw5sl50yAVDMJQv161/TzMvYR8x6EYp7PdXJ5zLUdUbd0UTb9qF01gqCX1Oh/y50LsiBgVNOwFx/ikAYfGVvopp1DNfZkttnOCNSBhWtynBBWt4gQ06PzoXQQKwz8MZBfcWmJP9m3AFFCRbtelt8Y2WTg1CZ5IiPcy+8QRnP/5A9pYPDlBMkXrbCHoGluAhnfB1afNIlJ0fH6boAmtf5DeRVNKVUnRt4NMoZyypSFaJka+/AXRJr6A2/dM+aWXy3U1vCqzOa3m+SqBZkG+Sn7rVm30x82mEAscEvFsu8ajj4mxHGdLdmDKM3wwR21IKw== 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=iPqL8D8sIUEJdIE9QqRF4FLGLmz9V6QPJ3PtGhXMEUs=; b=AsK9Db0ex62Uu40cnVjS6Lhi73vfEnPjeA5SsOXjAxpiqk/OquCxOiXZYjhiyVhSlQaP/amxHiGb+COmIRyZku4BhECbFfEd1taI/tqCw+axGO1QZwNcCpUw/0rzJ4HldQrShZsty0r3yu+ULvzq2wjy9EC/6UUMLAgUheRrjJlWNWKtfJ5syxBfXIPhHI5GpiqtKt45cW0aEAlb52L0yG3bVuEP6IRgvxmv3CAYxTONWSLL9omsjD+CBfed1WD7k4Z0gbVc045oDIg7IjBSAgHBpedrGTB/wU6vnm0yBZthYt1jH5S8ny6+BJcjQLii+QINfknyqABQ+Xn5Qo17Vw== 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 (0) 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=iPqL8D8sIUEJdIE9QqRF4FLGLmz9V6QPJ3PtGhXMEUs=; b=X0wrMtiOcljcVROipQDoEiYqQIXWguQfOXlFs0xUSmFhQW6q+LOHtPNhIvcVAxs+NXzi4jakiNKIOWDCIc6Z4I9IeOJMO82g9OroxzPOxfdKxC0TJwMeHjYJfGilVDm5zAmDvukMg1rCbmVMIZAknlnjB5Y+LumlSx3cHCBdWQQ= Received: from DM6PR21CA0029.namprd21.prod.outlook.com (2603:10b6:5:174::39) by SJ2PR12MB8875.namprd12.prod.outlook.com (2603:10b6:a03:543::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Mon, 22 Jan 2024 09:26:02 +0000 Received: from CY4PEPF0000EE30.namprd05.prod.outlook.com (2603:10b6:5:174:cafe::67) by DM6PR21CA0029.outlook.office365.com (2603:10b6:5:174::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.6 via Frontend Transport; Mon, 22 Jan 2024 09:26:02 +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 CY4PEPF0000EE30.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Mon, 22 Jan 2024 09:26:01 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:26:00 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:25:55 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Peter Ujfalusi , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jyri Sarha , Curtis Malainey , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" Subject: [PATCH V3 09/13] ASoC: SOF: amd: Add Soundwire DAI configuration support for AMD platforms Date: Mon, 22 Jan 2024 14:54:31 +0530 Message-ID: <20240122092435.3791175-10-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE30:EE_|SJ2PR12MB8875:EE_ X-MS-Office365-Filtering-Correlation-Id: a70e9a03-f69a-44cd-dd41-08dc1b2c26a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z+bS0DTjmPyW7sFRgu0tgUYGBm+sjusq9C6Sr5/s/NzmSLq9IeY4G9zZ7LjzhR3E3ai8QgplBfBj/RMzctsZKfFK2GENGuTdO4N89nAtC7gMiFmNAsKUbke3PwVyV54yAosF3sXMrk/OPw/+RDkRrd8d4KbVysC0QUb0J+KeHrHrVYOaOg9eT1DZCAIv/1n7JQxcjtsBZECc3cji+V+RU98vZvibrnUpVxmkwGEI0BazNjckspxbgHcYzZjYYkYoJVTusqf/KK/zPhJAv7UiB79JERuoVOcgFchi63KSxlXkuQnvUByGp+dIf7m+Dsefsyq7C56M/PALXUTdTjUYhKb0YPP1ShDiJDhZoEfrkX3gS0pQywx1nwzraN1ti4efAUmfrOGkVAozySeVv0asTH3U/gwZFGEdH/Ztf+p4OImhht1s+Ysa1MFzVHj+uSHlQ0HWgzl9LtjXN69ORac/T/0f6kfyvHxGaJ/Hu4Y1FM5a0RRSB5q16XCfWUhATxEXB88fq7Zb/lfQfmfKAYCZoXxbrjVjrlVduBbK9OxZHVGdPIWttj5FAdaYLvJxK4+7WhFonBu+awYlLOTjJ6ceVIV2sP1AzKasOxbXHYBTE7LMb9GtDU9WAqEjoN9m3BvBbWZuQrEouAa0drCdoSUwBbRR63khkn53a/mTHdn89aHARwHQh6T5iDEab2zCEkQopI8xi4RD5zqZfRoj/dnOkq8GlBKSD6JYixCF9jTaY50rnG+ctpKOuIIoli7Cpe0v4c28+tIami9f8dZox6QlBw== 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:(13230031)(4636009)(396003)(39860400002)(136003)(376002)(346002)(230922051799003)(82310400011)(451199024)(64100799003)(186009)(1800799012)(36840700001)(40470700004)(46966006)(81166007)(356005)(82740400003)(36756003)(40460700003)(40480700001)(86362001)(83380400001)(336012)(426003)(1076003)(26005)(2616005)(316002)(70206006)(70586007)(8676002)(8936002)(54906003)(7696005)(478600001)(6666004)(110136005)(47076005)(36860700001)(2906002)(41300700001)(4326008)(5660300002)(7416002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:26:01.9654 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a70e9a03-f69a-44cd-dd41-08dc1b2c26a6 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: CY4PEPF0000EE30.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8875 Add support for configuring AMD Soundwire DAI from topology. Signed-off-by: Vijendar Mukunda --- include/sound/sof/dai-amd.h | 7 ++++++ include/sound/sof/dai.h | 2 ++ include/uapi/sound/sof/tokens.h | 4 ++++ sound/soc/sof/ipc3-pcm.c | 25 +++++++++++++++++++++ sound/soc/sof/ipc3-topology.c | 40 +++++++++++++++++++++++++++++++++ sound/soc/sof/sof-audio.h | 1 + sound/soc/sof/topology.c | 5 +++++ 7 files changed, 84 insertions(+) diff --git a/include/sound/sof/dai-amd.h b/include/sound/sof/dai-amd.h index 9df7ac824efe..59cd014392c1 100644 --- a/include/sound/sof/dai-amd.h +++ b/include/sound/sof/dai-amd.h @@ -26,4 +26,11 @@ struct sof_ipc_dai_acpdmic_params { uint32_t pdm_ch; } __packed; +/* ACP_SDW Configuration Request - SOF_IPC_DAI_AMD_SDW_CONFIG */ +struct sof_ipc_dai_acp_sdw_params { + struct sof_ipc_hdr hdr; + u32 rate; + u32 channels; +} __packed; + #endif diff --git a/include/sound/sof/dai.h b/include/sound/sof/dai.h index 4773a5f616a4..0764a80c17a9 100644 --- a/include/sound/sof/dai.h +++ b/include/sound/sof/dai.h @@ -89,6 +89,7 @@ enum sof_ipc_dai_type { SOF_DAI_AMD_SP_VIRTUAL, /**< AMD ACP SP VIRTUAL */ SOF_DAI_AMD_HS_VIRTUAL, /**< AMD ACP HS VIRTUAL */ SOF_DAI_IMX_MICFIL, /** < i.MX MICFIL PDM */ + SOF_DAI_AMD_SDW, /**< AMD ACP SDW */ }; /* general purpose DAI configuration */ @@ -119,6 +120,7 @@ struct sof_ipc_dai_config { struct sof_ipc_dai_acp_params acphs; struct sof_ipc_dai_mtk_afe_params afe; struct sof_ipc_dai_micfil_params micfil; + struct sof_ipc_dai_acp_sdw_params acp_sdw; }; } __packed; diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h index ee5708934614..6bf00c09d30d 100644 --- a/include/uapi/sound/sof/tokens.h +++ b/include/uapi/sound/sof/tokens.h @@ -218,4 +218,8 @@ #define SOF_TKN_IMX_MICFIL_RATE 2000 #define SOF_TKN_IMX_MICFIL_CH 2001 +/* ACP SDW */ +#define SOF_TKN_AMD_ACP_SDW_RATE 2100 +#define SOF_TKN_AMD_ACP_SDW_CH 2101 + #endif diff --git a/sound/soc/sof/ipc3-pcm.c b/sound/soc/sof/ipc3-pcm.c index 330f04bcd75d..35769dd7905e 100644 --- a/sound/soc/sof/ipc3-pcm.c +++ b/sound/soc/sof/ipc3-pcm.c @@ -395,6 +395,31 @@ static int sof_ipc3_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, dev_dbg(component->dev, "MICFIL PDM channels_min: %d channels_max: %d\n", channels->min, channels->max); break; + case SOF_DAI_AMD_SDW: + /* change the default trigger sequence as per HW implementation */ + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) { + struct snd_soc_pcm_runtime *fe = dpcm->fe; + + fe->dai_link->trigger[SNDRV_PCM_STREAM_PLAYBACK] = + SND_SOC_DPCM_TRIGGER_POST; + } + + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) { + struct snd_soc_pcm_runtime *fe = dpcm->fe; + + fe->dai_link->trigger[SNDRV_PCM_STREAM_CAPTURE] = + SND_SOC_DPCM_TRIGGER_POST; + } + rate->min = private->dai_config->acp_sdw.rate; + rate->max = private->dai_config->acp_sdw.rate; + channels->min = private->dai_config->acp_sdw.channels; + channels->max = private->dai_config->acp_sdw.channels; + + dev_dbg(component->dev, + "AMD_SDW rate_min: %d rate_max: %d\n", rate->min, rate->max); + dev_dbg(component->dev, "AMD_SDW channels_min: %d channels_max: %d\n", + channels->min, channels->max); + break; default: dev_err(component->dev, "Invalid DAI type %d\n", private->dai_config->type); break; diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index a8832a1c1a24..0970dbdfa78a 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -298,6 +298,14 @@ static const struct sof_topology_token micfil_pdm_tokens[] = { offsetof(struct sof_ipc_dai_micfil_params, pdm_ch)}, }; +/* ACP_SDW */ +static const struct sof_topology_token acp_sdw_tokens[] = { + {SOF_TKN_AMD_ACP_SDW_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_dai_acp_sdw_params, rate)}, + {SOF_TKN_AMD_ACP_SDW_CH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_dai_acp_sdw_params, channels)}, +}; + /* Core tokens */ static const struct sof_topology_token core_tokens[] = { {SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, @@ -336,6 +344,7 @@ static const struct sof_token_info ipc3_token_list[SOF_TOKEN_COUNT] = { [SOF_ACPI2S_TOKENS] = {"ACPI2S tokens", acpi2s_tokens, ARRAY_SIZE(acpi2s_tokens)}, [SOF_MICFIL_TOKENS] = {"MICFIL PDM tokens", micfil_pdm_tokens, ARRAY_SIZE(micfil_pdm_tokens)}, + [SOF_ACP_SDW_TOKENS] = {"ACP_SDW tokens", acp_sdw_tokens, ARRAY_SIZE(acp_sdw_tokens)}, }; /** @@ -1315,6 +1324,34 @@ static int sof_link_acp_hs_load(struct snd_soc_component *scomp, struct snd_sof_ return 0; } +static int sof_link_acp_sdw_load(struct snd_soc_component *scomp, struct snd_sof_dai_link *slink, + struct sof_ipc_dai_config *config, struct snd_sof_dai *dai) +{ + struct sof_dai_private_data *private = dai->private; + u32 size = sizeof(*config); + int ret; + + /* parse the required set of ACP_SDW tokens based on num_hw_cfgs */ + ret = sof_update_ipc_object(scomp, &config->acp_sdw, SOF_ACP_SDW_TOKENS, slink->tuples, + slink->num_tuples, size, slink->num_hw_configs); + if (ret < 0) + return ret; + + /* init IPC */ + config->hdr.size = size; + dev_dbg(scomp->dev, "ACP SDW config rate %d channels %d\n", + config->acp_sdw.rate, config->acp_sdw.channels); + + /* set config for all DAI's with name matching the link name */ + dai->number_configs = 1; + dai->current_config = 0; + private->dai_config = kmemdup(config, size, GFP_KERNEL); + if (!private->dai_config) + return -ENOMEM; + + return 0; +} + static int sof_link_afe_load(struct snd_soc_component *scomp, struct snd_sof_dai_link *slink, struct sof_ipc_dai_config *config, struct snd_sof_dai *dai) { @@ -1629,6 +1666,9 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget) case SOF_DAI_MEDIATEK_AFE: ret = sof_link_afe_load(scomp, slink, config, dai); break; + case SOF_DAI_AMD_SDW: + ret = sof_link_acp_sdw_load(scomp, slink, config, dai); + break; default: break; } diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 8874ee5f557f..f98242a404db 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -276,6 +276,7 @@ enum sof_tokens { SOF_ACPDMIC_TOKENS, SOF_ACPI2S_TOKENS, SOF_MICFIL_TOKENS, + SOF_ACP_SDW_TOKENS, /* this should be the last */ SOF_TOKEN_COUNT, diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 617a225fff24..25fb0d1443b6 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -297,6 +297,7 @@ static const struct sof_dai_types sof_dais[] = { {"ACPSP_VIRTUAL", SOF_DAI_AMD_SP_VIRTUAL}, {"ACPHS_VIRTUAL", SOF_DAI_AMD_HS_VIRTUAL}, {"MICFIL", SOF_DAI_IMX_MICFIL}, + {"ACP_SDW", SOF_DAI_AMD_SDW}, }; @@ -1968,6 +1969,10 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, struct snd_ token_id = SOF_MICFIL_TOKENS; num_tuples += token_list[SOF_MICFIL_TOKENS].count; break; + case SOF_DAI_AMD_SDW: + token_id = SOF_ACP_SDW_TOKENS; + num_tuples += token_list[SOF_ACP_SDW_TOKENS].count; + break; default: break; } From patchwork Mon Jan 22 09:24:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525012 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2080.outbound.protection.outlook.com [40.107.94.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFB093A1D8; Mon, 22 Jan 2024 09:26:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915576; cv=fail; b=AHGdS4W4/6ujxzhobgKKdPs2Z4GZ9QCbUqTfmo2V+am8vi0pcvZsvOMS8flXak2HcTTr8vCxY+nigQUv4Yw+fzJW/kmpGXq295+uppsaDocgIhEQl8QKQFtcrpaogNYwdf4REVxJIBJ0uGz0HvMf3rXaD5Wa2qXT6TQOSswWJmU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915576; c=relaxed/simple; bh=X1rCHQReBAc6/5R4G28cNMYQ+KwZYl8KhiE09u+h2fc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jgpUabYG4U1aRjD4X0CN2UBNH1AZ0JJ01eesFzYcz0hrmB4Xx+3/m0sly1OPqqR9Y5RIHdcxOnkAIqv+nOvgRchMvIa61jSAtyvaVl1LnLXo2niSSkUlYAdK+hEYlsjZ1sr4Xj/kA5lNKAwoJBpWuCJTeZvN/EY3uVqad4YhvFc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=eqO32JbV; arc=fail smtp.client-ip=40.107.94.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="eqO32JbV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b9PhZC2hi6AmqXNhgjMwj51pEQGz2+5xSCFrLbLh+zZT/PNEUSKYBcybHhLPot9Tcg9UcA2mbHO34yOV2Z9zjcvekqWY8oqZp14/7U2PrK+AeXkWiIT65iXSKfWzvo82VXdvmLE3IQs2254RPpQbpAhnHMkLZ5GHoURS1viHxK1oClRQd2ZTZrt2o45aT5V9DgHMMFNMvWfQYFJ4/zmoq4pc0WEL6+2RsJN5b41fln4eHlObp97ATYnwMxNvKaJK/DjXeEsZ9D7qDj/eBL4eWWH6UuFfqJJww0Pn7L0BBshFJ+KC2y5a5JZ+rcjpiQqJhfv1CYiv28kigsyd8VuQpw== 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=+omCGRhppcTZgY3hpYmOov+emvix6/ZrChbQ00XGnbg=; b=aXwnbJIx+a13WJXHzMo4y19Gl5haTsjQWX5cxdlGFxJvE3TXYniu+87HHNWEGEeldllU3RxsgycSb605JAE1dLp0xXHsWCqJ8YiU6I3tgppR6Rz4vXcySWNn+CP0b2oDIlWwD0ZEh+J3eX/SJJdpffixgXcMhSfxW4FZ6due039tVcBtbhnu5JCt08+2DprabtABHNFXlssFiGGObya2PQUvmwSJ0oQlHsKy2TX5xzvZ3ieCDJo97lqKOiA0pLgmKpvj/RH2guzfK+7/zWKrQq5qeFArppPBxtxHKmnnP2xAA4IXkUVs4YG0VD04AqqClXMEAQjxtqZrpyErCXvQRg== 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 (0) 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=+omCGRhppcTZgY3hpYmOov+emvix6/ZrChbQ00XGnbg=; b=eqO32JbVAUMOWDhoQc+ktw0+/poD9IXqKsD/wwUdHEPuJgGCizUEiZ43OfCIzEvyAftkruXo31ap7d84UhRD7dYH3Jzy2bby6pQhKlKyDxzL3AxowzGXJitOwzNsvWAPjUzxlgEOdRsk4OdoTSmqTPOf/oDl4CHPEl/KWB0O8z8= Received: from CY5PR15CA0078.namprd15.prod.outlook.com (2603:10b6:930:18::14) by CH2PR12MB4102.namprd12.prod.outlook.com (2603:10b6:610:a9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Mon, 22 Jan 2024 09:26:11 +0000 Received: from CY4PEPF0000E9D8.namprd05.prod.outlook.com (2603:10b6:930:18:cafe::e9) by CY5PR15CA0078.outlook.office365.com (2603:10b6:930:18::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 09:26:10 +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 CY4PEPF0000E9D8.mail.protection.outlook.com (10.167.241.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:26:10 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:26:09 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:26:04 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Peter Ujfalusi , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Wang Jinchao , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH V3 10/13] ASoC: SOF: amd: add machine select logic for soundwire based platforms Date: Mon, 22 Jan 2024 14:54:32 +0530 Message-ID: <20240122092435.3791175-11-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D8:EE_|CH2PR12MB4102:EE_ X-MS-Office365-Filtering-Correlation-Id: badfce2a-9033-4911-749f-08dc1b2c2bc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LE0l9mbTlz5qtF69FAzB0/XZfZZz4gun3uSkWLah7WvjqlrctzpDOfNY1+Bo5hHHsRQ870SuDio15GbZoW9doDpGq3qpwqm2lPioqmk5MSMztsoySzYAvul8/HWbiubCP8GU+69esubgwqlP6Hs5bJ+czPE4W3OzhxnxrP7PmnPXUDO9w8Ky9STQL0l7rosYfnJKrMD7h1sLA70MtNy80t03vznN5eIbD/Sqg43WpHQqcAG07/MmgMEsE2uVGbuSrSdwgIyAWJ9QB+4eKkYoTi0z+JD2c8IciXdt/CYsQISnwZvJphX0X+qAZ/4cmgCN4A8QS1eZTIRdIwc47b+v6gG4LFKCP8VLqGXDI4MMlpVYZhxXGiIsLsoUcKo2F5K9RBXqQRkEADZquDyfT1nRLAq73XdEY19bAyfgGdXooX2JFpce2k48UraQ7TX8m0pp7+5wNUuBUAkaq7Br/aHaU2k+6XkC4PTVkeKoQLOfJWy8gnFxvd0fVB8lezR7Iplrhv/4IbKfyxwVdprYH5oQJncfGYM0RQyVMNI42iX+rUXTyXXrAVhtrygP+EiR18+yzJyu4ShghsP2r0L2MTF+cldAcqr6yJEPH4u5rEgNXC0OSCs3ohAA7YADTbPJMwMW9iV9ElYQWBYCw8eK4ddAugUgEO03IoFRsSTDucIjOxWVsqhxR8PqW3eYSJBQj/ZrtF59PYAWnVbReALJXQ5HxLEvcFBGSBOmzSRbd+gFzxnjScTtA6VrucoTnG5WNQRD5TsWOyxWfLp0PTAwkFd+dQ== 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:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(82310400011)(46966006)(36840700001)(40470700004)(40460700003)(40480700001)(6666004)(7696005)(336012)(426003)(1076003)(26005)(2616005)(81166007)(86362001)(82740400003)(356005)(36756003)(41300700001)(83380400001)(36860700001)(5660300002)(7416002)(2906002)(47076005)(4326008)(8676002)(8936002)(478600001)(110136005)(70206006)(70586007)(316002)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:26:10.5767 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: badfce2a-9033-4911-749f-08dc1b2c2bc6 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: CY4PEPF0000E9D8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4102 Add machine select logic for soundwire endpoints for AMD platforms. Signed-off-by: Vijendar Mukunda --- sound/soc/sof/amd/acp-common.c | 65 +++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/amd/acp-common.c b/sound/soc/sof/amd/acp-common.c index 2d72c6d55dc8..0fc4e20ec673 100644 --- a/sound/soc/sof/amd/acp-common.c +++ b/sound/soc/sof/amd/acp-common.c @@ -118,16 +118,72 @@ void amd_sof_dump(struct snd_sof_dev *sdev, u32 flags) &panic_info, stack, AMD_STACK_DUMP_SIZE); } +#if IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_SOUNDWIRE) +static int amd_sof_sdw_get_slave_info(struct snd_sof_dev *sdev) +{ + struct acp_dev_data *acp_data = sdev->pdata->hw_pdata; + + return sdw_amd_get_slave_info(acp_data->sdw); +} + +static struct snd_soc_acpi_mach *amd_sof_sdw_machine_select(struct snd_sof_dev *sdev) +{ + struct snd_soc_acpi_mach *mach; + const struct snd_soc_acpi_link_adr *link; + struct acp_dev_data *acp_data = sdev->pdata->hw_pdata; + int ret, i; + + if (acp_data->info.count) { + ret = amd_sof_sdw_get_slave_info(sdev); + if (ret) { + dev_info(sdev->dev, "failed to read slave information\n"); + return NULL; + } + for (mach = sdev->pdata->desc->alt_machines; mach; mach++) { + if (!mach->links) + break; + link = mach->links; + for (i = 0; i < acp_data->info.count && link->num_adr; link++, i++) { + if (!snd_soc_acpi_sdw_link_slaves_found(sdev->dev, link, + acp_data->sdw->ids, + acp_data->sdw->num_slaves)) + break; + } + if (i == acp_data->info.count || !link->num_adr) + break; + } + if (mach && mach->link_mask) { + mach->mach_params.links = mach->links; + mach->mach_params.link_mask = mach->link_mask; + mach->mach_params.platform = dev_name(sdev->dev); + return mach; + } + } + dev_info(sdev->dev, "No SoundWire machine driver found\n"); + return NULL; +} + +#else +static struct snd_soc_acpi_mach *amd_sof_sdw_machine_select(struct snd_sof_dev *sdev) +{ + return NULL; +} +#endif + struct snd_soc_acpi_mach *amd_sof_machine_select(struct snd_sof_dev *sdev) { struct snd_sof_pdata *sof_pdata = sdev->pdata; const struct sof_dev_desc *desc = sof_pdata->desc; - struct snd_soc_acpi_mach *mach; + struct snd_soc_acpi_mach *mach = NULL; - mach = snd_soc_acpi_find_machine(desc->machines); + if (desc->machines) + mach = snd_soc_acpi_find_machine(desc->machines); if (!mach) { - dev_warn(sdev->dev, "No matching ASoC machine driver found\n"); - return NULL; + mach = amd_sof_sdw_machine_select(sdev); + if (!mach) { + dev_warn(sdev->dev, "No matching ASoC machine driver found\n"); + return NULL; + } } sof_pdata->tplg_filename = mach->sof_tplg_filename; @@ -204,5 +260,6 @@ EXPORT_SYMBOL_NS(sof_acp_common_ops, SND_SOC_SOF_AMD_COMMON); MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); +MODULE_IMPORT_NS(SOUNDWIRE_AMD_INIT); MODULE_DESCRIPTION("ACP SOF COMMON Driver"); MODULE_LICENSE("Dual BSD/GPL"); From patchwork Mon Jan 22 09:24:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525013 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2079.outbound.protection.outlook.com [40.107.95.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 351FF3A264; Mon, 22 Jan 2024 09:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915591; cv=fail; b=Q0cfwjQ83RT89RkSIBsDRuMqnVbWFWQLhv/aoRDzyoqPob+EnMh/NRlMelM7VYKyooQs6L5oPoPXnUA6AYtfgRam4muQisbMnigNuQO23/23veZEtXIdk8QIepkBg/gFqoRcSxTzvmRh8GsPFmbBQNIxXeBokV0uZvSagEC2x70= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915591; c=relaxed/simple; bh=ymemvslKkhYGpyHpqh6Q/7RrSZIdxNF0MnFMcoOfCNo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=M0YCyciKlPfnJf+9ZiL/AWw3+5O62vTAnnn3WezipNvRZwzbhu6rtcjbw19R0DTHPx2BaZ5fBBNojWWD4vjKiXyp9ROeutaZ5rRFg+B9tz9awHirpK4f0SARS/bk2OLzFjOUJvmgMLHJFzWJ9zcj5qRpKZ+KMuAHteiysGzm4A8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=VvEsQEFn; arc=fail smtp.client-ip=40.107.95.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VvEsQEFn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YrVYa/gOKEJPLN5FTm8eBd4gn2hDhEud1vYrUdu0F8dIWKoBHyhtLgbZ8dBcLjKJk3OIagQBcNFRRrsyAfahI7t6X/T99cPNul86pgSDj/KXjtj+8gSxSW69sSWRqR1+B9r5TeN28jWV9TVZbvLCNfaNcNGmvHoZi7dNcOXVOu+0eJm5Y6GeffJnBeN4pUSgmLMe5tB3WuXlV28zSDfYa/znu1BTnaHEQJx3Qe0X4D+fxrf/aTkFp0wf5f+XkhcIaNAYQjuHN9iH2v5khbxOO80iHX3PcKC5jtBvOHfQ7Th7vG7rexY5qXNZR/o+L0U7ZKajuCPDkfWxJFGVDFImiw== 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=jtvoCZz8VSf1VRSZDCxvonKGlPrjlVR/2Z+SSopunkg=; b=OzBftTZBzT9hxmN4PKmDnaBsdwNdTA6LnIYcCvmMJAhrn5MMLCygeXhZ6RgazmqhAWDg1gaLZAULohAJ6fsxDWiYJnVvrk2Z6Ae5guirIKgb1cUkXuCINBemDkXsnTjaJDuJk6Yl9fwIFwICj8Ww4zax0olDJcQnNWPdqWZ3rrhlTdOq14J1FjmBavTMVVttDNTaausU/ZwwVkTCZicfLYrifjBej3YS9UE68WXzeESiNSFY+43S+iEB5I451vSa0kU7qR4LHgX9DLNv6S1izni2CfDux0C8dbKQz4g4aQEEZH2prr/yAbCnIc0Pr1VOfHqbFyim+rJOV5tVvt6AOQ== 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 (0) 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=jtvoCZz8VSf1VRSZDCxvonKGlPrjlVR/2Z+SSopunkg=; b=VvEsQEFnQCxbeoplpyosBHcHKHhcm1UvEnLTVe9Rymwd0dhwE7yD9GA5WO+mmrwOa/RjCg9M8UomGjAR8Bje4XBPYFyarZO3VV2C5x+SFn/wihVHxma8BGdPzr52rlVElH50Q9+DGZizE4SwgB0B9gv6TJi9LiYqdc5lybYVd4E= Received: from DS7PR03CA0261.namprd03.prod.outlook.com (2603:10b6:5:3b3::26) by BL1PR12MB5364.namprd12.prod.outlook.com (2603:10b6:208:314::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Mon, 22 Jan 2024 09:26:27 +0000 Received: from CY4PEPF0000E9D5.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::ce) by DS7PR03CA0261.outlook.office365.com (2603:10b6:5:3b3::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 09:26:27 +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 CY4PEPF0000E9D5.mail.protection.outlook.com (10.167.241.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:26:26 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.34; Mon, 22 Jan 2024 03:26:25 -0600 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:26:20 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Peter Ujfalusi , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Mastan Katragadda , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH V3 11/13] ASoC: SOF: amd: update descriptor fields for acp6.3 based platform Date: Mon, 22 Jan 2024 14:54:33 +0530 Message-ID: <20240122092435.3791175-12-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D5:EE_|BL1PR12MB5364:EE_ X-MS-Office365-Filtering-Correlation-Id: 515f1ce4-10f2-40b1-7ca8-08dc1b2c3592 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xvkfuzRopq1jcnbeebO2N6B8XbHpeCY05Ch1iBkip/ESuBtnfmlrciky2mt7JPZ3OGMgwzc4ZKhEJxwsA66KQfux3gX1qrxjlqqMwmz0hsNuYqTnzYxDWi/EhXYD70bNrIoR5uy3qdouOxaTKrjp8S4xhRrtIgZzcFeessiklNG3bbShfCfZ877GYDXVJd54gDcevYZJ0ES8+7mAmYxssDB6gHn/DdznnsI/3cviIipVYy4AFdzjJx3+YuOHeTr067pcD1irk92gcVpd4oBrvuOO8yTu5oks257j87h107VqM8lX8jZSIydRchiAZg440ur5dmXojcDeebL7Yiv/BjtjTX/kFmilQoYAdNrNHUOGnQvRhA7FSzY+E8f0q2EBpi25QrmTjzkc1FPA05IpUaT7JrB4xarvLzVm9KHjN/Qsichd5Lppw84gF6jE52jcfbRvQAZUkae3qkqUzTpTUDY/XaSzVTwN889IVZ0kTaXQQubtYbFchAB7wVIdeqvZfGiGwsMZmBxPOSNV72QGlIy/YvAqTzyQBzALCIGgYdqpnKIpTFkIyKUvUpISucitZjUbjb5Kq9iQuQfUb3jVC5SW0B+BtjwmvK2kgPntotK2bhVOBmFhu1qaP6BwxSvHPxSkAghAsb+KDcPRZIbxLYa7FZZO6s/OhNTBL5eFlJh7VoWOZkliMLiK3FDYRAQnSr6vwQCO97h4iz93uvE7VCuygeDBKs2BgxtRMlbcfb9bonve2R8GRqAhaMS+/fskUd7i23jKZNYg4vhauJlyeU/ZpM1V2ALVI2aY1nplAn+iKuO70NmvYUAMxhgyZPqG 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:(13230031)(4636009)(39860400002)(396003)(346002)(376002)(136003)(230173577357003)(230273577357003)(230922051799003)(1800799012)(82310400011)(64100799003)(186009)(451199024)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(2906002)(7416002)(5660300002)(15650500001)(8936002)(8676002)(4326008)(70206006)(70586007)(54906003)(110136005)(6666004)(7696005)(41300700001)(36860700001)(316002)(82740400003)(356005)(81166007)(478600001)(36756003)(86362001)(47076005)(426003)(336012)(26005)(2616005)(1076003)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:26:26.9977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 515f1ce4-10f2-40b1-7ca8-08dc1b2c3592 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: CY4PEPF0000E9D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5364 Update acp descriptor fields for acp6.3 version based platform. Signed-off-by: Vijendar Mukunda --- sound/soc/sof/amd/acp-dsp-offset.h | 3 +++ sound/soc/sof/amd/acp.h | 2 ++ sound/soc/sof/amd/pci-acp63.c | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/sound/soc/sof/amd/acp-dsp-offset.h b/sound/soc/sof/amd/acp-dsp-offset.h index 7ba6492b8e99..c1bdc028a61a 100644 --- a/sound/soc/sof/amd/acp-dsp-offset.h +++ b/sound/soc/sof/amd/acp-dsp-offset.h @@ -65,7 +65,10 @@ /* Registers from ACP_INTR block */ #define ACP3X_EXT_INTR_STAT 0x1808 #define ACP5X_EXT_INTR_STAT 0x1808 +#define ACP6X_EXTERNAL_INTR_ENB 0x1A00 +#define ACP6X_EXTERNAL_INTR_CNTL 0x1A04 #define ACP6X_EXT_INTR_STAT 0x1A0C +#define ACP6X_EXT_INTR_STAT1 0x1A10 #define ACP3X_DSP_SW_INTR_BASE 0x1814 #define ACP5X_DSP_SW_INTR_BASE 0x1814 diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index 2058dae32659..e94713d7ff1d 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -96,8 +96,10 @@ #define ACP_ERROR_IRQ_MASK BIT(29) #define ACP_SDW0_IRQ_MASK BIT(21) #define ACP_SDW1_IRQ_MASK BIT(2) +#define SDW_ACPI_ADDR_ACP63 5 #define ACP_DEFAULT_SRAM_LENGTH 0x00080000 #define ACP_SRAM_PAGE_COUNT 128 +#define ACP6X_SDW_MAX_MANAGER_COUNT 2 enum clock_source { ACP_CLOCK_96M = 0, diff --git a/sound/soc/sof/amd/pci-acp63.c b/sound/soc/sof/amd/pci-acp63.c index bceb94ac80a9..eeaa12cceb23 100644 --- a/sound/soc/sof/amd/pci-acp63.c +++ b/sound/soc/sof/amd/pci-acp63.c @@ -31,12 +31,19 @@ static const struct sof_amd_acp_desc acp63_chip_info = { .rev = 6, .host_bridge_id = HOST_BRIDGE_ACP63, .pgfsm_base = ACP6X_PGFSM_BASE, + .ext_intr_enb = ACP6X_EXTERNAL_INTR_ENB, + .ext_intr_cntl = ACP6X_EXTERNAL_INTR_CNTL, .ext_intr_stat = ACP6X_EXT_INTR_STAT, + .ext_intr_stat1 = ACP6X_EXT_INTR_STAT1, .dsp_intr_base = ACP6X_DSP_SW_INTR_BASE, .sram_pte_offset = ACP6X_SRAM_PTE_OFFSET, .hw_semaphore_offset = ACP6X_AXI2DAGB_SEM_0, .fusion_dsp_offset = ACP6X_DSP_FUSION_RUNSTALL, .probe_reg_offset = ACP6X_FUTURE_REG_ACLK_0, + .sdw_max_link_count = ACP6X_SDW_MAX_MANAGER_COUNT, + .sdw_acpi_dev_addr = SDW_ACPI_ADDR_ACP63, + .reg_start_addr = ACP6x_REG_START, + .reg_end_addr = ACP6x_REG_END, }; static const struct sof_dev_desc acp63_desc = { From patchwork Mon Jan 22 09:24:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525014 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 201853A268; Mon, 22 Jan 2024 09:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915600; cv=fail; b=iyDV0qEZ0urTpgy2W8uYBgZfxn4XO8sYd0F9vsH9OnPr9DR4i1DjOmjQCgnnA3LmomPiaR04N8M7NVn36LpP4EpuITq6l19kpvGYisWCYmPAQBsOaAKYDOHCTBGosLCY5ngLBbeHpvnaCh5bcNUHJtc2pdYBeg8t6QOFaxtyVhM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915600; c=relaxed/simple; bh=Ry0H129l7q0hv1pjs+h8ycQ9d7RRzP/o20mIdnuNtvE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YHXdnYTIO6slr+OZPq2b2M2U/yXxSPuviHN7/p3fUisjZG34EfdMj1gZE0P1J1EQlTNM1znVM/4mVjFhnHcLDq1O9ILy9ByC0bYVCw/+wGdybKjQfq3z90xW5y08JI2PXecWsb9UA8Ac9hwCc1YgDWBfSJkndIN1Tu4b/B9kiq0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=eJRiotnd; arc=fail smtp.client-ip=40.107.94.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="eJRiotnd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nS+dO3DAkB2cGyBGksrN5ESGYMax9JcD4PynS6vB9KMqvfxzzEqAPJOonN4sLAI/mLlQ2Ed5OyqNNFgy61+YRYFl+YseiuzuorMBHMdJ0C3Tevh2MmbAh72bzKUaDGQ4mafBYGUGNPN/fVFbTD1WKw19E+lykeWU7CXEJi6J5Io05bTrjbpUd5idMilMMJLRSEw3tfjeSQr/WWid2OaixPSmrP1zWoG/zQELw3Wa8cp66WfGC+A9xgZbmHbS8Jf8sd34/MhO8OkQZNm55eY+IJZN96FzueZdKnFw/G04Lp5o9TaTkQvyCrSMZX1Bjy8Idf977P4mctXTMAYUVnDDPw== 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=TM5IfcLFOV5I+4SsS+sfeBeWW0qVpPfMyKw8GVqZb7k=; b=Cgf4wSRcs6Tc/NeKmSGPoikdDj30justanIi4GwvEDjgAMQP2dEDKpCLBNQvcmvWilso6wSKWrZ5MX9Jf85U2yPFlg8S56Xekg3yu6Dacnd4iE1t2+BV/M9+L/jkLyZjh6Gwr7zVt8tpq5pHkQIeGxYBflX8tx+fiiGeLf/HjosxFaI6kDwmxYPtzhNgYPyvB4RdfNYeCquvRbjC6nWmpnRzrgOUYNdKPjos1B55g7LlIUwN1IVnzoQg7xlUJ5qjcXnCpV+TSw1Yt6Elgl/hM8x+XsxnR8iQk3M5iTKuYW5nT8QcOnZb2OZMDUQvTX2YEtK9UxgWDalQfvYA78NU+Q== 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 (0) 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=TM5IfcLFOV5I+4SsS+sfeBeWW0qVpPfMyKw8GVqZb7k=; b=eJRiotndKhWQ5yhMBnW6n9h4TVnw0BWW1hIwjz6AjBnveos7xnqktFTau8jtQEt8/MHBEcbhbNeVOrO/8uAKCBxi8u2rrBuNn6QtklOOYHZzop7y7gh0bz7LkiO5q80yt/TElRMQ8sTDO5p4yJisVTLNK3PMLCFDw4iFai4UUgE= Received: from CY5PR19CA0035.namprd19.prod.outlook.com (2603:10b6:930:1a::11) by CYYPR12MB8704.namprd12.prod.outlook.com (2603:10b6:930:c2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 09:26:35 +0000 Received: from CY4PEPF0000E9DB.namprd05.prod.outlook.com (2603:10b6:930:1a:cafe::fb) by CY5PR19CA0035.outlook.office365.com (2603:10b6:930:1a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34 via Frontend Transport; Mon, 22 Jan 2024 09:26:35 +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 CY4PEPF0000E9DB.mail.protection.outlook.com (10.167.241.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:26:34 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2507.34; Mon, 22 Jan 2024 03:26:34 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 22 Jan 2024 01:26:34 -0800 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:26:29 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Peter Ujfalusi , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , "open list" Subject: [PATCH V3 12/13] ASoC: SOF: amd: select soundwire dependency flag for acp6.3 based platform Date: Mon, 22 Jan 2024 14:54:34 +0530 Message-ID: <20240122092435.3791175-13-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DB:EE_|CYYPR12MB8704:EE_ X-MS-Office365-Filtering-Correlation-Id: fbae746f-1481-4b9a-b412-08dc1b2c3a33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1SfefLFk8y1wt6IPTCWR85zCqTzKzl3DPlD8YbjXbr79JYOAJvHiRqhH3C300KoDO3uYlEsImKfDtZTKfrB+DMYz/1SIRgi0a1Q0dGQF2/sQADj1CL9ry8VlG87sGV4xbR6a9nbBsBLb3PBrxl1Qgf69aJC0rAz0Gutv4AB7CeMpwtpBqBVFYYrdtWIg0p3sM9HXKljP11pcBsjKkL4Avsg4kew9CQO5fxUI3QShGL6rtLSucU4cGCbrX1re6q8k7Ixz9hTzveHMmam915pyqU261KHXdHAsT4grGiUY/YHG5wc6ieH6PiWPiu39m8w6tuDry9Mv1nlKpgaodAUZChl87saU7ktjdKoSppd4z++iRibRP17buYYAs8kZKBNgiAs9PCHvme8ZrVSSki6daXwOXSiA50/oKdklc7kxlSglz5u1POGuohVFdBz+cqdQEmM6qmiUNECtfCYnLCsM6MvREqJPvw+oTnKYrmxABq0FZh+KHnpU53lkEZ8cwySKNsi5DUfxop4bWGZT45twE1sOqB2Nx2zEKJLTYAr+ECXR0Oen+oa4m6/212PfMtC6oKAZglw/FLJnDWTfLQAeHoazUYVK63oV9IR2CSbQa12TcdaE5Yvte7zXxdCw31as0b2+H5tvN/jvIzVL1SzFqzEOnvRvBbnTpRutZHqwQ2ecCJL2Emi/KvSmJkWB4THNUKwaCt9vHMkb3KU4RXZnpKPKifOOLlbctV1p9lrg1qdjmyiv3RT+M3j4WFrlgK3VV2p1Vf2Kke+D2nRhiGDroA== 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:(13230031)(4636009)(136003)(396003)(346002)(376002)(39860400002)(230922051799003)(82310400011)(186009)(1800799012)(64100799003)(451199024)(36840700001)(40470700004)(46966006)(40480700001)(40460700003)(4326008)(1076003)(8676002)(426003)(6666004)(4744005)(336012)(2906002)(26005)(36860700001)(70586007)(356005)(54906003)(82740400003)(70206006)(8936002)(316002)(7416002)(5660300002)(47076005)(478600001)(2616005)(110136005)(81166007)(86362001)(41300700001)(7696005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:26:34.7808 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fbae746f-1481-4b9a-b412-08dc1b2c3a33 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: CY4PEPF0000E9DB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8704 Select SoundWire dependency flag for acp6.3 based platform for SoundWire configuration. Signed-off-by: Vijendar Mukunda --- sound/soc/sof/amd/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/amd/Kconfig b/sound/soc/sof/amd/Kconfig index 1cea1d75130c..c3bbe6c70fb2 100644 --- a/sound/soc/sof/amd/Kconfig +++ b/sound/soc/sof/amd/Kconfig @@ -81,6 +81,7 @@ config SND_SOC_SOF_AMD_ACP63 tristate "SOF support for ACP6.3 platform" depends on SND_SOC_SOF_PCI select SND_SOC_SOF_AMD_COMMON + select SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE help Select this option for SOF support on AMD ACP6.3 version based platforms. From patchwork Mon Jan 22 09:24:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13525015 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2085.outbound.protection.outlook.com [40.107.93.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79EF53987D; Mon, 22 Jan 2024 09:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915615; cv=fail; b=YrYG60QD7geFCSTxEkJhd3nVHBgMX7+pnG2hODx5B/vlnEwD8HZcOjTLmCKlX/7xGVRWhVRqSrEbuzCPDNYwg/Gfvq00bbRM0r8C13bYKC+HoHK9PH1hwkXpwliqd2C7Y1DQVwD9jB/UanMPeALKJ/Uw1rh5ObiBPjC8UIWRFf8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705915615; c=relaxed/simple; bh=uowzxZRevTt9WCAROFCeIie7vPjduaXYhxvsHTUycdg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WtEzv+qun4oiuGy35qMk3n1o3jz/Cv1HACy9IvZB9H76HSjLYlkPhwUbdKwj8xVgYln4l2SLl9lUw8VaR2YK31FhwRXc2AGrZfAKZ3K6k/QB7297FS4WjpsHG7KeOOKr9TnGcDuVrB+pPeqFCn9WJCaOsZK4Om2jF8jYXsrPhU0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=lgPh+jGo; arc=fail smtp.client-ip=40.107.93.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="lgPh+jGo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LEvjCtyQHlnX6X15f9Et6DmsVVMmVAllPpWBc4fOyFXvLXFjz0/ODRqWcMb8rQwftTGq+NFxoX9zz4Hk/H7BdEGY5Me+96xk9S6qoy9utAEv2JeX8oXFUojslNDRtUwshapnxCpHK5KwbKHg9j6Dmr92rRoXAgN3ooz6PgMbI2gd1Mam0HowOuNpKpCoIcmWDrlkLRZ8y0ioV1kIvEHWOcBYa7Xe2wLG5GnP2FMG8UlEJbB8s/ozoPQw90r+402KaMIidXd879g0CyAeH2s5VvTNcy0Q04uf7Q4t46Plo/A3Amb1tYzW0RiJV8nUUm3Z76intLRDkgFl57A4rbTXoA== 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=UhoVkhy8GN1PdZmnmv/uRV5zVwbIdlO+MnLOz/NKjrs=; b=kaVyKDAkwJditzMfvUSymLDFbGXFyocajcZ1h4FuNOdvEK9innHZmOAMajTE7Pa3Jcn5wPcs6q6+zF+N+DJMbFTlyGdbW4oYKqpIR0veiMPvehbdjSnSwnQlB3N2VkblFugzwiyYSSlrniSzVIjFnRBcgSa8Epes8mAZW3IYlTlWgyvu40FiSf/KUSuC51FMH31v8vrrmomFMJNMDJ1tI+W6jr6PpTHG66e4zDyn1LEkdZFWWteedIq62oKzwH1Iu+/d6Qt15mkbUN9moAuBZhD1M6tBlrppkg6d0GK+qnMywDH208IBUba5CqZ3kJ+fwn0GRp8+dO/a+cQ1TOT3Xg== 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 (0) 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=UhoVkhy8GN1PdZmnmv/uRV5zVwbIdlO+MnLOz/NKjrs=; b=lgPh+jGofiGnAJ+mC6eUYSgCTEaUyMuOP2oAtqCtQ77sidTBXsBgiyI6T4uY2Vv6nxnjqtaqPQOr70z8rG/B+XfNNy/GSrktyuLZU+/nF/MAOCXm1DvLYwVPKMLrvRxX+zHSjOrKv50cJfQ3PU1xTbSUviRwPk9UmUa7HJ1Vq3w= Received: from CY5PR19CA0041.namprd19.prod.outlook.com (2603:10b6:930:1a::8) by SA1PR12MB7272.namprd12.prod.outlook.com (2603:10b6:806:2b6::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 09:26:50 +0000 Received: from CY4PEPF0000E9DB.namprd05.prod.outlook.com (2603:10b6:930:1a:cafe::67) by CY5PR19CA0041.outlook.office365.com (2603:10b6:930:1a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Mon, 22 Jan 2024 09:26:50 +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 CY4PEPF0000E9DB.mail.protection.outlook.com (10.167.241.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Mon, 22 Jan 2024 09:26:50 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2507.34; Mon, 22 Jan 2024 03:26:49 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Mon, 22 Jan 2024 01:26:49 -0800 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.2507.34 via Frontend Transport; Mon, 22 Jan 2024 03:26:43 -0600 From: Vijendar Mukunda To: , CC: , , , , , , , Vijendar Mukunda , Liam Girdwood , Peter Ujfalusi , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , Mastan Katragadda , V sujith kumar Reddy , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , "open list" Subject: [PATCH V3 13/13] ASoC: SOF: amd: refactor acp driver pm ops Date: Mon, 22 Jan 2024 14:54:35 +0530 Message-ID: <20240122092435.3791175-14-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> References: <20240122092435.3791175-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DB:EE_|SA1PR12MB7272:EE_ X-MS-Office365-Filtering-Correlation-Id: 0274d9ef-2ccc-483f-5b6f-08dc1b2c435b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ne7pNAKK763a1RynHtuPYRevU5x9XOF7p2om3eDphF4t+yvx8fBO/yrgg1cBRbihbHQ1Q+OaVO6jucOcC3tf+pqitj/c8YP4lRfZJMHC/EcdGdIWPBnAhInXLAocSZX5s3+W5CFMB8YdxuBpIprI2iVmCZCBYITNiCNRGDbUBwl1f/oE4O6bi67K3kwPqgePuoraCvaiMLM/zrT0uZ0No+tQ/LhseSJfdjQ5uM5TpWqVLBFfJJFqQhjON7xOYlpDZ4BvmzXw7XSxUR3RmGmJV883q5SipsSEqdW2clBYuwNAmMsP87xQ0iHAYpKBEPUjXpI9mXs0Z5qSZhZRUO/KUcwaKUpC8QH3rQZ/DBNNW9061kQzSsOOWH+95aTUWyEOGFphV2uQAKQa8a/8+lnOZP1fAH2UK052YK1Nlt/2EXg+sxlulkaOCJLyq4on+3j6wGFak4vpJdoJJ5OCZNIpPUCUqrXanu7cgy7usI9TiAGI3KPNGVYo7CgwhpmjbMjYoyZ8M21IU7n3P7unJ1LzcXpSUUoAqqeSyq298E5ZNIu56Ww/o+bPNopNXwpbB1GHFlszr/hvR9HZsliS3pOKSg3hEsENJpaH/Pl2BCvWNptKa72+F1o/sKBIqjqliH9hiYltKaksdJ3YHl/YoFZHlD8iElWaeGll20mnklLzUkk7ET7zBLCPT1bNtoIFv0588K4Pj92qVIARd8Sdi/Xnm/Yn7b5hNpTd71d+zOJnOssuuCPg5MYQjh1EBzOCSb+hSgjSbTZTam1vWCRCxXDYKA== 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:(13230031)(4636009)(376002)(136003)(346002)(39860400002)(396003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(36860700001)(47076005)(41300700001)(86362001)(36756003)(82740400003)(336012)(81166007)(356005)(83380400001)(478600001)(8936002)(8676002)(4326008)(6666004)(7696005)(316002)(110136005)(54906003)(70206006)(70586007)(7416002)(426003)(5660300002)(26005)(2906002)(2616005)(1076003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 09:26:50.1245 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0274d9ef-2ccc-483f-5b6f-08dc1b2c435b 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: CY4PEPF0000E9DB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7272 Refactor acp driver pm ops to support SoundWire interface. When SoundWire configuration is enabled, In case of ClockStopMode, DSP soft reset should be applied and for rest of the scenarios acp init/deinit sequence should be invoked. Signed-off-by: Vijendar Mukunda --- sound/soc/sof/amd/acp-dsp-offset.h | 3 ++ sound/soc/sof/amd/acp.c | 65 +++++++++++++++++++++++++++--- sound/soc/sof/amd/acp.h | 4 ++ 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/amd/acp-dsp-offset.h b/sound/soc/sof/amd/acp-dsp-offset.h index c1bdc028a61a..59afbe2e0f42 100644 --- a/sound/soc/sof/amd/acp-dsp-offset.h +++ b/sound/soc/sof/amd/acp-dsp-offset.h @@ -103,4 +103,7 @@ /* Cache window registers */ #define ACP_DSP0_CACHE_OFFSET0 0x0420 #define ACP_DSP0_CACHE_SIZE0 0x0424 + +#define ACP_SW0_EN 0x3000 +#define ACP_SW1_EN 0x3C00 #endif diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 7a34faae9889..920fead2d93d 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -482,6 +482,31 @@ static int acp_reset(struct snd_sof_dev *sdev) return ret; } +static int acp_dsp_reset(struct snd_sof_dev *sdev) +{ + unsigned int val; + int ret; + + snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SOFT_RESET, ACP_DSP_ASSERT_RESET); + + ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, ACP_SOFT_RESET, val, + val & ACP_DSP_SOFT_RESET_DONE_MASK, + ACP_REG_POLL_INTERVAL, ACP_REG_POLL_TIMEOUT_US); + if (ret < 0) { + dev_err(sdev->dev, "timeout asserting reset\n"); + return ret; + } + + snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_SOFT_RESET, ACP_DSP_RELEASE_RESET); + + ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, ACP_SOFT_RESET, val, !val, + ACP_REG_POLL_INTERVAL, ACP_REG_POLL_TIMEOUT_US); + if (ret < 0) + dev_err(sdev->dev, "timeout in releasing reset\n"); + + return ret; +} + static int acp_init(struct snd_sof_dev *sdev) { int ret; @@ -498,10 +523,34 @@ static int acp_init(struct snd_sof_dev *sdev) return acp_reset(sdev); } +static bool check_acp_sdw_enable_status(struct snd_sof_dev *sdev) +{ + struct acp_dev_data *acp_data; + u32 sdw0_en, sdw1_en; + + acp_data = sdev->pdata->hw_pdata; + if (!acp_data->sdw) + return false; + + sdw0_en = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SW0_EN); + sdw1_en = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SW1_EN); + acp_data->sdw_en_stat = sdw0_en || sdw1_en; + return acp_data->sdw_en_stat; +} + int amd_sof_acp_suspend(struct snd_sof_dev *sdev, u32 target_state) { int ret; + /* When acp_reset() function is invoked, it will apply ACP SOFT reset and + * DSP reset. ACP Soft reset sequence will cause all ACP IP registers will + * be reset to default values which will break the ClockStop Mode functionality. + * Add a condition check to apply DSP reset when SoundWire ClockStop mode + * is selected. For the rest of the scenarios, apply acp reset sequence. + */ + if (check_acp_sdw_enable_status(sdev)) + return acp_dsp_reset(sdev); + ret = acp_reset(sdev); if (ret) { dev_err(sdev->dev, "ACP Reset failed\n"); @@ -517,13 +566,19 @@ EXPORT_SYMBOL_NS(amd_sof_acp_suspend, SND_SOC_SOF_AMD_COMMON); int amd_sof_acp_resume(struct snd_sof_dev *sdev) { int ret; + struct acp_dev_data *acp_data; - ret = acp_init(sdev); - if (ret) { - dev_err(sdev->dev, "ACP Init failed\n"); - return ret; + acp_data = sdev->pdata->hw_pdata; + if (!acp_data->sdw_en_stat) { + ret = acp_init(sdev); + if (ret) { + dev_err(sdev->dev, "ACP Init failed\n"); + return ret; + } + return acp_memory_init(sdev); + } else { + return acp_dsp_reset(sdev); } - return acp_memory_init(sdev); } EXPORT_SYMBOL_NS(amd_sof_acp_resume, SND_SOC_SOF_AMD_COMMON); diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index e94713d7ff1d..947068da39b5 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -31,6 +31,9 @@ #define ACP_ASSERT_RESET 0x01 #define ACP_RELEASE_RESET 0x00 #define ACP_SOFT_RESET_DONE_MASK 0x00010001 +#define ACP_DSP_ASSERT_RESET 0x04 +#define ACP_DSP_RELEASE_RESET 0x00 +#define ACP_DSP_SOFT_RESET_DONE_MASK 0x00050004 #define ACP_DSP_INTR_EN_MASK 0x00000001 #define ACP3X_SRAM_PTE_OFFSET 0x02050000 @@ -242,6 +245,7 @@ struct acp_dev_data { bool enable_fw_debug; bool is_dram_in_use; bool is_sram_in_use; + bool sdw_en_stat; }; void memcpy_to_scratch(struct snd_sof_dev *sdev, u32 offset, unsigned int *src, size_t bytes);