mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brent Lu <brent.lu@intel.com>
To: alsa-devel@alsa-project.org
Cc: "Cezary Rojewski" <cezary.rojewski@intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Liam Girdwood" <liam.r.girdwood@linux.intel.com>,
	"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Brent Lu" <brent.lu@intel.com>,
	linux-kernel@vger.kernel.org,
	"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>
Subject: [PATCH 03/12] ASoC: Intel: avs-hdaudio: remove redundant dapm routes
Date: Mon, 12 Jun 2023 19:09:49 +0800	[thread overview]
Message-ID: <20230612110958.592674-4-brent.lu@intel.com> (raw)
In-Reply-To: <20230612110958.592674-1-brent.lu@intel.com>

Three routes "HDMI 0 Playback<-hdaudioB0D2-cpu0 Tx",
"HDMI 1 Playback<-hdaudioB0D2-cpu1 Tx" and
"HDMI 2 Playback<-hdaudioB0D2-cpu2 Tx" are created by
snd_soc_dapm_connect_dai_link_widgets() automatically. Remove the
duplicate routes.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
 sound/soc/intel/avs/boards/hdaudio.c | 65 +---------------------------
 1 file changed, 1 insertion(+), 64 deletions(-)

diff --git a/sound/soc/intel/avs/boards/hdaudio.c b/sound/soc/intel/avs/boards/hdaudio.c
index a542a67e21d0..cb00bc86ac94 100644
--- a/sound/soc/intel/avs/boards/hdaudio.c
+++ b/sound/soc/intel/avs/boards/hdaudio.c
@@ -64,56 +64,6 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int
 	return 0;
 }
 
-static int avs_create_dapm_routes(struct device *dev, struct hda_codec *codec, int pcm_count,
-				  struct snd_soc_dapm_route **routes, int *num_routes)
-{
-	struct snd_soc_dapm_route *dr;
-	struct hda_pcm *pcm;
-	const char *cname = dev_name(&codec->core.dev);
-	int i, n = 0;
-
-	/* at max twice the number of pcms */
-	dr = devm_kcalloc(dev, pcm_count * 2, sizeof(*dr), GFP_KERNEL);
-	if (!dr)
-		return -ENOMEM;
-
-	pcm = list_first_entry(&codec->pcm_list_head, struct hda_pcm, list);
-
-	for (i = 0; i < pcm_count; i++, pcm = list_next_entry(pcm, list)) {
-		struct hda_pcm_stream *stream;
-		int dir;
-
-		dir = SNDRV_PCM_STREAM_PLAYBACK;
-		stream = &pcm->stream[dir];
-		if (!stream->substreams)
-			goto capture_routes;
-
-		dr[n].sink = devm_kasprintf(dev, GFP_KERNEL, "%s %s", pcm->name,
-					    snd_pcm_direction_name(dir));
-		dr[n].source = devm_kasprintf(dev, GFP_KERNEL, "%s-cpu%d Tx", cname, i);
-		if (!dr[n].sink || !dr[n].source)
-			return -ENOMEM;
-		n++;
-
-capture_routes:
-		dir = SNDRV_PCM_STREAM_CAPTURE;
-		stream = &pcm->stream[dir];
-		if (!stream->substreams)
-			continue;
-
-		dr[n].sink = devm_kasprintf(dev, GFP_KERNEL, "%s-cpu%d Rx", cname, i);
-		dr[n].source = devm_kasprintf(dev, GFP_KERNEL, "%s %s", pcm->name,
-					      snd_pcm_direction_name(dir));
-		if (!dr[n].sink || !dr[n].source)
-			return -ENOMEM;
-		n++;
-	}
-
-	*routes = dr;
-	*num_routes = n;
-	return 0;
-}
-
 /* Should be aligned with SectionPCM's name from topology */
 #define FEDAI_NAME_PREFIX "HDMI"
 
@@ -172,13 +122,12 @@ static int avs_card_late_probe(struct snd_soc_card *card)
 
 static int avs_probing_link_init(struct snd_soc_pcm_runtime *rtm)
 {
-	struct snd_soc_dapm_route *routes;
 	struct snd_soc_acpi_mach *mach;
 	struct snd_soc_dai_link *links = NULL;
 	struct snd_soc_card *card = rtm->card;
 	struct hda_codec *codec;
 	struct hda_pcm *pcm;
-	int ret, n, pcm_count = 0;
+	int ret, pcm_count = 0;
 
 	mach = dev_get_platdata(card->dev);
 	codec = mach->pdata;
@@ -200,18 +149,6 @@ static int avs_probing_link_init(struct snd_soc_pcm_runtime *rtm)
 		return ret;
 	}
 
-	ret = avs_create_dapm_routes(card->dev, codec, pcm_count, &routes, &n);
-	if (ret < 0) {
-		dev_err(card->dev, "create routes failed: %d\n", ret);
-		return ret;
-	}
-
-	ret = snd_soc_dapm_add_routes(&card->dapm, routes, n);
-	if (ret < 0) {
-		dev_err(card->dev, "add routes failed: %d\n", ret);
-		return ret;
-	}
-
 	return 0;
 }
 
-- 
2.34.1


  parent reply	other threads:[~2023-06-12  3:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 11:09 [PATCH 00/12] ASoC: Intel: avs: " Brent Lu
2023-06-12 11:09 ` [PATCH 01/12] ASoC: Intel: avs-da7219: " Brent Lu
2023-06-12 11:09 ` [PATCH 02/12] ASoC: Intel: avs-dmic: " Brent Lu
2023-06-12 11:09 ` Brent Lu [this message]
2023-06-12 11:09 ` [PATCH 04/12] ASoC: Intel: avs-max98357a: " Brent Lu
2023-06-12 11:09 ` [PATCH 05/12] ASoC: Intel: avs-max98373: " Brent Lu
2023-06-12 11:09 ` [PATCH 06/12] ASoC: Intel: avs-max98927: " Brent Lu
2023-06-12 11:09 ` [PATCH 07/12] ASoC: Intel: avs-nau8825: " Brent Lu
2023-06-12 11:09 ` [PATCH 08/12] ASoC: Intel: avs-rt274: " Brent Lu
2023-06-12 11:09 ` [PATCH 09/12] ASoC: Intel: avs-rt286: " Brent Lu
2023-06-12 11:09 ` [PATCH 10/12] ASoC: Intel: avs-rt298: " Brent Lu
2023-06-12 11:09 ` [PATCH 11/12] ASoC: Intel: avs-rt5682: " Brent Lu
2023-06-12 11:09 ` [PATCH 12/12] ASoC: Intel: avs-ssm4567: " Brent Lu
2023-06-12 17:35 ` [PATCH 00/12] ASoC: Intel: avs: " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230612110958.592674-4-brent.lu@intel.com \
    --to=brent.lu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®