[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230612110958.592674-6-brent.lu@intel.com>
Date: Mon, 12 Jun 2023 19:09:51 +0800
From: Brent Lu <brent.lu@...el.com>
To: alsa-devel@...a-project.org
Cc: Cezary Rojewski <cezary.rojewski@...el.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Liam Girdwood <liam.r.girdwood@...ux.intel.com>,
Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com>,
Brent Lu <brent.lu@...el.com>, linux-kernel@...r.kernel.org,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Subject: [PATCH 05/12] ASoC: Intel: avs-max98373: remove redundant dapm routes
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 <brent.lu@...el.com>
---
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);
--
2.34.1
Powered by blists - more mailing lists