From patchwork Mon Jun 12 11:09:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 106195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2333424vqr; Sun, 11 Jun 2023 20:27:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ41SayBMBuLlU7b52778mUiZQxZIpl30mXsuiMDnzFOdPamhRVwiI9PjlZqgW6r3PdVKEzd X-Received: by 2002:a17:907:6297:b0:978:8790:9100 with SMTP id nd23-20020a170907629700b0097887909100mr8536029ejc.3.1686540449364; Sun, 11 Jun 2023 20:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686540449; cv=none; d=google.com; s=arc-20160816; b=UzuYT4nXY7SryWpv+5DSotZWlFMnTFDLXtLdEhqM/5QHYaTxgDzBPdZAGwnBZEhbrE Ry1zRLPVX6lckE4gNGHFNV4eVCIF/EaemhY6Do83Ey/FcKYp+8A9NM47vyMMnSwPUkvu E76KXygl3EOVAbqoheC5F11NiIz8ve2f6zUoXA2eTYO3H3vuC2087S1qyNw/Em95BoGM QgriitRfskCm38aYdVixP8f98GZZRTR4L+Pcn45cdefIXgffOKz88M1POgeyqxElHWaA Uztd2E4Vo2TWqgTCjrBVnRHW158IxciaOV/3uk2G5P7nlWearatJNH3TeItWUK1ZTOvo +h6A== 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=m7SgrtltKBZOCJKqea54/RTsVtAj8zp9RAYAi6lJJ6A=; b=b3TqJ3HPEMUP+4cycnFip7ZMTsyBIZvR79AF9J4c98sEfp693rSl3VVpeLGF2m4gqg +tqGCbn2/wrehftNwdXC6GKN4YegM7rhsUDJIPJanry+J45q2d8/PW0jWutCkb9Fo7z0 fr1eDrW5Y86t1wG5UxpLVslgj19M/UxWExgRwzt80oI5/9o8EPnrq4Ia1TVOJqPJgBbR mmE429+cHyiWGmpuiXegCLlj5Ba6GMvSSBs4oh+LUVs+7yhJyPNlZceSkctrufr2H8UN eptYkP4EcJMxjIuUzbvxcBOF+O9fqYNfa9kVPk/rmp+9SZi/b70gRw/XZahQh9FbGqqk cNtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KkoQWcrh; 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 f18-20020a1709062c5200b00977ab47b334si5004294ejh.435.2023.06.11.20.27.03; Sun, 11 Jun 2023 20:27:29 -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=KkoQWcrh; 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 S234150AbjFLDP1 (ORCPT + 99 others); Sun, 11 Jun 2023 23:15:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234573AbjFLDPA (ORCPT ); Sun, 11 Jun 2023 23:15:00 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8587210D1 for ; Sun, 11 Jun 2023 20:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539687; x=1718075687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RcAGWFoO9nSBfI/X1vef7WgnMxUZjubEZI94Z23Z+44=; b=KkoQWcrhpPgTpKiDPjjlnWbf955XRkK9m+dkn3yyAYlNBQ1TVKEc3IJy 7eGUdj7r1a/tgzNVwRw3zgTurqHO7vVRrTz5uL56TQzv3MuX+z7qEHFyS dT/lMoh8ZmoC1OPt4P6CVdRcV7jnchhh3ME8MIN1IPMrg3znnmBEZbIcm iNk8zp704zPsHk7vgVrC0ZckPhXA8gWZ5Qflw7kPOoSgKiTtrrpYW+67a /BwCEhTzHAmOVJsmLisNCqxHkF57YKR6UJ3nPWp1CbpRPju92dPkgI+2i fSFGswoolV5xwzzm+syumUhgPOr+PwaGzCpRqAc0AhszZR8Qwnh+NiJZk g==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578886" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578886" 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:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191875" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191875" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:44 -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 01/12] ASoC: Intel: avs-da7219: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:47 +0800 Message-Id: <20230612110958.592674-2-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?1768465838304139320?= X-GMAIL-MSGID: =?utf-8?q?1768465838304139320?= Two routes "Playback<-sspX Tx" and "sspX Rx<-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/da7219.c | 45 ++--------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c index 1a1d572cc1d0..964a763732ab 100644 --- a/sound/soc/intel/avs/boards/da7219.c +++ b/sound/soc/intel/avs/boards/da7219.c @@ -181,38 +181,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, "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, "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, DA7219_DAI_NAME); @@ -230,14 +198,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_da7219_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; @@ -249,12 +216,6 @@ static int avs_da7219_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) @@ -271,8 +232,8 @@ static int avs_da7219_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);