From patchwork Mon Jun 12 11:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 106206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2338949vqr; Sun, 11 Jun 2023 20:47:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+Lbh4S8Cb/CbrA/m6sIPUAkSLap2JFPnfUd5J6AZBKJxm/9wEwasb2ce/UlhjxcjmA2N6 X-Received: by 2002:aa7:d6cf:0:b0:510:d0bc:e130 with SMTP id x15-20020aa7d6cf000000b00510d0bce130mr4210423edr.33.1686541664024; Sun, 11 Jun 2023 20:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686541664; cv=none; d=google.com; s=arc-20160816; b=Oh04BTF5bGvuC1HPfHIK9sjmHn67a0YupJeKtU2Kvo5YedgeaSiUG/TLAXQRBNqCl1 a37i68iwEKoFwEvi457D8g2KTTIw4SbprW3UPWPXTKzHtJX2w7lSUWitmfYk5Hf7kDbQ wQRoecclh6u1WdJaKsH2mDgK+1hnLndr2gIYNg0bRgN1QVf1m8YPa8uw4zGgF3KQK9Kt wg5xQU038N7+BVrtQuDkLO3R5r0FNurWy8uvnSmO6ktnOwrnluU/nKAVGetrDHqarFXr geVqGJYj0Ah5/zAugihYAarJ7d5LH9gOyS3bBcXbBpuHnYZq1zx5V1ku4Nv0oIrhLyKq 9GYw== 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=bjPSU40yrlOkriqnc9uvw2sREaUVprGMV05YpFHjiBo=; b=t8fvEtFSiHze98JAI0t81VRdah7IRItymmsNJ193bqPaLusfBoCd00BPYFR/nGB15Y G4mGGapFlWjyPZx6YL0/FYpHbqGvo5qJ5075gZReC/rG1ETQCKr1UD3wjSR3WCPpfCGh HmvI5iWicrqIgeCKKS3nSntuf3XTXLu4ZXgdgbCYDW9zTWKxL2e/7ESm7LF/oppfGN9N t24KpicgLSl3x4zFGFngqtpiIH3d2dRa9PFr47bRbL8fJJGaZYCFTq8TxMak12vNFU+j jQ6RCI65+1unWy9LYma94hPJPh0trR6xVMmJWY3lNfucnm9SjQL4rX/bJXpUGFad87vK lLnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WMcdjf3z; 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 s25-20020aa7d799000000b00516ad703895si5343064edq.186.2023.06.11.20.47.20; Sun, 11 Jun 2023 20:47:44 -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=WMcdjf3z; 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 S234564AbjFLDQY (ORCPT + 99 others); Sun, 11 Jun 2023 23:16:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232657AbjFLDP0 (ORCPT ); Sun, 11 Jun 2023 23:15:26 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3CF7C4 for ; Sun, 11 Jun 2023 20:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539725; x=1718075725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RCNPw6SM+wE+oSvjCiunxs3XvlCVgcnR3aZfWQpux90=; b=WMcdjf3z5z4IOVmuvreMMohWWNnpyRBoRZDfw9I5/69A4AQw+PNWpmeb WlBEYOs+oXP9KxH8WdVY1pmwWyLHCUJaguczdxhKVHpWVek6wK/0Anezm PUeDsQIRe/CoOXp/MAtpCJ+TftnsfeqskrbyM13LfzzTY/CIvuAHvWnQZ Ikf86Kdw11Z3N00zqAtORzU32HP6jkY84ovX8zE0ZCSpTJX4XNq5XJwkf n/RmR5tUyoWZhbyXgHjxM8D9xSbmFowLUmMN49LMD3XMcmbOX74ly+dPF 1RF4vIm+KLFkmb6ULka9S6xmVwYjKjOXRFTEie4+rhmZAdwoj78gp0/VP A==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347579012" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347579012" 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:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191975" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191975" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:15:05 -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 09/12] ASoC: Intel: avs-rt286: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:55 +0800 Message-Id: <20230612110958.592674-10-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?1768467112133515215?= X-GMAIL-MSGID: =?utf-8?q?1768467112133515215?= 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/rt286.c | 45 ++---------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/rt286.c b/sound/soc/intel/avs/boards/rt286.c index 3551a05bd599..84cf9a0c8dfe 100644 --- a/sound/soc/intel/avs/boards/rt286.c +++ b/sound/soc/intel/avs/boards/rt286.c @@ -158,38 +158,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, RT286_CODEC_DAI); @@ -207,14 +175,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_rt286_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; @@ -226,12 +193,6 @@ static int avs_rt286_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) @@ -248,8 +209,8 @@ static int avs_rt286_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);