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: 106203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2336988vqr; Sun, 11 Jun 2023 20:40:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Halz4wljZ6bJm3QAezUfTd6oO4w4SpYYXYziPAk7Ay/q9KbXqFb6aQJMu6ugwxUJNMfmI X-Received: by 2002:a17:906:da8a:b0:973:d076:67ab with SMTP id xh10-20020a170906da8a00b00973d07667abmr7540391ejb.42.1686541211512; Sun, 11 Jun 2023 20:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686541211; cv=none; d=google.com; s=arc-20160816; b=GqXs8NJ/CManXrQw3q7eB96AQmF2g/MPIEvweeFGXQZ0saSL7fxBOYmslv2q5TTjW7 RGxehACfT8EASZzj6HtIaY2QgDxKOFpSXXeJhw9qb7N9tgqJVxME84LVRsmt2VB5fjib R1Z68bgMR61KmUsiEkaVheVe4vYPndbBiuSj1lYm2O2nmD4KTL/1fyPcEEOHRJEHvczj QmV0KUxQrvp8E3yeXPp865sWhcAQpS0UpWgEMLj5uMyqx8xEBmnJEoyVW6hg6BBZAB0w CDVRzZMR/q8ecpLRoBalE/jIz0Oux2aJ7oOo+2ZWmeqRAUQK4Bmpc+fm24yVhQeomF9j 6N0A== 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=/Kw7xKp7vku0btQh9zOG0e7jN/Mp1VbJ82lrCJuj310=; b=ViNbUCA8kLdvWmx7zqq5Uc3T4OhVIZbvXFRfxorkZO8aAMTURMf9i57RXzdSGwzN9i 9O6Oj5VvJnaEa7AkpjlECWSIJ7A3NEs1R2eFDFUzqZDGo5SVCTFF8Oag/HxHv/uGxuk3 QodZCTOPEHd5UrQDRsuOjzhvOL5zD+LqCQqNOC3yvHfeRtjoVYKIDXPA4zwTe9BroVpu GckdtcgtxZiZo1IvqBMlu2ei0a4d1PqmmulEZ2xEFY7xbZ/3G0EcQr+beNU0Y7yqlpbq 0e/Jfasp6Mzb5fVw6+z2q4oAxROukvOo7FvROVlEUsxNcas/CGLjwjxaMsn1EdSVlQGq tmTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OrPsiMua; 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 y25-20020a17090629d900b0094f335b0660si4386750eje.185.2023.06.11.20.39.47; Sun, 11 Jun 2023 20:40:11 -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=OrPsiMua; 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 S234494AbjFLDPr (ORCPT + 99 others); Sun, 11 Jun 2023 23:15:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234651AbjFLDPB (ORCPT ); Sun, 11 Jun 2023 23:15:01 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C50B10E0 for ; Sun, 11 Jun 2023 20:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539697; x=1718075697; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oLPs9XeZPB29Gk2q8nALmTV059usJ3RGv1ZaTgGsjRQ=; b=OrPsiMuaCf5CZRG7pzWF0axa+9lMJEa/9SY28FwMiwQ5sgD92NlorY1g TKv5NvjZqA56j8X6UYn4SeNVctpTn5Q3NNY+hZuJi07GOWcpjEiSHt3mv SfEYmPcG3OW1kpw2tbw7FAlBz6xfg4isSsTztC+uSRRO2appcI/OcFRlx s53yND/VFtXfN3kJiw+iev9XBxRfGRmZDLh/cmHHjlXT/G2P4Yy8jacTL Brt6EwDp1D4L5PY0RAzZn30o2Q31RqVRwlDZfBrJs2IYV32Jx/z5iuyA6 hG+ZJoAoG1eIuBE+83o5dFb+AIiVlTm79Cl2gH4jPHChwMeSk5R4Zr+Fj w==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578950" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578950" 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 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?1768466637473543231?= X-GMAIL-MSGID: =?utf-8?q?1768466637473543231?= 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);