Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: linux-sound@vger.kernel.org
Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org,
	Brent Lu <brent.lu@intel.com>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [PATCH 04/18] ASoC: Intel: realtek-common: remove 2-spk rt1015p config
Date: Thu,  9 May 2024 11:34:04 -0500	[thread overview]
Message-ID: <20240509163418.67746-5-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20240509163418.67746-1-pierre-louis.bossart@linux.intel.com>

From: Brent Lu <brent.lu@intel.com>

The original code for rt1015p could support 1 or 2 rt1015p device
instances in ACPI. However, all designs implement only 1 instance in
ACPI table so we remove the code segment which is for 2 instances.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_realtek_common.c | 57 ++-------------------
 sound/soc/intel/boards/sof_realtek_common.h |  1 -
 2 files changed, 5 insertions(+), 53 deletions(-)

diff --git a/sound/soc/intel/boards/sof_realtek_common.c b/sound/soc/intel/boards/sof_realtek_common.c
index 6915ff8b8716..dda346e0f737 100644
--- a/sound/soc/intel/boards/sof_realtek_common.c
+++ b/sound/soc/intel/boards/sof_realtek_common.c
@@ -314,59 +314,21 @@ EXPORT_SYMBOL_NS(sof_rt1011_codec_conf, SND_SOC_INTEL_SOF_REALTEK_COMMON);
  *
  * For stereo output, there are always two amplifiers on the board.
  * However, the ACPI implements only one device instance (UID=0) if they
- * are sharing the same enable pin. The code will detect the number of
- * device instance and use corresponding DAPM structures for
- * initialization.
+ * are sharing the same enable pin. This is the case of rt1015p.
  */
