From patchwork Fri Nov 25 18:40:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628817 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 C5B64C4332F for ; Fri, 25 Nov 2022 18:24:53 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CD7F2174C; Fri, 25 Nov 2022 19:24:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CD7F2174C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400691; bh=lXNxzJekHAHccQxNE23P9RZoETpXM66Z7k1N4K7bmp8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oHgr/nXO/g7vuhfpHKJ7/OjY5w4v/VP5vNW7GZeRsHHqpwYazZa0qGY93HcyYalfb kiwhFaGoFy8dLD77rxfrFDCTWtlZ2HOQJYFcg92RfFPaH+z63WquvdV7aMlxRw6vgt nvSmhMB7EXFCRUr3RVS8hCW+jCYjoS/ttxRuMYGU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 38CB9F80542; Fri, 25 Nov 2022 19:23:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2F484F80557; Fri, 25 Nov 2022 19:23:41 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 78E09F800F4 for ; Fri, 25 Nov 2022 19:23:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 78E09F800F4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fQI/16bv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400615; x=1700936615; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lXNxzJekHAHccQxNE23P9RZoETpXM66Z7k1N4K7bmp8=; b=fQI/16bvg9np24LdxcZDrDmSlK0Os5Qkw6PBP107rPNgeJ0qk5MQWVwJ 4OVTDA6gOYP2HP0CA6tte7QbpQPrrWAOOgUQIj5LsH4cSJI6UEPmWLmMm 46tr7hxf6k9/nrDaDnd04c/ldYjao1IQEIEEvCU4EzRIiwCtxnt5kOHRJ D3zSc0NkADFvyboIw751OyXf2helIFVI+mXzliJUJVZX7FkVzfCsMnoC4 QrRp24Trgd6U+UEA7Ww5+uuYTCXlKPPEUgnPMkDOmes6hfMbg7mGOL6bi VrE6CsqAyHBz4GLF9JrlOihY7CWDd4zAtHpWbT+3soF3dl1OgJhG77qry g==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909212" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909212" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005514" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005514" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:28 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 01/11] ASoC: Intel: bdw_rt286: Refactor jack handling Date: Fri, 25 Nov 2022 19:40:22 +0100 Message-Id: <20221125184032.2565979-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Use link->exit() rather than pdev->remove() to unassign jack during card unbind procedure so codec link initialization and exit procedures are symmetrical. Also, there is no need to perform search for codec dai in suspend_pre() and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead. Signed-off-by: Cezary Rojewski --- sound/soc/intel/boards/bdw_rt286.c | 55 +++++++++--------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/sound/soc/intel/boards/bdw_rt286.c b/sound/soc/intel/boards/bdw_rt286.c index 6b76df0e7c9b..b7687a93a923 100644 --- a/sound/soc/intel/boards/bdw_rt286.c +++ b/sound/soc/intel/boards/bdw_rt286.c @@ -73,6 +73,13 @@ static int codec_link_init(struct snd_soc_pcm_runtime *rtd) return snd_soc_component_set_jack(codec, &card_headset, NULL); } +static void codec_link_exit(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_component *codec = asoc_rtd_to_codec(rtd, 0)->component; + + snd_soc_component_set_jack(codec, NULL, NULL); +} + static int codec_link_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { @@ -165,6 +172,7 @@ static struct snd_soc_dai_link card_dai_links[] = { .nonatomic = 1, .no_pcm = 1, .init = codec_link_init, + .exit = codec_link_exit, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC, .ignore_pmdown_time = 1, .be_hw_params_fixup = codec_link_hw_params_fixup, @@ -175,43 +183,24 @@ static struct snd_soc_dai_link card_dai_links[] = { }, }; -static void bdw_rt286_disable_jack(struct snd_soc_card *card) -{ - struct snd_soc_component *component; - - for_each_card_components(card, component) { - if (!strcmp(component->name, "i2c-INT343A:00")) { - dev_dbg(component->dev, "disabling jack detect before going to suspend.\n"); - snd_soc_component_set_jack(component, NULL, NULL); - break; - } - } -} - -static int bdw_rt286_suspend(struct snd_soc_card *card) +static int card_suspend_pre(struct snd_soc_card *card) { - bdw_rt286_disable_jack(card); + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, "rt286-aif1"); - return 0; + return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); } -static int bdw_rt286_resume(struct snd_soc_card *card) +static int card_resume_post(struct snd_soc_card *card) { - struct snd_soc_component *component; - - for_each_card_components(card, component) { - if (!strcmp(component->name, "i2c-INT343A:00")) { - dev_dbg(component->dev, "enabling jack detect for resume.\n"); - snd_soc_component_set_jack(component, &card_headset, NULL); - break; - } - } + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, "rt286-aif1"); - return 0; + return snd_soc_component_set_jack(codec_dai->component, &card_headset, NULL); } static struct snd_soc_card bdw_rt286_card = { .owner = THIS_MODULE, + .suspend_pre = card_suspend_pre, + .resume_post = card_resume_post, .dai_link = card_dai_links, .num_links = ARRAY_SIZE(card_dai_links), .controls = card_controls, @@ -221,8 +210,6 @@ static struct snd_soc_card bdw_rt286_card = { .dapm_routes = card_routes, .num_dapm_routes = ARRAY_SIZE(card_routes), .fully_routed = true, - .suspend_pre = bdw_rt286_suspend, - .resume_post = bdw_rt286_resume, }; /* Use space before codec name to simplify card ID, and simplify driver name. */ @@ -254,18 +241,8 @@ static int bdw_rt286_probe(struct platform_device *pdev) return devm_snd_soc_register_card(dev, &bdw_rt286_card); } -static int bdw_rt286_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - - bdw_rt286_disable_jack(card); - - return 0; -} - static struct platform_driver bdw_rt286_driver = { .probe = bdw_rt286_probe, - .remove = bdw_rt286_remove, .driver = { .name = "bdw_rt286", .pm = &snd_soc_pm_ops From patchwork Fri Nov 25 18:40:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628570 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 77175C4332F for ; Fri, 25 Nov 2022 18:25:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7E9D71758; Fri, 25 Nov 2022 19:24:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7E9D71758 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400718; bh=Ohc2bX2PjrZkMypbz1IESeN5JhbEma4pwXDsy77W1CM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gzTOZvKMQOkIzqAEuCaMRNDZaJT4mziC4T6cZFFH2YZVbcmBOKiMnoysZ9PJ/RZvj ZbZ31UVZ7UV/sLUrlNlg1PGb/0TSGOCubOm/pp8/5TaMuKgcnYKV8iNY3KrV2g15We ASc5n3fUqRrD5oqDKX9tuEiclOjgJ8RGLvDsauns= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 98B54F8055B; Fri, 25 Nov 2022 19:23:45 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 195C6F80557; Fri, 25 Nov 2022 19:23:42 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 44A39F80171 for ; Fri, 25 Nov 2022 19:23:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 44A39F80171 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KL74TFJL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400616; x=1700936616; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ohc2bX2PjrZkMypbz1IESeN5JhbEma4pwXDsy77W1CM=; b=KL74TFJLruP+R1+zITUnv/K0y9pCCfjLV68TTpK0epZu8610DkcbAaww hYxXPyJHxGoXTD9Wz4x4Zgv8H29LpMTYY7PjU5s6Byxb/Y1to2k5KerW0 QG7MToLaad8b0/QdWhVDZajShycNRSEOUOYyi4f2EdZw1PmVqs+yLj0nf Ir8n0rx0Nit4iNJtiBpxeZuFgMwyN8lJ+OZ7HYMA+B2GP1Ku75I6+x4Ap 0FgnDNLsSNWKTSZgzUVTF8ITMZt2ujfDX3aW1KSDCVgkAiwep03jWlBrd WatL1w/5PYD+WS8uMQByx8hUa4mG1w+4C2DZScoblmAQa03cnlZJSK6Jd Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909215" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909215" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005517" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005517" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:30 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 02/11] ASoC: Intel: avs: da7219: Refactor jack handling Date: Fri, 25 Nov 2022 19:40:23 +0100 Message-Id: <20221125184032.2565979-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Use link->exit() rather than pdev->remove() to unassign jack during card unbind procedure so codec link initialization and exit procedures are symmetrical. Also, there is no need to perform search for codec dai in suspend_pre() and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/da7219.c | 34 +++++++++++------------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c index ad86cef101cc..acd43b6108e9 100644 --- a/sound/soc/intel/avs/boards/da7219.c +++ b/sound/soc/intel/avs/boards/da7219.c @@ -72,10 +72,10 @@ static const struct snd_soc_dapm_route card_base_routes[] = { static int avs_da7219_codec_init(struct snd_soc_pcm_runtime *runtime) { - struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component; + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0); + struct snd_soc_component *component = codec_dai->component; struct snd_soc_card *card = runtime->card; struct snd_soc_jack *jack; - struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0); int clk_freq; int ret; @@ -109,9 +109,12 @@ static int avs_da7219_codec_init(struct snd_soc_pcm_runtime *runtime) snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); - snd_soc_component_set_jack(component, jack, NULL); + return snd_soc_component_set_jack(component, jack, NULL); +} - return 0; +static void avs_da7219_codec_exit(struct snd_soc_pcm_runtime *rtd) +{ + snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL); } static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port, @@ -146,6 +149,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->id = 0; dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; dl->init = avs_da7219_codec_init; + dl->exit = avs_da7219_codec_exit; dl->nonatomic = 1; dl->no_pcm = 1; dl->dpcm_capture = 1; @@ -188,30 +192,19 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, return 0; } -static int avs_card_set_jack(struct snd_soc_card *card, struct snd_soc_jack *jack) -{ - struct snd_soc_component *component; - - for_each_card_components(card, component) - snd_soc_component_set_jack(component, jack, NULL); - return 0; -} - -static int avs_card_remove(struct snd_soc_card *card) -{ - return avs_card_set_jack(card, NULL); -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { - return avs_card_set_jack(card, NULL); + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, DA7219_DAI_NAME); + + return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); } static int avs_card_resume_post(struct snd_soc_card *card) { + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, DA7219_DAI_NAME); struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card); - return avs_card_set_jack(card, jack); + return snd_soc_component_set_jack(codec_dai->component, jack, NULL); } static int avs_da7219_probe(struct platform_device *pdev) @@ -249,7 +242,6 @@ static int avs_da7219_probe(struct platform_device *pdev) card->name = "avs_da7219"; card->dev = dev; card->owner = THIS_MODULE; - card->remove = avs_card_remove; card->suspend_pre = avs_card_suspend_pre; card->resume_post = avs_card_resume_post; card->dai_link = dai_link; From patchwork Fri Nov 25 18:40:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628816 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 02AA5C4332F for ; Fri, 25 Nov 2022 18:25:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2B2A51775; Fri, 25 Nov 2022 19:24:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2B2A51775 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400725; bh=k8FXTxKofvG1adoh9TH8d3OGm4rlK/RrlcwV28e5PhY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NHP3peIgqPGc1bjsAN+gmfZM5/KXqNTk/IoNE5UVqC1lTy74QFxgL1UUIl2PmvozY nXA+F2AiyD4/Nq0T/zNmtWCEdPS/8AOZoMQeK0LGa+T/siGbI9Kyuh9CubzoAXX5/X QQSm9PCBXkLysrRDDL8X8ZJM5fTN+tQEXk0ryUTc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1B227F80559; Fri, 25 Nov 2022 19:23:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4EAE4F80568; Fri, 25 Nov 2022 19:23:47 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 B1076F8047C for ; Fri, 25 Nov 2022 19:23:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B1076F8047C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Xfux2xgC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400617; x=1700936617; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k8FXTxKofvG1adoh9TH8d3OGm4rlK/RrlcwV28e5PhY=; b=Xfux2xgCuYS3v1Cw6bOnHtECWhGOfgFIesWihb122pA1H2vkWrWVcEzQ vYcRbTgxiN0d7HC7KuzG5xRzXmz3pu6AyV6XpIN2ZUs0ADBXD++Ojm6QJ u6y4oZpSMOx/y654Qt0fm+mdiDJ3RrLH+EpTnGUYyjYVHpiCxT7pIIKDn NdlggfoW1YY1modhudv9266F9faNI1/qmf55lLx4RKXJ6VWkplA27duuD OPfZJlw6PlLxRC9sOaYJeA+YYhrQkHRM4USTf7eihFl0DI10aDySMIEXN /ujAYHAfU6V9JmsUafQ6sKRQwkXsJ3O/6Jm1Ke2CTSa1pAW4j+RDMFLog A==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909217" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909217" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005522" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005522" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:32 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 03/11] ASoC: Intel: avs: nau8825: Refactor jack handling Date: Fri, 25 Nov 2022 19:40:24 +0100 Message-Id: <20221125184032.2565979-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Use link->exit() rather than pdev->remove() to unassign jack during card unbind procedure so codec link initialization and exit procedures are symmetrical. Also, there is no need to perform search for codec dai in suspend_pre() and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/nau8825.c | 35 +++++++++------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c index f76909e9f990..6731d8a49076 100644 --- a/sound/soc/intel/avs/boards/nau8825.c +++ b/sound/soc/intel/avs/boards/nau8825.c @@ -79,11 +79,9 @@ static struct snd_soc_jack_pin card_headset_pins[] = { static int avs_nau8825_codec_init(struct snd_soc_pcm_runtime *runtime) { - struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0); - struct snd_soc_component *component = codec_dai->component; + struct snd_soc_card *card = runtime->card; struct snd_soc_jack_pin *pins; struct snd_soc_jack *jack; - struct snd_soc_card *card = runtime->card; int num_pins, ret; jack = snd_soc_card_get_drvdata(card); @@ -108,11 +106,12 @@ static int avs_nau8825_codec_init(struct snd_soc_pcm_runtime *runtime) snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); - //snd_soc_component_set_jack(component, jack, NULL); - // TODO: Fix nau8825 codec to use .set_jack, like everyone else - nau8825_enable_jack_detect(component, jack); + return snd_soc_component_set_jack(asoc_rtd_to_codec(runtime, 0)->component, jack, NULL); +} - return 0; +static void avs_nau8825_codec_exit(struct snd_soc_pcm_runtime *rtd) +{ + snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL); } static int @@ -203,6 +202,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->id = 0; dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; dl->init = avs_nau8825_codec_init; + dl->exit = avs_nau8825_codec_exit; dl->be_hw_params_fixup = avs_nau8825_be_fixup; dl->ops = &avs_nau8825_ops; dl->nonatomic = 1; @@ -247,23 +247,11 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, return 0; } -static int avs_card_set_jack(struct snd_soc_card *card, struct snd_soc_jack *jack) -{ - struct snd_soc_component *component; - - for_each_card_components(card, component) - snd_soc_component_set_jack(component, jack, NULL); - return 0; -} - -static int avs_card_remove(struct snd_soc_card *card) -{ - return avs_card_set_jack(card, NULL); -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { - return avs_card_set_jack(card, NULL); + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, SKL_NUVOTON_CODEC_DAI); + + return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); } static int avs_card_resume_post(struct snd_soc_card *card) @@ -280,7 +268,7 @@ static int avs_card_resume_post(struct snd_soc_card *card) codec_dai->playback_widget->active) snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS, 0, SND_SOC_CLOCK_IN); - return avs_card_set_jack(card, jack); + return snd_soc_component_set_jack(codec_dai->component, jack, NULL); } static int avs_nau8825_probe(struct platform_device *pdev) @@ -318,7 +306,6 @@ static int avs_nau8825_probe(struct platform_device *pdev) card->name = "avs_nau8825"; card->dev = dev; card->owner = THIS_MODULE; - card->remove = avs_card_remove; card->suspend_pre = avs_card_suspend_pre; card->resume_post = avs_card_resume_post; card->dai_link = dai_link; From patchwork Fri Nov 25 18:40:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628569 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 04422C4332F for ; Fri, 25 Nov 2022 18:25:40 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3CCB01767; Fri, 25 Nov 2022 19:24:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3CCB01767 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400739; bh=YYr68HhZ+L4FesseDLwEdDzpnAYwmqzen9qKgoG1iKs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=n8t5ISmnAw317VGBBwZqrdJLH+d6nwS7zVRv/+8o7hgfanM4FpBp347UdIUkCfF6q jpJ8MFqIR0JaaKMscHht2ZzepWmU2lilU5Gl2Y/1Hd257A0GELc1f+dj1qUCVagZlJ m8IDXxwNkviNvLi2iLO8jeWnOMgBQ9gChvKYkLmk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A7962F80578; Fri, 25 Nov 2022 19:23:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5D11FF80559; Fri, 25 Nov 2022 19:23:47 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 E8CDDF80533 for ; Fri, 25 Nov 2022 19:23:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E8CDDF80533 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YBcM2jkO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400618; x=1700936618; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YYr68HhZ+L4FesseDLwEdDzpnAYwmqzen9qKgoG1iKs=; b=YBcM2jkO+KObCaNWt8eyFdj0I/s+yNnsXvEbhMaOb0y6Z67U/iHyo8Wo EV6JjmDXwXkIqgk6NXQ3NCT96Mz6phH3I3QizNjgajk+6E3lltZhSqxJS SkMWJsew6JGQZQVKreICxchTG8y/9YFcmV0cW+vBaeZmfYMeHkYsNQcLM uHsO+K0mhmVjOMuoU2vCTXDOKjVipQ314SiKJrukN9rkv63UIRfmj8SMN bzCnjhxDbfcLNu0XXmliX5Pn858wcXuVmA9SI+wimIgTJRsS8IgcW4bEO in7buXJy2vJresm6w64UgLmctGHSO3EXPVZ48rFUOMCRyUm0WTi92D7Kj Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909221" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909221" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005526" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005526" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:34 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 04/11] ASoC: Intel: avs: rt274: Refer to DAI name through a constant Date: Fri, 25 Nov 2022 19:40:25 +0100 Message-Id: <20221125184032.2565979-5-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński There is existing define for codec DAI name, make use of it when setting codec DAI name. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt274.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/boards/rt274.c b/sound/soc/intel/avs/boards/rt274.c index afef5a3ca60b..9937cfe9996e 100644 --- a/sound/soc/intel/avs/boards/rt274.c +++ b/sound/soc/intel/avs/boards/rt274.c @@ -160,7 +160,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT34C2:00"); - dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "rt274-aif1"); + dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT274_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) return -ENOMEM; From patchwork Fri Nov 25 18:40:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628815 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 32961C4332F for ; Fri, 25 Nov 2022 18:25:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2E4C81786; Fri, 25 Nov 2022 19:25:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2E4C81786 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400756; bh=en2PQi9Mj4TtqEg71x55herGNoXHfj08m/EXmc9L5m4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sRZKnE/ppccXO+hCD0b+TH4iiImj6pweGIUPCj5oJ1YFnbW4LKgNEfM6FkbKFXmEN 6T0TE6AhRna1hcHtVGlawUqf9I8eqIFMuKMAuLZfUGPNc1KRu1BoZsl3BtMYLCYOai qZfHqKmOfmTqLq8w8qX8M2pwExErQPTxDN3yb53s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 29315F8057D; Fri, 25 Nov 2022 19:23:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D495FF80567; Fri, 25 Nov 2022 19:23:47 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 E6FBFF80536 for ; Fri, 25 Nov 2022 19:23:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E6FBFF80536 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="U5/OZ6ex" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400620; x=1700936620; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=en2PQi9Mj4TtqEg71x55herGNoXHfj08m/EXmc9L5m4=; b=U5/OZ6exNdj4bVmFAGZ/McuqhZ+3FSN0dR1IkLMs2pJC6ftuwph6Ch9K lPSM0UABXXWGJwys5jPqbV/X49c+yKQi8VMHX9n5jbd0oLuY6UCNvaZhz +G+Gy/LfNUwuKNL2zVHGYSoP3/u0RUuI1AP3Vg/pW1S97hdrMiItAJsvM FvObP/s29qyINl2czyzL6rnoo8ZdnBaNvbuiEE1feODfH5x25J+hT7mhF tr7Sqr752Dr+e1f0tH5CiFJjC4g89ez1wzljMg0otjj9Sh4U3nuiPK+5A Oj/bMJEpRFgVsVNLfhZJXHMb2JtPt/lTpo3nB/kbPiEZpBPn16Gdnq//v g==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909223" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909223" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005531" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005531" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:36 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 05/11] ASoC: Intel: avs: rt274: Refactor jack handling Date: Fri, 25 Nov 2022 19:40:26 +0100 Message-Id: <20221125184032.2565979-6-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Use link->exit() rather than pdev->remove() to unassign jack during card unbind procedure so codec link initialization and exit procedures are symmetrical. Also, there is no need to perform search for codec dai in suspend_pre() and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt274.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt274.c b/sound/soc/intel/avs/boards/rt274.c index 9937cfe9996e..6a1e121f082f 100644 --- a/sound/soc/intel/avs/boards/rt274.c +++ b/sound/soc/intel/avs/boards/rt274.c @@ -119,6 +119,11 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime) return 0; } +static void avs_rt274_codec_exit(struct snd_soc_pcm_runtime *rtd) +{ + snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL); +} + static int avs_rt274_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params) { struct snd_interval *rate, *channels; @@ -171,6 +176,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->id = 0; dl->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; dl->init = avs_rt274_codec_init; + dl->exit = avs_rt274_codec_exit; dl->be_hw_params_fixup = avs_rt274_be_fixup; dl->nonatomic = 1; dl->no_pcm = 1; @@ -214,30 +220,19 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, return 0; } -static int avs_card_set_jack(struct snd_soc_card *card, struct snd_soc_jack *jack) -{ - struct snd_soc_component *component; - - for_each_card_components(card, component) - snd_soc_component_set_jack(component, jack, NULL); - return 0; -} - -static int avs_card_remove(struct snd_soc_card *card) -{ - return avs_card_set_jack(card, NULL); -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { - return avs_card_set_jack(card, NULL); + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT274_CODEC_DAI); + + return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); } static int avs_card_resume_post(struct snd_soc_card *card) { + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT274_CODEC_DAI); struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card); - return avs_card_set_jack(card, jack); + return snd_soc_component_set_jack(codec_dai->component, jack, NULL); } static int avs_rt274_probe(struct platform_device *pdev) @@ -275,7 +270,6 @@ static int avs_rt274_probe(struct platform_device *pdev) card->name = "avs_rt274"; card->dev = dev; card->owner = THIS_MODULE; - card->remove = avs_card_remove; card->suspend_pre = avs_card_suspend_pre; card->resume_post = avs_card_resume_post; card->dai_link = dai_link; From patchwork Fri Nov 25 18:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628568 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 F2816C4332F for ; Fri, 25 Nov 2022 18:26:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2E6D61788; Fri, 25 Nov 2022 19:25:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2E6D61788 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400771; bh=AFnZU6XNgitudKbcIfkGVHKOYfkA6R+0bcF8Lpzk/NE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CRMoyAoiI0M9TcAfLib1EWBy39O28m+Pow7BNfl3DO8KZNG+sInMr5TFZW2RnX4CI djphpM96Qhh4BAhZpxzvq0vIxIRxRwdV0dF4TXnfAY4uqKsBk6YYGNSFwn2ctQvkKY uic7HOBrh6IboMRGbiabi+8dody++kqddmAssPLY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 12EBBF80587; Fri, 25 Nov 2022 19:23:51 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D16BCF80567; Fri, 25 Nov 2022 19:23:48 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 D9C77F800F4 for ; Fri, 25 Nov 2022 19:23:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D9C77F800F4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Kiou8ZUs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400622; x=1700936622; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AFnZU6XNgitudKbcIfkGVHKOYfkA6R+0bcF8Lpzk/NE=; b=Kiou8ZUs3qN7MhYpZoNcZqEnCq2k00aUK3yNpH8HR3qNp/so+Hy1CQlw V1pmY9t64Lf2m3kks3Pw2emqeLaf2c0I3djGoyCkON8Zolv1gqXmTq/mu jvyu6kEaNxFhM1y+CKf4AVFNO+1/+KW/YrCDHTYI753ejjKVt4OZWSW2U 3IK4G0ZckcMhk/uigCJSzWv3e6i145pYNoDgUnaGW3Kji904M+3SW3DbH 8DVgRZOWHXOJS755//omFLKHEOfChR69rjCktLNib4WUrwmB3gHfy5ZQN Fy1n5Hq+8OL6C1mFy7AzXpkfpnlQe0fHFvvBO2EDek/ahp7z4ynGlT23E w==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909224" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909224" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005539" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005539" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:38 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 06/11] ASoC: Intel: avs: rt286: Add define for codec DAI name Date: Fri, 25 Nov 2022 19:40:27 +0100 Message-Id: <20221125184032.2565979-7-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Following commits will make use of it to find codec DAI, define it first. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt286.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c index e51d4e181274..7868a2d10cac 100644 --- a/sound/soc/intel/avs/boards/rt286.c +++ b/sound/soc/intel/avs/boards/rt286.c @@ -14,6 +14,8 @@ #include #include "../../../codecs/rt286.h" +#define RT286_CODEC_DAI "rt286-aif1" + static const struct snd_kcontrol_new card_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Mic Jack"), @@ -130,7 +132,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT343A:00"); - dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "rt286-aif1"); + dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT286_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) return -ENOMEM; From patchwork Fri Nov 25 18:40:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628814 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 1ACA8C4332F for ; Fri, 25 Nov 2022 18:26:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 502F5174C; Fri, 25 Nov 2022 19:25:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 502F5174C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400785; bh=Dgp5UKKn34407Wm+nhVSWp9+YFRwEGAFRNU5JcCo0sc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ElijQFxC/It5tAJco6x+xiiX2BGC8SFoLkaWnEN98PoDqvksqUPGuV7V1qvFIG5wb GkN5GN+jlmMvdP3oYfSj2ylVqTV7zBhK4sGXcQTNr6niHyTi0v48PetG+HH7lC0Zve rPmDfigLdhKl+H8ekGjgDHI2Uw02P6CLUYWmanF4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 221DAF80579; Fri, 25 Nov 2022 19:23:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 89B04F80567; Fri, 25 Nov 2022 19:23:49 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 CC133F80558 for ; Fri, 25 Nov 2022 19:23:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CC133F80558 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gGyu7DJ4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400624; x=1700936624; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dgp5UKKn34407Wm+nhVSWp9+YFRwEGAFRNU5JcCo0sc=; b=gGyu7DJ492vGDtkftqH30d4WEm4kKFbdW6q4ONqvoXpM2i5EDuFC4jbk BbSmYE6NjzJ/B5zcRg535yp5s/7Vmf/JKUSY2WcW85h4+XsouAhSIDO40 BvwSmoT284zBxcB3xY8Os83+wQBgnXngW+whEuquX4W4wc39r4N+/4jrX QP3onk7KplpApLrnv03m3zLkvjQg/agVXE1qKmT9m5V22POA3RSx30P2g dZr5l0Gp7rR+FR77YP5qEXtlPEeg7fnlIo5EfPiUDZvbn9j6j7SwxJVIO RhgCkK0jt5wJam3PLf3HmBL4c1RR1geJGnT8cehR9bAQO7i9cpSKdc8VX g==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909225" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909225" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005553" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005553" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:40 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 07/11] ASoC: Intel: avs: rt286: Refactor jack handling Date: Fri, 25 Nov 2022 19:40:28 +0100 Message-Id: <20221125184032.2565979-8-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Use link->exit() rather than pdev->remove() to unassign jack during card unbind procedure so codec link initialization and exit procedures are symmetrical. Also, there is no need to perform search for codec dai in suspend_pre() and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt286.c | 33 +++++++++++------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c index 7868a2d10cac..8447b37a2a41 100644 --- a/sound/soc/intel/avs/boards/rt286.c +++ b/sound/soc/intel/avs/boards/rt286.c @@ -50,10 +50,9 @@ static struct snd_soc_jack_pin card_headset_pins[] = { static int avs_rt286_codec_init(struct snd_soc_pcm_runtime *runtime) { - struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component; + struct snd_soc_card *card = runtime->card; struct snd_soc_jack_pin *pins; struct snd_soc_jack *jack; - struct snd_soc_card *card = runtime->card; int num_pins, ret; jack = snd_soc_card_get_drvdata(card); @@ -68,9 +67,12 @@ static int avs_rt286_codec_init(struct snd_soc_pcm_runtime *runtime) if (ret) return ret; - snd_soc_component_set_jack(component, jack, NULL); + return snd_soc_component_set_jack(asoc_rtd_to_codec(runtime, 0)->component, jack, NULL); +} - return 0; +static void avs_rt286_codec_exit(struct snd_soc_pcm_runtime *rtd) +{ + snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL); } static int avs_rt286_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params) @@ -143,6 +145,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->id = 0; dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; dl->init = avs_rt286_codec_init; + dl->exit = avs_rt286_codec_exit; dl->be_hw_params_fixup = avs_rt286_be_fixup; dl->ops = &avs_rt286_ops; dl->nonatomic = 1; @@ -187,30 +190,19 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, return 0; } -static int avs_card_set_jack(struct snd_soc_card *card, struct snd_soc_jack *jack) -{ - struct snd_soc_component *component; - - for_each_card_components(card, component) - snd_soc_component_set_jack(component, jack, NULL); - return 0; -} - -static int avs_card_remove(struct snd_soc_card *card) -{ - return avs_card_set_jack(card, NULL); -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { - return avs_card_set_jack(card, NULL); + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT286_CODEC_DAI); + + return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); } static int avs_card_resume_post(struct snd_soc_card *card) { + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT286_CODEC_DAI); struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card); - return avs_card_set_jack(card, jack); + return snd_soc_component_set_jack(codec_dai->component, jack, NULL); } static int avs_rt286_probe(struct platform_device *pdev) @@ -248,7 +240,6 @@ static int avs_rt286_probe(struct platform_device *pdev) card->name = "avs_rt286"; card->dev = dev; card->owner = THIS_MODULE; - card->remove = avs_card_remove; card->suspend_pre = avs_card_suspend_pre; card->resume_post = avs_card_resume_post; card->dai_link = dai_link; From patchwork Fri Nov 25 18:40:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628566 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 54ABBC4332F for ; Fri, 25 Nov 2022 18:27:13 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5F4061754; Fri, 25 Nov 2022 19:26:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5F4061754 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400831; bh=0zPRXWRwu7JchuRpBJMq6fTr5PW1H/S8d4GUlZY6Jo8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=r8wKkEMFRKIYQzOpegVE7t28D8eGKlDhVUxFzfU6HFcYec4EX1RaKdBaztO5jJNcR 8LBUIs31mjKqRcCETX9al/aCPqWTW+AKtw+HAquz/0B1g8k36a2GLPIo0Vxx/lluDd KYNxRaoBzL4pKYJ/sDZXBEoTCwa4EPHCJi2PaKj4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8E8B3F805AF; Fri, 25 Nov 2022 19:23:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A4F4CF80589; Fri, 25 Nov 2022 19:23:52 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 CFEF2F80563 for ; Fri, 25 Nov 2022 19:23:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CFEF2F80563 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mxv/p92F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400626; x=1700936626; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0zPRXWRwu7JchuRpBJMq6fTr5PW1H/S8d4GUlZY6Jo8=; b=mxv/p92FGgp8KzIZbMa4Knm3IF5Hp8bGPQQ+65rHADx130z2gfRqCGoD owHicVT33nT2ahF6bPV1I8b3Jh7BsG1sVBz9M0s6RZOPgOYKaCCZjhG7J Uv1TRMiVoCVFpZCL7a/DXEbkHLXJHkSnyxvyu9DZ5NsRYzTu1d1mycyZa I8avWhOZLYpi/jyIezyvSjYh4V1TJ8g9t2Ih4qrZIbKRCY+XllZWyv2me rfl3Xnc+fGl571ONInK6oSjT+eFyKF1VugV6D+sKXWX035AolylTziX/D h+4Av/1FRHNvHSO/T+0YZzWEIU6oFMZiux44PptjRcUI+SirNjSB+hieb g==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909226" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909226" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005563" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005563" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:42 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 08/11] ASoC: Intel: avs: rt298: Add define for codec DAI name Date: Fri, 25 Nov 2022 19:40:29 +0100 Message-Id: <20221125184032.2565979-9-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Following commits will make use of it to find codec DAI, define it first. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt298.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/boards/rt298.c b/sound/soc/intel/avs/boards/rt298.c index 58c9d9edecf0..5570949bad8a 100644 --- a/sound/soc/intel/avs/boards/rt298.c +++ b/sound/soc/intel/avs/boards/rt298.c @@ -15,6 +15,8 @@ #include #include "../../../codecs/rt298.h" +#define RT298_CODEC_DAI "rt298-aif1" + static const struct dmi_system_id kblr_dmi_table[] = { { .matches = { @@ -147,7 +149,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT343A:00"); - dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "rt298-aif1"); + dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT298_CODEC_DAI); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) return -ENOMEM; From patchwork Fri Nov 25 18:40:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628567 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 7BD5FC4332F for ; Fri, 25 Nov 2022 18:26:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9E1BB177C; Fri, 25 Nov 2022 19:25:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9E1BB177C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400799; bh=tJP/k0gxeDYUog3Pv6nca7HNKh0zN8GO1U+fqRnNeDM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MCxZpcbZOaNzPS8eeBj1iVJhLt6M0gzfRgphEz9ADSJ+gDJbm950i9k/x5xvhMve3 YAQckm3grb2gVrolPQSM2I6mIix/rE+vHE5M8iagr11IftbtiEs0o46ZxWYcb8JujR yFsBN6Rqsqkzg6o81EdTsIcRhxOHCrnSn336fr/I= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8F38CF8058C; Fri, 25 Nov 2022 19:23:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7E472F80589; Fri, 25 Nov 2022 19:23:51 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 41E8FF8056F for ; Fri, 25 Nov 2022 19:23:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 41E8FF8056F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SHMnoN8r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400629; x=1700936629; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tJP/k0gxeDYUog3Pv6nca7HNKh0zN8GO1U+fqRnNeDM=; b=SHMnoN8rPXWAlbdFB5t5BItHRCepIQo1p86YtD4UjhQpmoAq4lx1Zw9I GM9MkqgrXOc2opggeWRnzY4R14TYSw0fC4PcFJk0EUdQpdM1eBeRzL+Jp h9dY8eRaR5/JCqRTUbRytYH2jctTz3XxXww6rKpq55nRkXXPuS/5jLUIY BoajVlyhK+g0nYC7m0TW0gfUILeAiONZSmPKtiJI4NE1ka7HwLakQsoz4 RFZy3I+SYIdXXSgMTlKWw8hc5xTdfbyJiJjDX9xpTiM9fNG2ae1qSd5ds Ramr30um40Kz0czbPNQRUE1RHPdZrv1BfCsyA7kOGqD68O8S+Wx6kDsuU g==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909228" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909228" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005574" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005574" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:44 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 09/11] ASoC: Intel: avs: rt298: Refactor jack handling Date: Fri, 25 Nov 2022 19:40:30 +0100 Message-Id: <20221125184032.2565979-10-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Use link->exit() rather than pdev->remove() to unassign jack during card unbind procedure so codec link initialization and exit procedures are symmetrical. Also, there is no need to perform search for codec dai in suspend_pre() and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt298.c | 33 +++++++++++------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt298.c b/sound/soc/intel/avs/boards/rt298.c index 5570949bad8a..bd25f0fde35e 100644 --- a/sound/soc/intel/avs/boards/rt298.c +++ b/sound/soc/intel/avs/boards/rt298.c @@ -61,10 +61,9 @@ static struct snd_soc_jack_pin card_headset_pins[] = { static int avs_rt298_codec_init(struct snd_soc_pcm_runtime *runtime) { - struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component; + struct snd_soc_card *card = runtime->card; struct snd_soc_jack_pin *pins; struct snd_soc_jack *jack; - struct snd_soc_card *card = runtime->card; int num_pins, ret; jack = snd_soc_card_get_drvdata(card); @@ -79,9 +78,12 @@ static int avs_rt298_codec_init(struct snd_soc_pcm_runtime *runtime) if (ret) return ret; - snd_soc_component_set_jack(component, jack, NULL); + return snd_soc_component_set_jack(asoc_rtd_to_codec(runtime, 0)->component, jack, NULL); +} - return 0; +static void avs_rt298_codec_exit(struct snd_soc_pcm_runtime *rtd) +{ + snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL); } static int avs_rt298_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params) @@ -163,6 +165,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in else dl->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; dl->init = avs_rt298_codec_init; + dl->exit = avs_rt298_codec_exit; dl->be_hw_params_fixup = avs_rt298_be_fixup; dl->ops = &avs_rt298_ops; dl->nonatomic = 1; @@ -207,30 +210,19 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, return 0; } -static int avs_card_set_jack(struct snd_soc_card *card, struct snd_soc_jack *jack) -{ - struct snd_soc_component *component; - - for_each_card_components(card, component) - snd_soc_component_set_jack(component, jack, NULL); - return 0; -} - -static int avs_card_remove(struct snd_soc_card *card) -{ - return avs_card_set_jack(card, NULL); -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { - return avs_card_set_jack(card, NULL); + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT298_CODEC_DAI); + + return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); } static int avs_card_resume_post(struct snd_soc_card *card) { + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT298_CODEC_DAI); struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card); - return avs_card_set_jack(card, jack); + return snd_soc_component_set_jack(codec_dai->component, jack, NULL); } static int avs_rt298_probe(struct platform_device *pdev) @@ -268,7 +260,6 @@ static int avs_rt298_probe(struct platform_device *pdev) card->name = "avs_rt298"; card->dev = dev; card->owner = THIS_MODULE; - card->remove = avs_card_remove; card->suspend_pre = avs_card_suspend_pre; card->resume_post = avs_card_resume_post; card->dai_link = dai_link; From patchwork Fri Nov 25 18:40:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628813 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 727AFC4332F for ; Fri, 25 Nov 2022 18:27:01 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 87FC71760; Fri, 25 Nov 2022 19:26:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 87FC71760 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400819; bh=Ysy69L8HM0YbGGAtnOYqJuWV/TUhDas/7vRkQNHYZnw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=XbugadoNIq02H2SD95Yuhf5Ks0kNuuXKhXPyziHiwtkHJYHp15CJr8yBRU3HLgbIW 336Ru9xaPyLHo/ZVWWlT6cF9uVGfifNUTyxkRkkLkIrJDZajhSFPbEYDyrfWH3zuPe gZoM9YPcj1QRwM6EhcEhizgF8sOqHXLjRU3qzg4Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 06041F805AA; Fri, 25 Nov 2022 19:23:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5E696F80579; Fri, 25 Nov 2022 19:23:52 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 C0F9CF80579 for ; Fri, 25 Nov 2022 19:23:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C0F9CF80579 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UD6MUTyo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400629; x=1700936629; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ysy69L8HM0YbGGAtnOYqJuWV/TUhDas/7vRkQNHYZnw=; b=UD6MUTyo4ttbaTZowa0sE5WipOG3r6bMVpT8J8oAtWbPosi/QinLeT/S Im9ykaX6IyDFU6LFAQLGQrawK56HQs7yEVYmT+E5fZ8g9CzKPRQuZOjXR wcdJov7WOIQNUU7ln1NPoQzo/NFEF1l95rgSP2xH7wtYCnjHDyaJnZh3K 23Ituxx6ldEXiKs7PWZA9evdzZyk0zOL2uqjBR0KdUlm21sQOd5vQ6uxM 80TWn13AoMJ4J2kfoh6rsHu0m+I954w8Tz9ossazH93hnbi+fOA/N55lz oUhvKZXlTeX5v4PrGMRYZAv887qmroMH9RnrlP6U0Xjt4QpqlAu76QDli Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909231" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909231" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005579" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005579" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:46 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 10/11] ASoC: Intel: avs: rt5682: Add define for codec DAI name Date: Fri, 25 Nov 2022 19:40:31 +0100 Message-Id: <20221125184032.2565979-11-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Following commits will make use of it to find codec DAI, define it first. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt5682.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c index 01f9b9f0c12b..7f9edf4cbd04 100644 --- a/sound/soc/intel/avs/boards/rt5682.c +++ b/sound/soc/intel/avs/boards/rt5682.c @@ -26,6 +26,7 @@ #define AVS_RT5682_SSP_CODEC_MASK (GENMASK(2, 0)) #define AVS_RT5682_MCLK_EN BIT(3) #define AVS_RT5682_MCLK_24MHZ BIT(4) +#define AVS_RT5682_CODEC_DAI_NAME "rt5682-aif1" /* Default: MCLK on, MCLK 19.2M, SSP0 */ static unsigned long avs_rt5682_quirk = AVS_RT5682_MCLK_EN | AVS_RT5682_SSP_CODEC(0); @@ -184,7 +185,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5682:00"); - dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "rt5682-aif1"); + dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, AVS_RT5682_CODEC_DAI_NAME); if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) return -ENOMEM; @@ -194,6 +195,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in dl->num_platforms = 1; dl->id = 0; dl->init = avs_rt5682_codec_init; + dl->exit = avs_rt5682_codec_exit; dl->ops = &avs_rt5682_ops; dl->nonatomic = 1; dl->no_pcm = 1; From patchwork Fri Nov 25 18:40:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 628812 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 2F1B9C4332F for ; Fri, 25 Nov 2022 18:27:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5ADF0179B; Fri, 25 Nov 2022 19:26:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5ADF0179B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669400847; bh=+jpNXCjnA2vtqC68OJz5DzPsHQxplj15ix2RuVKRoFQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VrfaaV64EoDh9ASajPfrKHBCyjORh6cuBW5InSoG3j07ErtRYnU8EKVdIthU+JwdV BG9CXYA/sBeIRS5mZEG+LxJ6vOm6D+C9kaeDBDdGxCKQVjghD90vCg83bq5U8Ft7aP 73bov6XTy2n6+YnvEzPzi6wzzGGe52R7Wfw9DfPg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2200AF805B1; Fri, 25 Nov 2022 19:23:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6B1BDF80579; Fri, 25 Nov 2022 19:23:55 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 A43DEF80579 for ; Fri, 25 Nov 2022 19:23:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A43DEF80579 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Dk3U+RLd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669400633; x=1700936633; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+jpNXCjnA2vtqC68OJz5DzPsHQxplj15ix2RuVKRoFQ=; b=Dk3U+RLdcEFmk8HzSGWbQdviTVtuffQXyJBdzVJw4Gm4YAU5JlZaoVWe ItStMwM/p0aUO+inaRfsFMykGW/zpsc85nQHI67SDlV3N5nzIrqXQXx8x VuQ3ukA0FtLA4Vl8JnRXMXtquQ9Iq9m+GmYyzUpKIcboFCR0o8lD/19U4 oU2A8LMpZk2Ak5N//WuYeC0yNt5bfQQwGERToS/XX7CJMGJpCiyKFaVqw 9b6gikxt9OMF5EzlntWuFW67xbg3oIKmXJAeNINKsLEpgPv7hFOwUWX4+ 9nn9wrDMFmyW5Ng/rrCzFdqb4wKMQSnwZ1BY44xcYfKl0DRwsZhLz15gh A==; X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="294909234" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="294909234" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2022 10:23:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10542"; a="785005596" X-IronPort-AV: E=Sophos;i="5.96,194,1665471600"; d="scan'208";a="785005596" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 25 Nov 2022 10:23:48 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 11/11] ASoC: Intel: avs: rt5682: Refactor jack handling Date: Fri, 25 Nov 2022 19:40:32 +0100 Message-Id: <20221125184032.2565979-12-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221125184032.2565979-1-cezary.rojewski@intel.com> References: <20221125184032.2565979-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Amadeusz Sławiński Use link->exit() rather than pdev->remove() to unassign jack during card unbind procedure so codec link initialization and exit procedures are symmetrical. Also, there is no need to perform search for codec dai in suspend_pre() and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/boards/rt5682.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c index 7f9edf4cbd04..473e9fe5d0bf 100644 --- a/sound/soc/intel/avs/boards/rt5682.c +++ b/sound/soc/intel/avs/boards/rt5682.c @@ -120,6 +120,11 @@ static int avs_rt5682_codec_init(struct snd_soc_pcm_runtime *runtime) return 0; }; +static void avs_rt5682_codec_exit(struct snd_soc_pcm_runtime *rtd) +{ + snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL); +} + static int avs_rt5682_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -239,30 +244,19 @@ static int avs_create_dapm_routes(struct device *dev, int ssp_port, return 0; } -static int avs_card_set_jack(struct snd_soc_card *card, struct snd_soc_jack *jack) -{ - struct snd_soc_component *component; - - for_each_card_components(card, component) - snd_soc_component_set_jack(component, jack, NULL); - return 0; -} - -static int avs_card_remove(struct snd_soc_card *card) -{ - return avs_card_set_jack(card, NULL); -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { - return avs_card_set_jack(card, NULL); + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, AVS_RT5682_CODEC_DAI_NAME); + + return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); } static int avs_card_resume_post(struct snd_soc_card *card) { + struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, AVS_RT5682_CODEC_DAI_NAME); struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card); - return avs_card_set_jack(card, jack); + return snd_soc_component_set_jack(codec_dai->component, jack, NULL); } static int avs_rt5682_probe(struct platform_device *pdev) @@ -306,7 +300,6 @@ static int avs_rt5682_probe(struct platform_device *pdev) card->name = "avs_rt5682"; card->dev = dev; card->owner = THIS_MODULE; - card->remove = avs_card_remove; card->suspend_pre = avs_card_suspend_pre; card->resume_post = avs_card_resume_post; card->dai_link = dai_link;