From patchwork Thu Feb 8 16:55:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 770908 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 5A588C4828F for ; Thu, 8 Feb 2024 17:00:15 +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 24B42846; Thu, 8 Feb 2024 18:00:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 24B42846 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1707411613; bh=KqUKDtXlJkWIpAsWAyeaN4J4Fr5x6Ik5O1TuLR3mj/c=; 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=rk+rfTxWBFHEnbgJmtED1/EOj2gYs/w3aRuv6q0fxaA/zjvOTuqdPdzqGgfeXSQRV aplrPDw4+2stzxGzT1FA5tt7+YWNruwYUS7t/g4YxD/mxcY7sV7vF0/WTsEAZp1lai T71yJ2PwVIfp+mNkIWr2oEMeHBbA7QNxwjIt/I4o= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8632BF80793; Thu, 8 Feb 2024 17:57:01 +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 08DFFF80803; Thu, 8 Feb 2024 17:57:01 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BE7F9F8065C; Thu, 8 Feb 2024 17:56:24 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 BE18FF805D9 for ; Thu, 8 Feb 2024 17:56:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BE18FF805D9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iE8vyu3g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707411373; x=1738947373; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KqUKDtXlJkWIpAsWAyeaN4J4Fr5x6Ik5O1TuLR3mj/c=; b=iE8vyu3gYX6xG29uqkkZE36ItQpHxiSKutYZ7G6WSkugzBlTLvkAUX7D AyktTwG+yApi2OwH9ec1iJPalFlVN97ygnH9ZYpGarMH12fp+A5uFPYbd KpAxoyybRn+0XLhiH20971a1AuG7exJmiwmZrqbuis645w/cwVXisEjvp oADwu2QF5JhrEJdEvOtB/f19If/bPFCDBV/s5zyhzTyt8ZSlHlaqZMWSY Zn2h9JSv6qd3+PUE67TBJXwGiL3XakC/FeTrGVKKoJZczcAaFc6CEsJ5w HFX4OWQi636Im0w+qg53CWVvWJ8v7Ld0VWeASKZRWzqwQW2CSYiL45QXl Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="395675397" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="395675397" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 08:56:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="1690237" Received: from stang1-mobl1.amr.corp.intel.com (HELO localhost.localdomain) ([10.212.92.130]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 08:56:02 -0800 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Bard Liao , Rander Wang , Pierre-Louis Bossart Subject: [PATCH 15/24] ASoC: Intel: sof_sdw_cs42l42: use helper to get codec dai by name Date: Thu, 8 Feb 2024 10:55:36 -0600 Message-Id: <20240208165545.93811-16-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240208165545.93811-1-pierre-louis.bossart@linux.intel.com> References: <20240208165545.93811-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: NF3C6IOG3XFKJ6BRUDD5BX4RXGYHWMI7 X-Message-ID-Hash: NF3C6IOG3XFKJ6BRUDD5BX4RXGYHWMI7 X-MailFrom: pierre-louis.bossart@linux.intel.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: From: Bard Liao Use helper to get codec dai by name. Reviewed-by: Rander Wang Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw_cs42l42.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw_cs42l42.c b/sound/soc/intel/boards/sof_sdw_cs42l42.c index 436f41086da6..22f4f9a19088 100644 --- a/sound/soc/intel/boards/sof_sdw_cs42l42.c +++ b/sound/soc/intel/boards/sof_sdw_cs42l42.c @@ -15,6 +15,7 @@ #include #include #include +#include "sof_board_helpers.h" #include "sof_sdw_common.h" static const struct snd_soc_dapm_widget cs42l42_widgets[] = { @@ -46,15 +47,24 @@ static struct snd_soc_jack_pin cs42l42_jack_pins[] = { }, }; +static const char * const jack_codecs[] = { + "cs42l42" +}; + static int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; struct mc_private *ctx = snd_soc_card_get_drvdata(card); - struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); - struct snd_soc_component *component = codec_dai->component; + struct snd_soc_dai *codec_dai; + struct snd_soc_component *component; struct snd_soc_jack *jack; int ret; + codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); + if (!codec_dai) + return -EINVAL; + + component = codec_dai->component; card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s hs:cs42l42", card->components); @@ -129,3 +139,4 @@ int sof_sdw_cs42l42_init(struct snd_soc_card *card, return 0; } +MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_BOARD_HELPERS);