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: 106198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2334768vqr; Sun, 11 Jun 2023 20:32:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ566e07dguZY6XHRwVgoqaa3UQNLrVYLacimnQQ61JP50GSXFf4eUbcFEBF4l3CFkIp8ibo X-Received: by 2002:a05:6830:1e29:b0:6ad:de28:f3f1 with SMTP id t9-20020a0568301e2900b006adde28f3f1mr5967590otr.13.1686540748449; Sun, 11 Jun 2023 20:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686540748; cv=none; d=google.com; s=arc-20160816; b=VNLFIdP5jMabjCmHkI+39J4pkLDsv3HW789IsYFKel/fhSJ1NA3m6iwV0R3gH0q2oq IHAfqm7nuHAXsdqQztlaULy1D3ijg1Z3k/vj7xIOPNZ3r92NOyeSdHv9sBe2v2Wjxbcb MMWURWv53ObPNvb9I1wtOkPFPFM5RYBm6DgJZM6RBNerVX53mbdx0OAYH0qqEwGEP4hC YGX0ppBBClaxdPgj1+ekY70AAEQvNC3HCUmKJ5E2UmE6nySdkpnIYNHHhwDNTMHb4Gd3 sutsOzv9jiflmLs4CdFeoWxrm/gBfMR4cgOksnOoSIw/QbUVO2kJ5WVZjIh9eTsRz5V3 rgWQ== 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=2WYD9Gx3LPhIIr9a/v544YeW1ROBjfNQQfoObgVZobI=; b=ojVUGBJnad1Gg4w+FdR4uqxTbVOE+fF2NKhD3hipDgFW/YAomsVlTENuS7b3KrzWPn K6qENpVjzrtnRwYzrUEKt5PY4n+umPWUU7IYi2Z+LY83iEOTCTvWaAXqPsJ1rVLZ015L Pe9tRklfwAiCVmzEfW9n8gL1iby2pS3i3ecvQLCegTXA3+NiM1PEQm9oS07Y6a7NlXIb 5FKZiJFw/fQpipTlA+ZWUEdHR9SO20CkM9X/VfztY0q/OfJgOjQWmoMGRxysrZi/MDxl 14BJC0FOQTAChTCHmG629e8/qqa8eJ24Yv0mTspwEaXQfUU2zze8RqOB+PJjUBe9Gn1w B9cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=X7QiO7K9; 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 f26-20020aa7969a000000b0065b2d32afbdsi6165184pfk.288.2023.06.11.20.32.15; Sun, 11 Jun 2023 20:32:28 -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=X7QiO7K9; 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 S234737AbjFLDQ2 (ORCPT + 99 others); Sun, 11 Jun 2023 23:16:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234212AbjFLDP2 (ORCPT ); Sun, 11 Jun 2023 23:15:28 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 179A510D for ; Sun, 11 Jun 2023 20:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539727; x=1718075727; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6YiX0yvmiKQf+uAku9yo5ddxL+NRFfsXBZ33VFKIHJM=; b=X7QiO7K9BnxW8kGi+GHAL53LJ2cDbPhxDaCMPIjuRxVtFFUMIHobAaER lqID59dWFTUHn7ttHUAW8ykqXYx1NHb7avtvSyPiumoPQImiuZjP++s// fJE1fKlHOXhpYGens8m6XLmQCju/EBYeV3AKnFKEcD5EqhtG+J5pw/QiI OB/ZI0ETkimj7iJJ6liWo/0eaTNYZIbYOzmsairKAqBiHG5vkI8xpXCYB P+GhQSCzAGRX257Rq9QGBpktZOz/+Kp4CeP3FdaQAGjdvKqFwvQqnWEr6 H4+CXL8FBK1EjV07Qik4LOkqxVbC+zNNqs4hTYI1oEiCHzlLTN67SBRgU A==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347579024" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347579024" 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 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?1768466152165239978?= X-GMAIL-MSGID: =?utf-8?q?1768466152165239978?= 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);