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: 106205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2338882vqr; Sun, 11 Jun 2023 20:47:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Cc/WmASeWTnECek7rWij21Yk+b5O3dJ++7MN2rrb0iSDhkcDmVR+gjiw9Rc3xc4Dp2SWy X-Received: by 2002:a17:907:3da7:b0:978:9666:2ea6 with SMTP id he39-20020a1709073da700b0097896662ea6mr8632988ejc.66.1686541651055; Sun, 11 Jun 2023 20:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686541651; cv=none; d=google.com; s=arc-20160816; b=IJn/aBtbSyBYDXYL+mIgHpoyrEG4xfg2Pth9yVd88dTB4f9H1/9RMhLIcI7ezy7TtE jdKypTUFFndwaehZx0YKwZLLzcMsXvB11fyNdH/brkObkj08xrqHOL3hM0H/XtFAU/pG cKeKKsxNOItu5yQUfLxZwBQdfV7XILy6+OBJb9EZbt63uZ/O0xF0KoEzDWASUl6NtQKh ki2Hag9xTDrBTNIWJTWNWfZyFEXmGyCZDAa6MLikDVS3bJTbK09L1sWUT/SVAaLenwF1 YLPmXO3lIih8g9QvJSu3jAPpe2fC0rWrlEnKTU19AX0Vda/tJLDjqQtkXWdGMbqv1MBf qbrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NH0InJy24kOoPl32JEt+WHh+r7c77sVZv/ls5z3ZzIM=; b=qxA/zineXhS+GX2h9rysuNDt9SawdFJz6cnYP9veyn6X5jAlH6Q5E1mO8V9ysEYQoT rV3WU0LUtb3Q6/6K2eQ3nKAGLwFdFAfHuyu6wJrLBSlLMbfBsCwnEU7CdQILAg6O15zD QjEbquVHmHG/OsTmcGxQWoKRcpC4BMIS+m0B3zjA+c1q93KExlQU2FZ8pQLDkVlA0uEo 6ipqQSqz0vWF7YAA7KP89osIvZ1E8BcVPAkubw2ub5BO0Flm48B/mJn+7WlpE2ke50QH TwSMkzMUiJWuTQY+Q9GVGQk+Q+iYILcTGms63DUNW/wfJHPjMiJ64PoUdrohlrqxby9y /nEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="IO1ArgO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020a170906350c00b00977d0a5e1e5si4907292eja.44.2023.06.11.20.47.05; Sun, 11 Jun 2023 20:47:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="IO1ArgO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234422AbjFLDPb (ORCPT + 99 others); Sun, 11 Jun 2023 23:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234688AbjFLDPD (ORCPT ); Sun, 11 Jun 2023 23:15:03 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DE0CE63 for ; Sun, 11 Jun 2023 20:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539700; x=1718075700; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=POMQMoF5yCzfeN4V70o3A5GGX/JVr+bQ1FqtXyqQk74=; b=IO1ArgO/ACBVfo/rfvbuCuvz3nTnisVfM/Htag6MG6xmBxjq+g+Zjuse TRdQ9utxk9lt4u5/JvDs7EtBhlZYyQaOUE7XV1zHdAjHotFykzHhHtv41 1wYoGp/FHKlWhW4ddMwIcZ3woZg9LfBIk8oD0RFVrxu+IomYuKMWgtDOP R6/vDFYMrmu1+DCD+vxeBb7X9Mz+WPcsB1FKqDLI7W4iuwDNH2/a0nYw/ RMVjrLCJ58x+BZ6xJEudPstYrjON6rY0atDSdLulSw/JFV2RzUENtVm8B +p7/Ou5JK8kIFJWbT1eEavb/zgBL+k8YbNqVtlgJv/GJ/7JE2ltYsttj5 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578967" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578967" 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 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768467098631448017?= X-GMAIL-MSGID: =?utf-8?q?1768467098631448017?= 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);