From patchwork Mon Jun 12 11:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 106201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2335590vqr; Sun, 11 Jun 2023 20:35:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mlufdcQjT4KFeY6smfSi9Gjv+LqOv8B78pqsrMN+0SpkNsEgwdMRP0AN5gYHeqw6OdsJs X-Received: by 2002:a05:6a20:7f99:b0:119:87b7:9b51 with SMTP id d25-20020a056a207f9900b0011987b79b51mr8739541pzj.50.1686540923595; Sun, 11 Jun 2023 20:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686540923; cv=none; d=google.com; s=arc-20160816; b=hNTLpu2vAxzJqEJiCYcJdtTqYDoA4rJ0tyBOX6Ga3g5rP7ortUnV6ME7OLY7MBkPmV 2yItKL+BpPU+2ug091JSOMerH54nuMlFfbHHwd0z5bhmyGMYFSRY2aGvz9wjYSy8QBPN p4i8HieiovlM3KtNfsOgZsYzWe6V9bA3thDDuwAYPgFpVTrKIkSSMvyO0ih2AbqNogM0 8Q7KV4yCzCqKMYOe1oBe7FJvRTlErOopHMRDO4nm4TlG2e5Kfkz4UUPR5T7vepcXWvNa pMQ7qIjvyhDWLG1/qK0FO1aAFHpKJBbOiQNP0N3Jq2RxgpjybG7qvYGDM/MdGcUFMM+P YSoQ== 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=VgFGhVmvQqHq0EzUflZnV3rj2InbxoNOTjO2Ghu1fKM=; b=DUdaSm9Js4Jjgte4q3Ih71OIPcNnq6DuTtBKvLABrnyPjmY21PsnShPl7FUr+YE6dC prsFxkVSDD5lLIM3waGdfKNDkfRccsGCkBUmlLVzJbsl58zRuPcgEx10Tzg/OijlCf37 FAHRHOH8E+DcbWkSdpA5AG58HyhLLcqVMZEUP25TKyOsOdF8snx1HwVJ3AppYSvCSggJ x6R0D4VI2zju8Fgnx6p3OlZx7t3PWHYjt+ZwdQySMKzwp1vFvfpUnlSJK/TgwZrQMUVO hyOmV/HN7u8fNG1Nh390HL6pF94dIP4kDZTORUWigTHHo8PbZuG2VC3hRanJhqo0Dt3A tMtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ntNbQk75; 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 b24-20020a637158000000b00534866eb2c2si6266008pgn.835.2023.06.11.20.35.10; Sun, 11 Jun 2023 20:35:23 -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=ntNbQk75; 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 S234526AbjFLDP5 (ORCPT + 99 others); Sun, 11 Jun 2023 23:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234707AbjFLDPD (ORCPT ); Sun, 11 Jun 2023 23:15:03 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE9A1BB for ; Sun, 11 Jun 2023 20:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686539702; x=1718075702; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J5+q5OqTn3NUhd2KAcv2OeDPqTsFvVodE6kntNgJTpc=; b=ntNbQk752H1oYZNn/KQPfpVzLHgLHBulSliFcWb5+R8n98th3qJyI8H3 0NTWWqeA6Q4rL45jwm/ouYKmO7BqtIGT+WOMVE0sdRMm4NxSUALAMRZLT IhdzKtzJGGeeembz+3Zqj1Jq3gLvnty53HjR/fCkkZRR5z8DUhCTZZJKg BmOi3QA5OcTYgLX6jhEhlPtIYuKW3zvniUH7BLHW8F/NBIwvN3iMWVHWh iBY5sa0v81d8VfXbkoGsVMS1TiABbO55A7epBLDtkRH5yHRFHdGEDTUUQ z5j1ZWWUTFwtabnjUji63bT/qf77ZmIEThMc16B4Wh7YqsH2t6Veky5qb A==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347578983" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="347578983" 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:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="776191950" X-IronPort-AV: E=Sophos;i="6.00,235,1681196400"; d="scan'208";a="776191950" Received: from brentlu-desktop.itwn.intel.com ([10.5.252.92]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2023 20:14:59 -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 07/12] ASoC: Intel: avs-nau8825: remove redundant dapm routes Date: Mon, 12 Jun 2023 19:09:53 +0800 Message-Id: <20230612110958.592674-8-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?1768466335447594444?= X-GMAIL-MSGID: =?utf-8?q?1768466335447594444?= 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/nau8825.c | 45 ++-------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c index b69fc5567135..38c5087d98e9 100644 --- a/sound/soc/intel/avs/boards/nau8825.c +++ b/sound/soc/intel/avs/boards/nau8825.c @@ -215,38 +215,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, SKL_NUVOTON_CODEC_DAI); @@ -274,14 +242,13 @@ static int avs_card_resume_post(struct snd_soc_card *card) static int avs_nau8825_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; @@ -293,12 +260,6 @@ static int avs_nau8825_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) @@ -315,8 +276,8 @@ static int avs_nau8825_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);