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: 106210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2340991vqr; Sun, 11 Jun 2023 20:55:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6arqy4JAdmNGLG5G6XMnySH++Yl1X7Xa072m+/dyvaztOkZo1nmjAscIgXkE2FFRK0ateg X-Received: by 2002:a17:902:d504:b0:1a9:6a10:70e9 with SMTP id b4-20020a170902d50400b001a96a1070e9mr5728168plg.33.1686542155380; Sun, 11 Jun 2023 20:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686542155; cv=none; d=google.com; s=arc-20160816; b=fzOiioHBb8uxOHqv21qKfxeQ2DoAJINxpgXxBJtHW8A3yXT5MPttJHAVEppzSd2Els P82RY9Kp8sae8RPK4ucVyGAKSdfiCNkvLRbFjjVg7aE+wORtNCmQ+AuTC5bg1mznbhDI RApx4WCELVOnOdjjlE1N5724k4pMNEyRlD5nsG9qz26/QO0Vw4dOUUSaKuLbkReUr2K7 IbYytbJe3SBjTp/UBreKWiC2oenkIcADO26uXOJEf1pOXq2KRAvuxwtmC4pA0GTSpx3V 8+hDKXzm4b3r8AWUX63Pme+Lvy4zI9+UaYz75TlyqTKUOkAZObZ6w2sFzFrytVTWnXrW 7wEg== 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=ouGVgoAd8Uk0dkjLhlZSb2vs+gUcA1HH85UYEH6LAwM=; b=rflesK31g7mqkmQ7VZC/1aejAvMWbS9s9vH40guWndCFRYFqI+zMJbFg4esVy2EXxg RwodAOpHmgX7kYifwIxRHvTR8QeakwCtRlNoyxDCIPWbmL5T6xecWt8DVRCBWypzpd1+ O5XY7mQQDLUCvdVyum6AN/MvHe/IjKqDRm/tlDbsiV2zM5zYfGvIgjTQ13+mUxOhrkgg gSBbN9tGV3nflO3EzWQrspwrUm9YhKFEKxdMKIIfx80r9HLMfyXhYWJelBcsRxXoSms4 QbH+FGLaEaRcce/s9e9XR1WynpuwbUN6Ag6JYXsUT30IcQaV30+/K5vUJ92lCsR6va3W HdJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="VA/uj4AM"; 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 jh19-20020a170903329300b001ae52127485si6374302plb.433.2023.06.11.20.55.43; Sun, 11 Jun 2023 20:55:55 -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="VA/uj4AM"; 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 S233964AbjFLDQj (ORCPT + 99 others); Sun, 11 Jun 2023 23:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234374AbjFLDP3 (ORCPT ); Sun, 11 Jun 2023 23:15:29 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1939DC4 for ; Sun, 11 Jun 2023 20:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539728; x=1718075728; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yEL4WgOYASzXlYpxiAO18qiaEOcuWhFhWKeJfuvKTD4=; b=VA/uj4AM+QjJ7GlMsQlvivxsNt39804LM2vCFZ+7THpSpV+KyplpVcPW ZPIDbCRYoD2TBtAG6odKFPIbp0ACIPQh7Mi75bD/5ITC/XdIzDpbeSKg+ J73y6MiqYgbOzt2brKctKDEPOrplPr6lKZIkKFO1GHwjQLiUyqV384C6d ogcFKk5MPGPzZp07dcgjEU5aen3Iq7lSkYfqhogPc7M6l5jffEdeXqmHo +x4ODboUk0bEgBB5U15ZgGlPcYKJWoLrh9ojMql3UMnO5U7EJAVbdxnLp eD7ugnyOzSm07f5meyargQslG19jiOZpW6Be7Y5IqSZzXjmDOdCDNPoWK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347579056" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347579056" 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 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?1768467627031125229?= X-GMAIL-MSGID: =?utf-8?q?1768467627031125229?= 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;