From patchwork Mon Jun 12 11:09:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275438 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 ED75AC77B7A for ; Mon, 12 Jun 2023 03:19:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E27726C1; Mon, 12 Jun 2023 05:18:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E27726C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539961; bh=RcAGWFoO9nSBfI/X1vef7WgnMxUZjubEZI94Z23Z+44=; 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=WaEcMojw0t8KzeztGJ43/cJ96C/C/NT/EdM0amz4Osm32Zm2sxL9NwWNsxqS2BBaE eaewgpZdaw5ShIXrvE2qNDS+jLED7K92Nh37OfVPKS8vuagv7dEsgbQcoPQeqaf7aO WSWY0niGSGg3I000O4hxR27NCPjyvg5EyGd5g45U= Received: by alsa1.perex.cz (Postfix, from userid 50401) id EE502F805E2; Mon, 12 Jun 2023 05:15:57 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 895F3F805DF; Mon, 12 Jun 2023 05:15:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4A1FFF80130; Mon, 12 Jun 2023 05:15:51 +0200 (CEST) Received: from mga02.intel.com (mga02.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 19CF6F80130 for ; Mon, 12 Jun 2023 05:14:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 19CF6F80130 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=dnwVz5uH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539693; x=1718075693; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RcAGWFoO9nSBfI/X1vef7WgnMxUZjubEZI94Z23Z+44=; b=dnwVz5uH8pvr5EBMgEQ1l2xZGdqjdpvvBCJlJ41PMHNr/j3/gTKFz+W/ iZD9ESQ3T3SdRxQdnEmur8yJstuVxkxIsCNtUiuyrctSdoN+CNwDRsN5K 3pk17EmdYosFZS4/VHF8+4AOafrkn39rbVgRFlqeHskk1d17Rj85Zi67P zpwPSx7EpKMM710s1Zhw1eB0isZ1Nu/kNaoVLOiNkQsc1JqB++FPK8wss sAunDpuwfDM7AFoeVxAHFJuPQ06vYtSUxjGoL8UcNOOznWIWFY6nX3l/w BuLEuOLDfeJ+HFbLAg4PQudZMX2hjrkpnSlePfgnDxG00+TKipo5SL7+o A==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578891" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578891" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:14:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191875" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191875" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:44 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 01/12] ASoC: Intel: avs-da7219: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:47 +0800 Message-Id: <20230612110958.592674-2-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: FR7ELIUOLWLAUD7EPYEXRBR5TOEL7XF2 X-Message-ID-Hash: FR7ELIUOLWLAUD7EPYEXRBR5TOEL7XF2 X-MailFrom: brent.lu@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.8 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: Two routes "Playback<-sspX Tx" and "sspX Rx<-Capture" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/da7219.c | 45 ++--------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c index 1a1d572cc1d0..964a763732ab 100644 --- a/sound/soc/intel/avs/boards/da7219.c +++ b/sound/soc/intel/avs/boards/da7219.c @@ -181,38 +181,6 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "Capture"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, DA7219_DAI_NAME); @@ -230,14 +198,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_da7219_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -249,12 +216,6 @@ static int avs_da7219_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!jack || !card) @@ -271,8 +232,8 @@ static int avs_da7219_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; snd_soc_card_set_drvdata(card, jack); From patchwork Mon Jun 12 11:09:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275430 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 F0075C77B7A for ; Mon, 12 Jun 2023 03:17:23 +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 7194C82A; Mon, 12 Jun 2023 05:16:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7194C82A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539841; bh=n4WljQzl2VdpQPd3iTWOpWki7dTWlXg8XREKcKcC5Fk=; 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=UwDxGujDcD0DxJ3II6OLH2gR5ZAp+3f6rj/ZL2Kaixw7rS/8qy5eMII2u6WHO4HxY APDlRVOIT3sgRiuqFCfKyx5nfLMh7iNapM4nVEn6U1ue9bPu27qmQhMqi1/fnGmxR3 a1qe+ik951+ozqdUy5JjanvYNyAjBuU8PBmK2mes= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 886AEF80557; Mon, 12 Jun 2023 05:15:40 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E8C2BF80548; Mon, 12 Jun 2023 05:15:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 27C99F80544; Mon, 12 Jun 2023 05:15:11 +0200 (CEST) Received: from mga02.intel.com (mga02.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 B0ECAF80132 for ; Mon, 12 Jun 2023 05:14:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B0ECAF80132 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=T2JOH3tk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539693; x=1718075693; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n4WljQzl2VdpQPd3iTWOpWki7dTWlXg8XREKcKcC5Fk=; b=T2JOH3tks/7t6mwcT25veZ+tu3vng1F2sFRPbML1Mx8fY6n5SzOpw70V NRDjyDABQiNqwjiBLYzKanCx4z+Yg2kDZTCdl3QlHfJGPSGjFb6aURFG2 7EIkzYYUDSjYoDKEXYrjNB0UlUvkYkcmVXIt+/+a4MHpHBlcSZl/Ng3x8 SXd0J+2Qs+kEzSJ1YAyKm28HRn0DHoOi0eB2v1bR5/i+K6Xd2XsKelWAr wiw9aq5wXFELGpVVv9I0WiVExtnR03DnPUSv8yL/9UdkCxLrYI27IhiIX N1uFE3h+1cTZ7HFNw1hySng3l5QODJnpZPWGn+WOHgy6Agp4TtzDvK/Bw g==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578902" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578902" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:14:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191885" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191885" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:47 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 02/12] ASoC: Intel: avs-dmic: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:48 +0800 Message-Id: <20230612110958.592674-3-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: J4OZMPOU56EBSKZQ3AT4UGB6VTXHSBUH X-Message-ID-Hash: J4OZMPOU56EBSKZQ3AT4UGB6VTXHSBUH X-MailFrom: brent.lu@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.8 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: Two routes "DMIC Rx<-Capture" and "DMIC WoV Rx<-Capture" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/dmic.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/intel/avs/boards/dmic.c b/sound/soc/intel/avs/boards/dmic.c index 90a921638572..c270646faf86 100644 --- a/sound/soc/intel/avs/boards/dmic.c +++ b/sound/soc/intel/avs/boards/dmic.c @@ -44,8 +44,6 @@ static const struct snd_soc_dapm_widget card_widgets[] = { static const struct snd_soc_dapm_route card_routes[] = { {"DMic", NULL, "SoC DMIC"}, - {"DMIC Rx", NULL, "Capture"}, - {"DMIC WoV Rx", NULL, "Capture"}, }; static int avs_dmic_probe(struct platform_device *pdev) From patchwork Mon Jun 12 11:09:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275440 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 44F1FC77B7A for ; Mon, 12 Jun 2023 03:19:57 +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 21EFDDED; Mon, 12 Jun 2023 05:19:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 21EFDDED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539995; bh=5ZigPkJDIXift16/nF0BqzBHx5umgdG3eHZSsE529p8=; 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=iO/XAZOQYg8aHVXAcU32XUPZb9ZiiZOJZq9LcxRDGWQb9DBndxJ7xmTmcLp2/zeTr EF3JHYo+Pz57iWPCKCOU1h5+CXNQwKj/0x3/g9sSP05r9tSrfq7KTha8F5FRr4CqiN gpKRqlsihMssxzQmj8UpIMlxnFvrQf1RdPML+f9w= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5ABB2F805F7; Mon, 12 Jun 2023 05:16:02 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 61FD8F805F0; Mon, 12 Jun 2023 05:16:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BA706F805E5; Mon, 12 Jun 2023 05:15:57 +0200 (CEST) Received: from mga02.intel.com (mga02.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 1B4BEF80149 for ; Mon, 12 Jun 2023 05:14:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1B4BEF80149 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=MWFjyJIM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539695; x=1718075695; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5ZigPkJDIXift16/nF0BqzBHx5umgdG3eHZSsE529p8=; b=MWFjyJIMGwODS7DQioipgT8GEBGPZeNlmoEKMRcGSJilzeC3pGqHfP4/ 9vCj0ZiG+fzSrd+4McsT3Sj8aKB0LOnx5zsLTQcEXJBbSUI8dEyx5XSTu 5HlnR3BreyNovUDjSm+bVIQV2IPG8JDk0xyyHYFVafuA6GNvz0A5BgvLl np6rsGwMpPrDI00qMzf/msetYYyzgI39diEV/bdvbbzFX8ym+O4wmjoYf 24B096C5I361OC3jI+OsZkU3+qN1sN3tl//9dxaoLD94Jk/DC2cxxIzNT AtjCX/T7mnJHIQbw5e7B3HU+KIfRs43OroKEIT47dOL/UrMnKKPAqaQM4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578922" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578922" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:14:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191901" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191901" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:49 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 03/12] ASoC: Intel: avs-hdaudio: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:49 +0800 Message-Id: <20230612110958.592674-4-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: P2ZXWWYJFOHL2JYPNIPYAFEYJSXMVWPU X-Message-ID-Hash: P2ZXWWYJFOHL2JYPNIPYAFEYJSXMVWPU X-MailFrom: brent.lu@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.8 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: Three routes "HDMI 0 Playback<-hdaudioB0D2-cpu0 Tx", "HDMI 1 Playback<-hdaudioB0D2-cpu1 Tx" and "HDMI 2 Playback<-hdaudioB0D2-cpu2 Tx" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/hdaudio.c | 65 +--------------------------- 1 file changed, 1 insertion(+), 64 deletions(-) diff --git a/sound/soc/intel/avs/boards/hdaudio.c b/sound/soc/intel/avs/boards/hdaudio.c index a542a67e21d0..cb00bc86ac94 100644 --- a/sound/soc/intel/avs/boards/hdaudio.c +++ b/sound/soc/intel/avs/boards/hdaudio.c @@ -64,56 +64,6 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int return 0; } -static int avs_create_dapm_routes(struct device *dev, struct hda_codec *codec, int pcm_count, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - struct hda_pcm *pcm; - const char *cname = dev_name(&codec->core.dev); - int i, n = 0; - - /* at max twice the number of pcms */ - dr = devm_kcalloc(dev, pcm_count * 2, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - pcm = list_first_entry(&codec->pcm_list_head, struct hda_pcm, list); - - for (i = 0; i < pcm_count; i++, pcm = list_next_entry(pcm, list)) { - struct hda_pcm_stream *stream; - int dir; - - dir = SNDRV_PCM_STREAM_PLAYBACK; - stream = &pcm->stream[dir]; - if (!stream->substreams) - goto capture_routes; - - dr[n].sink = devm_kasprintf(dev, GFP_KERNEL, "%s %s", pcm->name, - snd_pcm_direction_name(dir)); - dr[n].source = devm_kasprintf(dev, GFP_KERNEL, "%s-cpu%d Tx", cname, i); - if (!dr[n].sink || !dr[n].source) - return -ENOMEM; - n++; - -capture_routes: - dir = SNDRV_PCM_STREAM_CAPTURE; - stream = &pcm->stream[dir]; - if (!stream->substreams) - continue; - - dr[n].sink = devm_kasprintf(dev, GFP_KERNEL, "%s-cpu%d Rx", cname, i); - dr[n].source = devm_kasprintf(dev, GFP_KERNEL, "%s %s", pcm->name, - snd_pcm_direction_name(dir)); - if (!dr[n].sink || !dr[n].source) - return -ENOMEM; - n++; - } - - *routes = dr; - *num_routes = n; - return 0; -} - /* Should be aligned with SectionPCM's name from topology */ #define FEDAI_NAME_PREFIX "HDMI" @@ -172,13 +122,12 @@ static int avs_card_late_probe(struct snd_soc_card *card) static int avs_probing_link_init(struct snd_soc_pcm_runtime *rtm) { - struct snd_soc_dapm_route *routes; struct snd_soc_acpi_mach *mach; struct snd_soc_dai_link *links = NULL; struct snd_soc_card *card = rtm->card; struct hda_codec *codec; struct hda_pcm *pcm; - int ret, n, pcm_count = 0; + int ret, pcm_count = 0; mach = dev_get_platdata(card->dev); codec = mach->pdata; @@ -200,18 +149,6 @@ static int avs_probing_link_init(struct snd_soc_pcm_runtime *rtm) return ret; } - ret = avs_create_dapm_routes(card->dev, codec, pcm_count, &routes, &n); - if (ret < 0) { - dev_err(card->dev, "create routes failed: %d\n", ret); - return ret; - } - - ret = snd_soc_dapm_add_routes(&card->dapm, routes, n); - if (ret < 0) { - dev_err(card->dev, "add routes failed: %d\n", ret); - return ret; - } - return 0; } From patchwork Mon Jun 12 11:09:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275441 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 AE940C7EE23 for ; Mon, 12 Jun 2023 03:20:06 +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 E8DD6AE9; Mon, 12 Jun 2023 05:19:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E8DD6AE9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686540004; bh=xwsgpdxaqinXUt42/9XufyLi9iO/nioCRY94pZmKTgQ=; 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=mkS0P1Y5sba0MO4/JMZ3rVLNXS7AzRhbXvY1bxwTw6h7kkbQbDBmYyp5eaNYxXAuB MjCPg9/XCleyM6t11ZAJqptP2fDhLCc2pTxYFTkl1XyAO8iVJToVdgMfEhI/v3NDvh 1KiAtDoHRWdpzcCNo/RiVI/sqZStYbrmapfZmx/o= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D3846F805F8; Mon, 12 Jun 2023 05:16:04 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C57C6F805F9; Mon, 12 Jun 2023 05:16:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BFC65F805EB; Mon, 12 Jun 2023 05:15:59 +0200 (CEST) Received: from mga02.intel.com (mga02.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 41611F80155 for ; Mon, 12 Jun 2023 05:14:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 41611F80155 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=UwoEG8Sd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539696; x=1718075696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xwsgpdxaqinXUt42/9XufyLi9iO/nioCRY94pZmKTgQ=; b=UwoEG8Sd5UgvyUoBSzpgREqUIzu8SOMrxmJ7JG3URwSprINcNh8pwqz7 riK2kQjYfIMdj1iubDpgFx2FtR3DDSpZMh8ySecos6/EHnN7FjrJ/ZxHS zcIKtd1Qq7Vb/Aah7TYlt0ezLNWcuOYysjyWVDTrqRrSHhkqI4t/PAXhw XRHwC2JP1swtCB6m0Yh6IZiF5qL/Kv8+37HwoOiKdJcqlBexQPmxFeAQC q8Q+Tr5uAsLFbAO81PI6gUN/DuyQ5MevCZOTQmoWuCnPyb1v3v0AXYerC pVhPBIS3Jlw4yY9e/KdDtIsiSQT9ubmOnGewEHwiYpRAL8RkJvLDy/fZi g==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578934" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578934" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:14:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191918" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191918" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:52 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 04/12] ASoC: Intel: avs-max98357a: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:50 +0800 Message-Id: <20230612110958.592674-5-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: W3YR33TKSXRPRVNO3KSQ4LFKEBCEDQA6 X-Message-ID-Hash: W3YR33TKSXRPRVNO3KSQ4LFKEBCEDQA6 X-MailFrom: brent.lu@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.8 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: The route "HiFi Playback<-sspX Tx" is created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/max98357a.c | 39 ++------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/sound/soc/intel/avs/boards/max98357a.c b/sound/soc/intel/avs/boards/max98357a.c index 183123d08c5a..b9b20562c691 100644 --- a/sound/soc/intel/avs/boards/max98357a.c +++ b/sound/soc/intel/avs/boards/max98357a.c @@ -86,41 +86,14 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 1; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "HiFi Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_max98357a_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -132,12 +105,6 @@ static int avs_max98357a_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; @@ -151,8 +118,8 @@ static int avs_max98357a_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; ret = snd_soc_fixup_dai_links_platform_name(card, pname); From patchwork Mon Jun 12 11:09:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275439 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 1D04DC77B7A for ; Mon, 12 Jun 2023 03:19:38 +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 AFA0086E; Mon, 12 Jun 2023 05:18:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AFA0086E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539975; bh=oLPs9XeZPB29Gk2q8nALmTV059usJ3RGv1ZaTgGsjRQ=; 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=Jo5XKvWWPqke20TNfdJJU6bHEFiiR2qOYU4614Ps/nBpMfS8UozWe+W2zSKs3pkIR nImQpoFirmLAK53WktoRL0VcNCZtHyGt9XFTPJjzo7R+bE2fxT4rRX8ONYU3/aLkIG HFVmJYa/dBN3nv8LKXL9/wEnESrrXFqecESORXvQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D06BF805ED; Mon, 12 Jun 2023 05:16:00 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E807AF805E5; Mon, 12 Jun 2023 05:15:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 38AC6F805CA; Mon, 12 Jun 2023 05:15:53 +0200 (CEST) Received: from mga02.intel.com (mga02.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 BAA10F80246 for ; Mon, 12 Jun 2023 05:14:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BAA10F80246 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=nPKCFTWi DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539701; x=1718075701; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oLPs9XeZPB29Gk2q8nALmTV059usJ3RGv1ZaTgGsjRQ=; b=nPKCFTWihJ0e1mOfPC7N8agoYedehtprCoWRcQbpoCR7mPvbTmXfxcFc lpEf/mt4FPe6Jv6PA+3ExdBDfKQNMHFKm2O3eMGoHDXvPon7EIeHK6Ay5 hobTlYIAKbJNpaFfv2Toq625J9/XJDeoFANMjw9PoNAQK0DagClClTd2h j9+8uv1u7t71r0wON/n69IJKxEr3zUN6LDWDQbVuc5gLzg3a+kqEdlpKZ 1nx+AAlQNG48s+BXlWjx57ldMoMiQVZzmR+eBcd4Fegyqs6UCH50WyjTu jcMU0/FP8abYM+F/LSm7wGSkK4wFOsJDokVMWxJkXUWFxV2Bhy2F49vQr A==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578953" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578953" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:14:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191923" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191923" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:54 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 05/12] ASoC: Intel: avs-max98373: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:51 +0800 Message-Id: <20230612110958.592674-6-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: SCLA24DDZC6TKUJMVLWZDM5KYZYX2JAU X-Message-ID-Hash: SCLA24DDZC6TKUJMVLWZDM5KYZYX2JAU X-MailFrom: brent.lu@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.8 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: Two routes "Left HiFi Playback<-sspX Tx" and "Right HiFi Playback<-sspX Tx" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/max98373.c | 45 ++------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/max98373.c b/sound/soc/intel/avs/boards/max98373.c index 8e221ecd34b0..3833251ade26 100644 --- a/sound/soc/intel/avs/boards/max98373.c +++ b/sound/soc/intel/avs/boards/max98373.c @@ -141,47 +141,14 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Left HiFi Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Right HiFi Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_max98373_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -193,12 +160,6 @@ static int avs_max98373_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; @@ -214,8 +175,8 @@ static int avs_max98373_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; ret = snd_soc_fixup_dai_links_platform_name(card, pname); From patchwork Mon Jun 12 11:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275431 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 CCCB6C7EE23 for ; Mon, 12 Jun 2023 03:17:28 +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 A0442828; Mon, 12 Jun 2023 05:16:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A0442828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539846; bh=POMQMoF5yCzfeN4V70o3A5GGX/JVr+bQ1FqtXyqQk74=; 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=q6xqQXT8RLTe98necS5NCQKiDt+Uns92+pYX0eewdciciOm6jAmAmPXb856FE4xwc 2tc67r47EH+NtRLn/rGJxQ+Z3cOGEsr2rC3LzFRw4uZEg4dFgEoMbbH1w3NMovMQqC zswBgzl7zcsAxZa+XqsMdygkpLCg0d4z/CijYuNY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id AF6FBF8057C; Mon, 12 Jun 2023 05:15:43 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 95F84F8056F; Mon, 12 Jun 2023 05:15:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3D7C6F80301; Mon, 12 Jun 2023 05:15:15 +0200 (CEST) Received: from mga02.intel.com (mga02.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 C98CAF8025E for ; Mon, 12 Jun 2023 05:15:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C98CAF8025E 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=KeZ9tu7h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539703; x=1718075703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=POMQMoF5yCzfeN4V70o3A5GGX/JVr+bQ1FqtXyqQk74=; b=KeZ9tu7hIFbOtfVH1jzjmxQ6UjGdv49USGjKRvLMvPAC9f0jNsKiMcMU we3+qbmV1ZVIT/vlaqlb8HonQLGHIy9tSqjR7W1B8+yoRJBGuapToOR9f QhY/RmrFI1k9iZY+YVYBkoLb8Pty62hqK/ewbElQ9tXPxZdr/+t+Wj6ut qjboo3CI0WDZS8jNJXTSTHJIPtxrSs6uygupLsXC2R70w0/3wMkXkQFRY itLq8W+RkzdslW/PcCWwjnzxVYyin33fXlp+UoFue6E5zmQnc4e94qcT0 G0pGW6FtbgUzie5ZPGhGrH7FH3W/XA18ZgXkletS+sG7mUbvuTPDh67bo g==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578969" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578969" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:14:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191928" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191928" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:57 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 06/12] ASoC: Intel: avs-max98927: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:52 +0800 Message-Id: <20230612110958.592674-7-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: AXW7PEKIKFZB5R4OIQU3QZYPGNLSULO6 X-Message-ID-Hash: AXW7PEKIKFZB5R4OIQU3QZYPGNLSULO6 X-MailFrom: brent.lu@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.8 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: Two routes "Left HiFi Playback<-sspX Tx" and "Right HiFi Playback<-sspX Tx" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/max98927.c | 45 ++------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/max98927.c b/sound/soc/intel/avs/boards/max98927.c index 7cccce99f92e..09b231bf4e6d 100644 --- a/sound/soc/intel/avs/boards/max98927.c +++ b/sound/soc/intel/avs/boards/max98927.c @@ -138,47 +138,14 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Left HiFi Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Right HiFi Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_max98927_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -190,12 +157,6 @@ static int avs_max98927_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; @@ -211,8 +172,8 @@ static int avs_max98927_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; ret = snd_soc_fixup_dai_links_platform_name(card, pname); From patchwork Mon Jun 12 11:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275432 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 F0CF8C77B7A for ; Mon, 12 Jun 2023 03:17:48 +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 9FF4084D; Mon, 12 Jun 2023 05:16:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9FF4084D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539866; bh=J5+q5OqTn3NUhd2KAcv2OeDPqTsFvVodE6kntNgJTpc=; 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=ja6GsmnrcHCTZhBi7SqcLYOIoZlvhEf88QURZt82/4EDff1E6N+/UFcJEEZA14CIr MuLhpI/6vZl+MduVNyUrqKXIhQXz3pAjVXs1Ezj7sXRgZA54stgDd6LMAtybXmWtwA HZ/QnV5TYMKbVriQ36wANSreHxnT+u3cERuipOns= Received: by alsa1.perex.cz (Postfix, from userid 50401) id BD0A1F80580; Mon, 12 Jun 2023 05:15:44 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 6F5ECF80589; Mon, 12 Jun 2023 05:15:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 00E21F8025E; Mon, 12 Jun 2023 05:15:16 +0200 (CEST) Received: from mga02.intel.com (mga02.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 187A9F8052E for ; Mon, 12 Jun 2023 05:15:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 187A9F8052E 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=TQUzCd47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539704; x=1718075704; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J5+q5OqTn3NUhd2KAcv2OeDPqTsFvVodE6kntNgJTpc=; b=TQUzCd47WA4T+VXPM8SkZQahtZTcXlTCsUuvNLj5qtUZGIOoQppfkWLd FoRgFWKCYn75M8tXrZbD9+ZlHk31OOr1AYbzh7KFTvvbRZyi152/7ULL4 61O5tpV4af7UgrkFaXmSn6XODj/HjpiU7PU9VV7Sd/GZRh1ZHlJV0iJmU sDR1wI/OiZnCjZZvzZT0EGBRbGRgvL2ff+YXpu3sB42065CwEn4E4arIo lwcJeJ3QSISyMyEQA9LJ1et30q0d1P+EftQIOfb4reJGUdVcjawe2ckrr Xh2Bw4xsTFBb5mkXlfG5TpvfHhTCEfehW3cz++fp1eNxQRGCxq5v1HVGg g==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578985" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578985" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:15:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191950" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191950" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:59 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 07/12] ASoC: Intel: avs-nau8825: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:53 +0800 Message-Id: <20230612110958.592674-8-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: TVGA3B37YZLEI4UOLCPL5SJ4AB4AUQRP X-Message-ID-Hash: TVGA3B37YZLEI4UOLCPL5SJ4AB4AUQRP X-MailFrom: brent.lu@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.8 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: Two routes "Playback<-sspX Tx" and "sspX Rx<-Capture" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/nau8825.c | 45 ++-------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c index b69fc5567135..38c5087d98e9 100644 --- a/sound/soc/intel/avs/boards/nau8825.c +++ b/sound/soc/intel/avs/boards/nau8825.c @@ -215,38 +215,6 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "Capture"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, SKL_NUVOTON_CODEC_DAI); @@ -274,14 +242,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_nau8825_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -293,12 +260,6 @@ static int avs_nau8825_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!jack || !card) @@ -315,8 +276,8 @@ static int avs_nau8825_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; snd_soc_card_set_drvdata(card, jack); From patchwork Mon Jun 12 11:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275433 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 09488C77B7A for ; Mon, 12 Jun 2023 03:18:10 +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 D83C0829; Mon, 12 Jun 2023 05:17:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D83C0829 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539887; bh=lGVwchl47pkFi5mkMWFQzQSuj4/1bP7rLxRqkLFCwWA=; 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=NE/g/NTkRmeFYiL4Sx4iKljQUA0o9aibc+AgfvpvMWnN/85IhamjKr9SpFWbJWYG3 arEqJe2UcC/gkcnf3AtjzEjIWq3UR0fM+7HWCq73IV0C/4K4Tn9n5LjhHT6ozBuu8j zXoef1y4euy0HF5mssy1IehMVdnCa4a/racxOds0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1EE32F805AB; Mon, 12 Jun 2023 05:15:45 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 59AFCF805A1; Mon, 12 Jun 2023 05:15:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 022AEF8025E; Mon, 12 Jun 2023 05:15:19 +0200 (CEST) Received: from mga02.intel.com (mga02.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 6E37BF80533 for ; Mon, 12 Jun 2023 05:15:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6E37BF80533 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=HVGAtIjg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539708; x=1718075708; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lGVwchl47pkFi5mkMWFQzQSuj4/1bP7rLxRqkLFCwWA=; b=HVGAtIjgJTwGKbmWh8AMUKdlbT0nTjPunPObDEHT1DRUKe9vYdDV4iuo 4WsYBVHW35XUtQFSfvcxcgvDprPJzaIQGCE/agnFykJmL8efBiPzWPA6T bbU4bsfLYTcC7L9riLjKLieGy2Zw/To4i36qKvRe27ZlpnoT4SiAOhPD8 /BLW4W1vFQYb9n3OBtwmueGtP4Fw0rRw6P+YUFX1TzyYbxcWKlGxQKah/ LFpjMMShCGOqEIvNUEmNYzTSB8GE9Cf/f2FCLPiaMp7FLmrosNK2R1bWi U481L5q1DviLkNbrCxgFvnIbGkAo141Gan/OHsUMTHr9mHA3nkW0Mq11n w==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578997" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578997" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:15:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191967" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191967" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:15:02 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 08/12] ASoC: Intel: avs-rt274: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:54 +0800 Message-Id: <20230612110958.592674-9-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: SHYO3H2OED3I5GZR7DHZGJVUSW7326AV X-Message-ID-Hash: SHYO3H2OED3I5GZR7DHZGJVUSW7326AV X-MailFrom: brent.lu@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.8 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: Two routes "AIF1 Playback<-sspX Tx" and "sspX Rx<-AIF1 Capture" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/rt274.c | 45 ++---------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt274.c b/sound/soc/intel/avs/boards/rt274.c index 6a1e121f082f..ebfee54814ce 100644 --- a/sound/soc/intel/avs/boards/rt274.c +++ b/sound/soc/intel/avs/boards/rt274.c @@ -188,38 +188,6 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Capture"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT274_CODEC_DAI); @@ -237,14 +205,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_rt274_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -256,12 +223,6 @@ static int avs_rt274_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!jack || !card) @@ -278,8 +239,8 @@ static int avs_rt274_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; snd_soc_card_set_drvdata(card, jack); From patchwork Mon Jun 12 11:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275435 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 7C440C7EE23 for ; Mon, 12 Jun 2023 03:18:40 +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 2B88D850; Mon, 12 Jun 2023 05:17:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2B88D850 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539918; bh=RCNPw6SM+wE+oSvjCiunxs3XvlCVgcnR3aZfWQpux90=; 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=iMExNdvKseNAQoTvaNg++QE8KSldCGNiWbbNhJXIpaZjuiljjP2M+VX2+1gS7ayN0 xAbI4o54iC8yqq3UP2f5auJWvhnezMTZJO9ZHTc5opew3IUMZAK3Scgan0dZaGjbGa aY0KfyfKVhuY29Jfe2Khm5tEsO+wTSuCEtfQFx/0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 53628F805B1; Mon, 12 Jun 2023 05:15:51 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 14D71F805B1; Mon, 12 Jun 2023 05:15:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C0772F80533; Mon, 12 Jun 2023 05:15:34 +0200 (CEST) Received: from mga02.intel.com (mga02.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 A6BB1F80132 for ; Mon, 12 Jun 2023 05:15:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A6BB1F80132 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=Dv4qRCgy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539729; x=1718075729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RCNPw6SM+wE+oSvjCiunxs3XvlCVgcnR3aZfWQpux90=; b=Dv4qRCgymjLjTP8FP38UMA5wUFL2oW8ty2iN60Vd2kFLszy7JRWplMur EFKAcXE6i0rLnOpidUke0fdH0c2+xVOp4NAA+ZYRiDrqyxmcmgZekBSDB In5zoywfXfKT00XUS4aZvRUqtPFgXVY6nJEUDhjCrTcQRgSbbDHeo5JJ6 E/VFZhHiJxwtk131jsZ6yWib2Lmlg6mn31OIyjmUDWBeuMiZlj8TLV/Yu UDLNyNKByHCE0yEQW7BRNCHq4JtB2Y6AAe40O0GgdGKFaZ94XvaFPnT0I 5bCqyazre3oq2r1mjfZtAKwum6CCFdXHtCyWIQYs241hDDfVMlokUyZnY w==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347579013" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347579013" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:15:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191975" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191975" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:15:05 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 09/12] ASoC: Intel: avs-rt286: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:55 +0800 Message-Id: <20230612110958.592674-10-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: BTRQIDUHUXJK5TYY2OUUGCUZV73LRH7A X-Message-ID-Hash: BTRQIDUHUXJK5TYY2OUUGCUZV73LRH7A X-MailFrom: brent.lu@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.8 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: Two routes "AIF1 Playback<-sspX Tx" and "sspX Rx<-AIF1 Capture" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/rt286.c | 45 ++---------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c index 3551a05bd599..84cf9a0c8dfe 100644 --- a/sound/soc/intel/avs/boards/rt286.c +++ b/sound/soc/intel/avs/boards/rt286.c @@ -158,38 +158,6 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Capture"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT286_CODEC_DAI); @@ -207,14 +175,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_rt286_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -226,12 +193,6 @@ static int avs_rt286_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!jack || !card) @@ -248,8 +209,8 @@ static int avs_rt286_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; snd_soc_card_set_drvdata(card, jack); From patchwork Mon Jun 12 11:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275434 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 8EBCDC7EE23 for ; Mon, 12 Jun 2023 03:18:19 +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 517B684A; Mon, 12 Jun 2023 05:17:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 517B684A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539897; bh=6YiX0yvmiKQf+uAku9yo5ddxL+NRFfsXBZ33VFKIHJM=; 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=RyH7wcc3HIbbfT12ml/paMpyB3vesmp46JaoB+V9wfreVOsTV9yF4/SjZwdA7nVCZ YaxczdL+hYVrA/7mK1nGajPcxaT67+zzlSWXLTVlYv+NtEkx3QMO3/ywko3Fv7sgn+ Xc5Otggbc2NHXl7xP66FvfXlVQgE02MMptZROses= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 86FD8F805A8; Mon, 12 Jun 2023 05:15:48 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3A20AF805B0; Mon, 12 Jun 2023 05:15:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3763AF8025E; Mon, 12 Jun 2023 05:15:33 +0200 (CEST) Received: from mga02.intel.com (mga02.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 71B2CF8025E for ; Mon, 12 Jun 2023 05:15:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 71B2CF8025E 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=NTa8bhhR DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539729; x=1718075729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6YiX0yvmiKQf+uAku9yo5ddxL+NRFfsXBZ33VFKIHJM=; b=NTa8bhhRZUURkUj/MLp3PE0yn6E/EDx9Oy+0uGuOyQLjFR6BPISrztLd 8zdl7VlYww+2vG/34ghvlZ5Ji0VteuZVoSIia9sM4s6Xc2c20MEOfMtUr eISIhtOS1RtLp1OnHU0yRhRZhgO4UpgDPFfyj4df2Vq1qbWrfuz09PFxY 1hHQzq0pEIj9RlkTN/FUfr4wLmuzxLbEGFUXg2elPPfJHRYFDrfXAhQpu bfwbSxvV68aE0VlXe3l33ySyU0kk7kdaGdyDuePlSmWdnWL1qru806AW/ vPEpZ28vvGQYR05BRQe8oWWl2+qEmw51W4ZVkAbks8pvcB6nz7VfYDOvK w==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347579026" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347579026" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:15:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191988" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191988" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:15:07 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 10/12] ASoC: Intel: avs-rt298: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:56 +0800 Message-Id: <20230612110958.592674-11-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: CVLAFHMQXDH3LV4HWPWIYWC64RSTB4EN X-Message-ID-Hash: CVLAFHMQXDH3LV4HWPWIYWC64RSTB4EN X-MailFrom: brent.lu@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.8 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: Two routes "AIF1 Playback<-sspX Tx" and "sspX Rx<-AIF1 Capture" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/rt298.c | 45 ++---------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt298.c b/sound/soc/intel/avs/boards/rt298.c index 2923f3805bbe..3b0e2b1a3251 100644 --- a/sound/soc/intel/avs/boards/rt298.c +++ b/sound/soc/intel/avs/boards/rt298.c @@ -178,38 +178,6 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Capture"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, RT298_CODEC_DAI); @@ -227,14 +195,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_rt298_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -246,12 +213,6 @@ static int avs_rt298_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!jack || !card) @@ -268,8 +229,8 @@ static int avs_rt298_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; snd_soc_card_set_drvdata(card, jack); From patchwork Mon Jun 12 11:09:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275436 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 15361C7EE23 for ; Mon, 12 Jun 2023 03:18:53 +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 153AAA4A; Mon, 12 Jun 2023 05:18:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 153AAA4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539931; bh=S0S7wq1pknM5ia0eidCg38PVrAMtNRnOsHs8GfwgFAs=; 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=XZ5dzedR+OQVI32mjvloUiBIGiaixAZIQQiukXJZuiPVMSf7sermHxTwt/RBnVb+M FjHmN5xQD/zG2iv6iWs3pKd9I70DVeRGsqc0hiaHRe0i+V9agpozVS/YRWjLj6j8Oo c5nVgxxnpUR+BmY1GqZ1KEJwL3PEjK8loMP8TSEs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7B697F805BD; Mon, 12 Jun 2023 05:15:54 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id F2D74F805C0; Mon, 12 Jun 2023 05:15:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5A8B5F8052E; Mon, 12 Jun 2023 05:15:36 +0200 (CEST) Received: from mga02.intel.com (mga02.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 89926F80301 for ; Mon, 12 Jun 2023 05:15:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 89926F80301 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=mElG8I8r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539731; x=1718075731; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=S0S7wq1pknM5ia0eidCg38PVrAMtNRnOsHs8GfwgFAs=; b=mElG8I8rpg0cqsU/aMFXp5P0DH2X2NihD7NpQ4cOo9c0LhoYUG3WU9Ta Pn/MbhKpR7AnBeDNFSDYKK/2D0nK79nwSHFlIxGbRLhiDqWTFO5V4makZ fn9DeKk6DPoM9HYCnWslBk0Eo+Syr0/uK8ERwqKss6OhAS6z1hPjUmE02 y+RcCixdTgBPlTVODr1uz5ni0cxGpnujF6gOGvCDslX396dfxx+GYoadL XX6tFK5rfR94DGgd6PocbnTvTvqjgemaLblZ6EuarP8Pz0CbvDNNCDerx sYPTZPEI5A6l9yNmuWpBVUAd01t4tcp3Ef97jn1MZNVIX0jUIvgZtyheN Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347579040" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347579040" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:15:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191995" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191995" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:15:10 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 11/12] ASoC: Intel: avs-rt5682: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:57 +0800 Message-Id: <20230612110958.592674-12-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: C7ABIYZC44S7RJPLW2WQS2KPYBWCD273 X-Message-ID-Hash: C7ABIYZC44S7RJPLW2WQS2KPYBWCD273 X-MailFrom: brent.lu@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.8 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: Two routes "AIF1 Playback<-sspX Tx" and "sspX Rx<-AIF1 Capture" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/rt5682.c | 45 ++--------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt5682.c b/sound/soc/intel/avs/boards/rt5682.c index b2c2ba93dcb5..7142a67900bf 100644 --- a/sound/soc/intel/avs/boards/rt5682.c +++ b/sound/soc/intel/avs/boards/rt5682.c @@ -234,38 +234,6 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 2; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "AIF1 Capture"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_card_suspend_pre(struct snd_soc_card *card) { struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, AVS_RT5682_CODEC_DAI_NAME); @@ -283,14 +251,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_rt5682_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct snd_soc_jack *jack; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; if (pdev->id_entry && pdev->id_entry->driver_data) avs_rt5682_quirk = (unsigned long)pdev->id_entry->driver_data; @@ -308,12 +275,6 @@ static int avs_rt5682_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - jack = devm_kzalloc(dev, sizeof(*jack), GFP_KERNEL); card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!jack || !card) @@ -330,8 +291,8 @@ static int avs_rt5682_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; snd_soc_card_set_drvdata(card, jack); From patchwork Mon Jun 12 11:09:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 13275437 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 C641CC7EE23 for ; Mon, 12 Jun 2023 03:19:09 +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 041C6857; Mon, 12 Jun 2023 05:18:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 041C6857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686539948; bh=yEL4WgOYASzXlYpxiAO18qiaEOcuWhFhWKeJfuvKTD4=; 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=ovwFvS1v5lVPcZYcQv8XSGqy7unW4wM1gOajKGGTs5aKmB50q8GwfGmg/O5wSevz0 5nCSwXV/kLer+KAxY/wx4d2+aBHj6vXpeDCGaNvWDvpqZ1CXPLDzqHAs2ptgZ0Dbnz jO3jxtMSTv3I3W6r32wLVX/cy/ypY/pezRDTRqBU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 029B3F805D4; Mon, 12 Jun 2023 05:15:55 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C751FF805D2; Mon, 12 Jun 2023 05:15:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DF7D9F80301; Mon, 12 Jun 2023 05:15:37 +0200 (CEST) Received: from mga02.intel.com (mga02.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 92848F800BA for ; Mon, 12 Jun 2023 05:15:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 92848F800BA 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=dMrGaeHy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539732; x=1718075732; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yEL4WgOYASzXlYpxiAO18qiaEOcuWhFhWKeJfuvKTD4=; b=dMrGaeHyvf5vdpVFw6tY0X7lF4PAsVcsNZf878VjrugxOpWEdhVFIqP9 R3PExm5fDytLDDbZiGnAu7IlzFEhthr1RO8GoITRJT4C82mj2w6m58mBZ xS1YTixfO/2woC4m0nwlhNST1yFt9vn+PR4r5ir06xFYoII9Prt2tIJxb 8XcAs+2CwIbN0noRROt+x8VXiY/VVFPP8YxltVxBiWv5su9s2j/RQcCO0 yQx5twwfbdTwvQGBIfyIu2a7fXvw8EDt5dSTKEoJExhoDdg6fmBlAPqIu gOEqFAU6S71dpBPmtm4PbLieRthPTS/W/cImFT/YgAqmW99rdOHy4OPin w==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347579058" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347579058" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 20:15:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776192001" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776192001" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:15:13 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Brent Lu , linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [PATCH 12/12] ASoC: Intel: avs-ssm4567: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:58 +0800 Message-Id: <20230612110958.592674-13-brent.lu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com> References: <20230612110958.592674-1-brent.lu@intel.com> MIME-Version: 1.0 Message-ID-Hash: FHS463F3K4OCED2QGMVVREKUK3OJZK7O X-Message-ID-Hash: FHS463F3K4OCED2QGMVVREKUK3OJZK7O X-MailFrom: brent.lu@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.8 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: Four routes "Left Playback<-sspX Tx", "Right Playback<-sspX Tx", "sspX Rx<-Left Capture Sense", and "sspX Rx<-Right Capture Sense" are created by snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the duplicate routes. Signed-off-by: Brent Lu --- sound/soc/intel/avs/boards/ssm4567.c | 57 ++-------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/sound/soc/intel/avs/boards/ssm4567.c b/sound/soc/intel/avs/boards/ssm4567.c index 2b7f5ad92aca..7324869d6132 100644 --- a/sound/soc/intel/avs/boards/ssm4567.c +++ b/sound/soc/intel/avs/boards/ssm4567.c @@ -129,59 +129,14 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in return 0; } -static int avs_create_dapm_routes(struct device *dev, int ssp_port, - struct snd_soc_dapm_route **routes, int *num_routes) -{ - struct snd_soc_dapm_route *dr; - const int num_base = ARRAY_SIZE(card_base_routes); - const int num_dr = num_base + 4; - int idx; - - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); - if (!dr) - return -ENOMEM; - - memcpy(dr, card_base_routes, num_base * sizeof(*dr)); - - idx = num_base; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Left Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "Right Playback"); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Tx", ssp_port); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "Left Capture Sense"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - idx++; - dr[idx].sink = devm_kasprintf(dev, GFP_KERNEL, "ssp%d Rx", ssp_port); - dr[idx].source = devm_kasprintf(dev, GFP_KERNEL, "Right Capture Sense"); - if (!dr[idx].sink || !dr[idx].source) - return -ENOMEM; - - *routes = dr; - *num_routes = num_dr; - - return 0; -} - static int avs_ssm4567_probe(struct platform_device *pdev) { - struct snd_soc_dapm_route *routes; struct snd_soc_dai_link *dai_link; struct snd_soc_acpi_mach *mach; struct snd_soc_card *card; struct device *dev = &pdev->dev; const char *pname; - int num_routes, ssp_port, ret; + int ssp_port, ret; mach = dev_get_platdata(dev); pname = mach->mach_params.platform; @@ -193,12 +148,6 @@ static int avs_ssm4567_probe(struct platform_device *pdev) return ret; } - ret = avs_create_dapm_routes(dev, ssp_port, &routes, &num_routes); - if (ret) { - dev_err(dev, "Failed to create dapm routes: %d", ret); - return ret; - } - card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; @@ -214,8 +163,8 @@ static int avs_ssm4567_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(card_controls); card->dapm_widgets = card_widgets; card->num_dapm_widgets = ARRAY_SIZE(card_widgets); - card->dapm_routes = routes; - card->num_dapm_routes = num_routes; + card->dapm_routes = card_base_routes; + card->num_dapm_routes = ARRAY_SIZE(card_base_routes); card->fully_routed = true; card->disable_route_checks = true;