From patchwork Thu Aug 1 06:24:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 13749864 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2067.outbound.protection.outlook.com [40.107.243.67]) (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 A9207157A67; Thu, 1 Aug 2024 06:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722494053; cv=fail; b=Uff8eUbYeQsM/VFltknkURSDr0AhydpwNrT2P0XbmUTl65u98BKdtDLHogaz1NiOsUj/8SBP7Fu/q+NIUQ52opbLBQ7WocyHHk9/6XsrG5vd3+g3/JS2yBzoXMfpaMyMAg1AXcfsd9vcM2cHvPUdq+TD8ElYaF0/MRg1i9c72jU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722494053; c=relaxed/simple; bh=wZF5msvkReMqOaD9lENyucelsey8O5TFWxvA5TTaEio=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sDzbwJk8Mw52IIQzt5ax8C9apuyCR1c/oUQYZ1TkwIQPS9ehfN3E2lgfRV6023Et6lQuKTIguo5uIF8doetlbLebRJhu1+SoZpspYGDKzbYMbfapOPiR3xDHnd4q4TCMx8eC90ZmFkMaf60GqrwY2fbtDdVlcMLZ7hrg2JfK5NU= 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=sExfNgI/; arc=fail smtp.client-ip=40.107.243.67 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="sExfNgI/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Umn7gONcbUdvY8WgNd56pDca3WY3XwG/28TwoWGc8u3QJnqwPNTIwV4XPMRxg6DD3ddLEMPCZxgOgnKtLQTMG6F47kXT4trRiUOqSTfdQluECDl2n4S6B1rY95qWz5nifz+5EjHeoN9QMr0FXTI4k4IP13CHTnm/OEP53eHdGCCnUrtKqZiNV/+yiXMFq1byj7ytUKvqeM4EAY1gJKjCfPCjfGsX7jWlcS9jattkCqRaNgimCbLgAFZz+tt92CPbjJfk7Eh6X8dM4uBOKZzW1Iv28jyyNTuYqysOzmAHK64ik+I9h19V+x+GnXHrVW83Fjl4fBd7dYWH/Ty22wcYVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rRwr1M8HYTTJ9pQI1KdXfbC6gSD4Lv3+HS0qRoT2L1s=; b=HBsTGh5SHS+riM/lA4F8ymKiP8fqjHdu8yVCISzixxG/y6ir+i/dj/jYJVE+vlc1nCn4rzSU5fojLVjnnZYJdjnzYgoGN7cy3mHcWer7n478OLGn3LsrzLKZRotjZA+7RpMm4IdnGaO3ho37qJhN2RL3kUSIde0PSu854jARTZmQNsSVusgFAzGhwXjCV+k/eeG47Qh/A+JARBmrY4YR02sn7YuVu60pG2drJHoUcRwHHWsG+brfCzpA4wk/GxwWNmZ66mfZlMg9p2uejuUG5CoyFYSuKAi5u9/yz78Ct53bTv2sDAtjYHKdYdwXnbfEuv4rvNdEq9Xd+nwSk8ogeA== 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=rRwr1M8HYTTJ9pQI1KdXfbC6gSD4Lv3+HS0qRoT2L1s=; b=sExfNgI/bDJCWL0oL7p3FXyYXvkP9G3dtHY8GMuN4c7Me5EDyqOGh48fKPCB4VayeyZPtEL7/t5t49/AiJoWeEEKK4GTYKMzqnCszrJWmvHAm4H2nY5ejBTy754qO0PRwq2Pdjbo87wf3Filu1ot81jtBhH1Zx6kVCo2GLFW+1w= Received: from BYAPR04CA0020.namprd04.prod.outlook.com (2603:10b6:a03:40::33) by BY5PR12MB4084.namprd12.prod.outlook.com (2603:10b6:a03:205::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 06:34:08 +0000 Received: from MWH0EPF000989E9.namprd02.prod.outlook.com (2603:10b6:a03:40:cafe::42) by BYAPR04CA0020.outlook.office365.com (2603:10b6:a03:40::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.34 via Frontend Transport; Thu, 1 Aug 2024 06:34:08 +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 MWH0EPF000989E9.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Thu, 1 Aug 2024 06:34:08 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.39; Thu, 1 Aug 2024 01:34:07 -0500 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 1 Aug 2024 01:34:00 -0500 From: Vijendar Mukunda To: CC: , , , , , , "Vijendar Mukunda" , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , "Cezary Rojewski" , Peter Ujfalusi , Ranjani Sridharan , Kai Vehmanen , Brent Lu , Charles Keepax , Maciej Strozek , Chao Song , Kuninori Morimoto , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , "open list" Subject: [PATCH 20/31] ASoC: intel/sdw_utils: move maxim codec helper functions Date: Thu, 1 Aug 2024 11:54:05 +0530 Message-ID: <20240801062416.2203673-21-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240801062416.2203673-1-Vijendar.Mukunda@amd.com> References: <20240801062416.2203673-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 Received-SPF: None (SATLEXMB03.amd.com: Vijendar.Mukunda@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E9:EE_|BY5PR12MB4084:EE_ X-MS-Office365-Filtering-Correlation-Id: 984799a2-075b-494f-fba5-08dcb1f3f27c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: mXGH20R2gYzSSxGVFAOPidvqTh6EkeZ1o69St2VH/fJzuZLXhYmmIiaT/ZRzxHamcqFGr31YYW2oEFhIr8Jt8eYa1bsggh5LdylsfwoEwV1p2HMG518cPsPwxSEvzVNJUx8aydlagg9LbwOr+YbuMuZrn+Dw+Xc3MwPAwdJhxd9fJGTqU7N+2wsOB6tc1ed7CJrR7DzSoHfQuc1Wwf1CeCUQLLQfr1SFjRi3SjzsG/kSdJffNhHPKfiRi3Rc2gHew2AHoS39oIPvsUWEo8HPz3qHhDrQ3q0ytRt2kDCKC2utU5kFDZ5KTRt7P6ijQfyJ03D5Tw0Ug7XprPIfMcRtICjIGRHnob7xHnipNXZt1bveqRSUbS5vOSVguNb0d6NwIGcnx9Dn8h1anzsEISmK7Zq0a++MBNK+b1PgwLcdjcS9tDHnTU2v/teSRYI/EZ7k0vkUKnDfWoaBu+pg/GL1m5zW/0WI8myBB38WS0ybLJ3c2AmxiVxbzBR+RCRFNwVjdN5w9FREybELsg+DKxYZG3yhlmDK6q9YQzwRN0e1SmlYdgfMgW6ST1bERuq9O9pwMr7HnLC3SKm8n6yRDf6HD92R3MHJq9gjs6xr+RQe5nXYl9Bb//i9yXaFPukvy0K4b5OBQKgC+phYXiwW0qu3K7m5Pq9ux99+vy7wT2dkPcYHIJJQTHqMTTMwn5rfOVKJiqtuR+8HZMhb7WavFdMC5PQSt1CyRRNLzb1E5HAMXPZ9c2n72bj2Bp2ish06WNAHgYEb9I8gmxOQp14Loz1jxpkQh34ksbFZ+MJiea5RCFDlfcn+6My6EuXviLGQJIKkTbfgCGB2VdJAJ2HXmyGq3PCK1K1fjR85CL/O6DbVpFZHywdMNODbgDcx/vM98mOW4Em5b2tMTOj9QOWIfBT8X1K16bD2gqv+kJYATKRkEoBuo32FrWxaAsHTNNwRbICVsLthXl7UDDg+8LgkUd0/suHWWHomnvB2K6GIBtEThL7PLdR8V+vKtQHWDbuXw8Qo2OLDt2XxO99zwZLtnt97uQOhG0jAogfGbuKRfjuQikr/uQjARGQFELZ6ijwJUe8bb8NSEctD54llYnNxxoEZT9uwBYBkPsPhBGaPyw2KKmdTKlOpWHxUaB7+x0W2bacUO+0lm7EFz15v5t+TaNXXR0sDQpaVqTYaovuiZY8UAFu+ubNO+Jo8OIgAcfKbxUuOhUvIgZ2KX6AdbwJFMiFXHIwz/G1AqHJolQMVFN7UaOzVMGHc4loq1rV+D8Q0+5JBuc8OgavQnegA33WG8ggr31fCLoM7oDc3LTR28Z8O3MyrmVoR+ibvM9NjwcctS78whbUmMTkeIMHaQgUGqACCkfynGdeOKgIhdtykSActPXAySX7DpCOucQ21f4QHsE+eQh7S/7S2r1JKlE/ZbRYyzA== 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:(13230040)(7416014)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 06:34:08.1495 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 984799a2-075b-494f-fba5-08dcb1f3f27c 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: MWH0EPF000989E9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4084 Move maxim codec helper functions to common place holder so that it can be used by other platform machine driver. Link: https://github.com/thesofproject/linux/pull/5068 Signed-off-by: Vijendar Mukunda Reviewed-by: Bard Liao Reviewed-by: Pierre-Louis Bossart --- include/sound/soc_sdw_utils.h | 7 +++++++ sound/soc/intel/boards/Makefile | 1 - sound/soc/intel/boards/sof_sdw_common.h | 10 ---------- sound/soc/sdw_utils/Makefile | 3 ++- .../sof_sdw_maxim.c => sdw_utils/soc_sdw_maxim.c} | 14 +++++++++----- 5 files changed, 18 insertions(+), 17 deletions(-) rename sound/soc/{intel/boards/sof_sdw_maxim.c => sdw_utils/soc_sdw_maxim.c} (86%) diff --git a/include/sound/soc_sdw_utils.h b/include/sound/soc_sdw_utils.h index d5dd887b9d15..9e84d1ab6cd0 100644 --- a/include/sound/soc_sdw_utils.h +++ b/include/sound/soc_sdw_utils.h @@ -144,6 +144,12 @@ int asoc_sdw_cs_amp_init(struct snd_soc_card *card, struct asoc_sdw_codec_info *info, bool playback); +/* MAXIM codec support */ +int asoc_sdw_maxim_init(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_links, + struct asoc_sdw_codec_info *info, + bool playback); + /* dai_link init callbacks */ int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); @@ -158,5 +164,6 @@ int asoc_sdw_cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); +int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); #endif diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile index 1ee903e12249..5bd8dc2d166a 100644 --- a/sound/soc/intel/boards/Makefile +++ b/sound/soc/intel/boards/Makefile @@ -35,7 +35,6 @@ snd-soc-skl_nau88l25_ssm4567-y := skl_nau88l25_ssm4567.o snd-soc-ehl-rt5660-y := ehl_rt5660.o snd-soc-sof-ssp-amp-y := sof_ssp_amp.o snd-soc-sof-sdw-y += sof_sdw.o \ - sof_sdw_maxim.o \ sof_sdw_hdmi.o obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o obj-$(CONFIG_SND_SOC_INTEL_SOF_CS42L42_MACH) += snd-soc-sof_cs42l42.o diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index b95daa32e343..664c3404eb81 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -77,14 +77,4 @@ int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd); int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card); -/* MAXIM codec support */ -int asoc_sdw_maxim_init(struct snd_soc_card *card, - struct snd_soc_dai_link *dai_links, - struct asoc_sdw_codec_info *info, - bool playback); - -/* dai_link init callbacks */ - -int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); - #endif diff --git a/sound/soc/sdw_utils/Makefile b/sound/soc/sdw_utils/Makefile index c15b08f3ab0b..28229ed96ffb 100644 --- a/sound/soc/sdw_utils/Makefile +++ b/sound/soc/sdw_utils/Makefile @@ -6,5 +6,6 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ soc_sdw_rt_amp.o \ soc_sdw_bridge_cs35l56.o \ soc_sdw_cs42l42.o soc_sdw_cs42l43.o \ - soc_sdw_cs_amp.o + soc_sdw_cs_amp.o \ + soc_sdw_maxim.o obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o diff --git a/sound/soc/intel/boards/sof_sdw_maxim.c b/sound/soc/sdw_utils/soc_sdw_maxim.c similarity index 86% rename from sound/soc/intel/boards/sof_sdw_maxim.c rename to sound/soc/sdw_utils/soc_sdw_maxim.c index 9933224fcf68..cdcd8df37e1d 100644 --- a/sound/soc/intel/boards/sof_sdw_maxim.c +++ b/sound/soc/sdw_utils/soc_sdw_maxim.c @@ -1,7 +1,9 @@ // SPDX-License-Identifier: GPL-2.0-only +// This file incorporates work covered by the following copyright notice: // Copyright (c) 2020 Intel Corporation +// Copyright (c) 2024 Advanced Micro Devices, Inc. // -// sof_sdw_maxim - Helpers to handle maxim codecs +// soc_sdw_maxim - Helpers to handle maxim codecs // codec devices from generic machine driver #include @@ -10,7 +12,7 @@ #include #include #include -#include "sof_sdw_common.h" +#include static int maxim_part_id; #define SOC_SDW_PART_ID_MAX98363 0x8363 @@ -41,8 +43,9 @@ int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_ return ret; } +EXPORT_SYMBOL_NS(asoc_sdw_maxim_spk_rtd_init, SND_SOC_SDW_UTILS); -static int mx8373_enable_spk_pin(struct snd_pcm_substream *substream, bool enable) +static int asoc_sdw_mx8373_enable_spk_pin(struct snd_pcm_substream *substream, bool enable) { struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_dai *codec_dai; @@ -84,7 +87,7 @@ static int asoc_sdw_mx8373_prepare(struct snd_pcm_substream *substream) if (ret < 0) return ret; - return mx8373_enable_spk_pin(substream, true); + return asoc_sdw_mx8373_enable_spk_pin(substream, true); } static int asoc_sdw_mx8373_hw_free(struct snd_pcm_substream *substream) @@ -96,7 +99,7 @@ static int asoc_sdw_mx8373_hw_free(struct snd_pcm_substream *substream) if (ret < 0) return ret; - return mx8373_enable_spk_pin(substream, false); + return asoc_sdw_mx8373_enable_spk_pin(substream, false); } static const struct snd_soc_ops max_98373_sdw_ops = { @@ -142,3 +145,4 @@ int asoc_sdw_maxim_init(struct snd_soc_card *card, } return 0; } +EXPORT_SYMBOL_NS(asoc_sdw_maxim_init, SND_SOC_SDW_UTILS);