-static const struct snd_soc_dapm_route rt1015p_1dev_dapm_routes[] = {
+static const struct snd_soc_dapm_route rt1015p_dapm_routes[] = {
 	/* speaker */
 	{ "Left Spk", NULL, "Speaker" },
 	{ "Right Spk", NULL, "Speaker" },
 };
 
-static const struct snd_soc_dapm_route rt1015p_2dev_dapm_routes[] = {
-	/* speaker */
-	{ "Left Spk", NULL, "Left Speaker" },
-	{ "Right Spk", NULL, "Right Speaker" },
-};
-
-static struct snd_soc_codec_conf rt1015p_codec_confs[] = {
-	{
-		.dlc = COMP_CODEC_CONF(RT1015P_DEV0_NAME),
-		.name_prefix = "Left",
-	},
-	{
-		.dlc = COMP_CODEC_CONF(RT1015P_DEV1_NAME),
-		.name_prefix = "Right",
-	},
-};
-
 static struct snd_soc_dai_link_component rt1015p_dai_link_components[] = {
 	{
 		.name = RT1015P_DEV0_NAME,
 		.dai_name = RT1015P_CODEC_DAI,
 	},
-	{
-		.name = RT1015P_DEV1_NAME,
-		.dai_name = RT1015P_CODEC_DAI,
-	},
 };
 
-static int rt1015p_get_num_codecs(void)
-{
-	static int dev_num;
-
-	if (dev_num)
-		return dev_num;
-
-	if (!acpi_dev_present("RTL1015", "1", -1))
-		dev_num = 1;
-	else
-		dev_num = 2;
-
-	return dev_num;
-}
-
 static int rt1015p_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_pcm_hw_params *params)
 {
@@ -398,12 +360,8 @@ static int rt1015p_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
-	if (rt1015p_get_num_codecs() == 1)
-		ret = snd_soc_dapm_add_routes(&card->dapm, rt1015p_1dev_dapm_routes,
-					      ARRAY_SIZE(rt1015p_1dev_dapm_routes));
-	else
-		ret = snd_soc_dapm_add_routes(&card->dapm, rt1015p_2dev_dapm_routes,
-					      ARRAY_SIZE(rt1015p_2dev_dapm_routes));
+	ret = snd_soc_dapm_add_routes(&card->dapm, rt1015p_dapm_routes,
+				      ARRAY_SIZE(rt1015p_dapm_routes));
 	if (ret)
 		dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
 	return ret;
@@ -412,7 +370,7 @@ static int rt1015p_init(struct snd_soc_pcm_runtime *rtd)
 void sof_rt1015p_dai_link(struct snd_soc_dai_link *link)
 {
 	link->codecs = rt1015p_dai_link_components;
-	link->num_codecs = rt1015p_get_num_codecs();
+	link->num_codecs = ARRAY_SIZE(rt1015p_dai_link_components);
 	link->init = rt1015p_init;
 	link->ops = &rt1015p_ops;
 }
@@ -420,11 +378,6 @@ EXPORT_SYMBOL_NS(sof_rt1015p_dai_link, SND_SOC_INTEL_SOF_REALTEK_COMMON);
 
 void sof_rt1015p_codec_conf(struct snd_soc_card *card)
 {
-	if (rt1015p_get_num_codecs() == 1)
-		return;
-
-	card->codec_conf = rt1015p_codec_confs;
-	card->num_configs = ARRAY_SIZE(rt1015p_codec_confs);
 }
 EXPORT_SYMBOL_NS(sof_rt1015p_codec_conf, SND_SOC_INTEL_SOF_REALTEK_COMMON);
 
diff --git a/sound/soc/intel/boards/sof_realtek_common.h b/sound/soc/intel/boards/sof_realtek_common.h
index d0e331530b39..876290555c22 100644
--- a/sound/soc/intel/boards/sof_realtek_common.h
+++ b/sound/soc/intel/boards/sof_realtek_common.h
@@ -31,7 +31,6 @@ void sof_rt1011_codec_conf(struct device *dev, struct snd_soc_card *card);
  */
 #define RT1015P_CODEC_DAI	"HiFi"
 #define RT1015P_DEV0_NAME	RT1015P_ACPI_HID ":00"
-#define RT1015P_DEV1_NAME	RT1015P_ACPI_HID ":01"
 
 void sof_rt1015p_dai_link(struct snd_soc_dai_link *link);
 void sof_rt1015p_codec_conf(struct snd_soc_card *card);
-- 
2.40.1


  parent reply	other threads:[~2024-05-09 16:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 16:34 [PATCH 00/18] ASoC: Intel: updates for 6.10 - part7 Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 01/18] ASoC: Intel: sof_sdw_rt_sdca_jack_common: remove -sdca for new codecs Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 02/18] ASoC: Intel: sof-rt5682: remove DMI quirk for hatch Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 03/18] ASoC: Intel: sof_rt5682: board id cleanup for mtl boards Pierre-Louis Bossart
2024-05-09 16:34 ` Pierre-Louis Bossart [this message]
2024-05-09 16:34 ` [PATCH 05/18] ASoC: Intel: soc-acpi-intel-mtl-match: add cs42l43 only support Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 06/18] ASoC: Intel: soc-acpi-intel-lnl-match: " Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 07/18] ASoC: Intel: maxim-common: add max_98373_dai_link function Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 08/18] ASoC: Intel: sof_da7219: use " Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 09/18] ASoC: Intel: sof_nau8825: " Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 10/18] ASoC: Intel: sof_rt5682: " Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 11/18] ASoC: Intel: sof_sdw: add max98373 dapm routes Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 12/18] ASoC: Intel: maxim-common: change max98373 data to static Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 13/18] ASoC: Intel: sof_sdw_cs_amp: rename Speakers to Speaker Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 14/18] ASoC: Intel: sof_sdw: use generic name for controls/widgets Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 15/18] ASoC: Intel: sof_sdw: add controls and dapm widgets in codec_info Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 16/18] ASoC: Intel: sof_sdw: use .controls/.widgets to add controls/widgets Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 17/18] ASoC: Intel: sof_sdw: add dai parameter to rtd_init callback Pierre-Louis Bossart
2024-05-09 16:34 ` [PATCH 18/18] ASoC: Intel: sof_sdw_rt_amp: use dai parameter Pierre-Louis Bossart
2024-05-10 13:18 ` [PATCH 00/18] ASoC: Intel: updates for 6.10 - part7 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=20240509163418.67746-5-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brent.lu@intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=tiwai@suse.de \
    --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