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: 691674 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;