All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [alsa-devel] [PATCH v2 02/13] ASoC: Intel - use control components to describe card config
Date: Wed,  4 Dec 2019 15:15:45 -0600	[thread overview]
Message-ID: <20191204211556.12671-3-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20191204211556.12671-1-pierre-louis.bossart@linux.intel.com>

From: Jaroslav Kysela <perex@perex.cz>

Use the control interface (field 'components' in the info structure)
to pass the I/O configuration details. The goal is to replace
the card long name with this.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcht_es8316.c |  9 ++++++++-
 sound/soc/intel/boards/bytcr_rt5640.c  |  6 ++++++
 sound/soc/intel/boards/bytcr_rt5651.c  | 18 +++++++++++-------
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 46612331f5ea..efa33f30dcac 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -361,6 +361,7 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = {
 /* SoC card */
 static char codec_name[SND_ACPI_I2C_ID_LEN];
 static char long_name[50]; /* = "bytcht-es8316-*-spk-*-mic" */
+static char components_string[32]; /* = "cfg-spk:* cfg-mic:* */
 
 static int byt_cht_es8316_suspend(struct snd_soc_card *card)
 {
@@ -572,11 +573,17 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 		}
 	}
 
-	/* register the soc card */
+	snprintf(components_string, sizeof(components_string),
+		 "cfg-spk:%s cfg-mic:%s",
+		 (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "1" : "2",
+		 mic_name[BYT_CHT_ES8316_MAP(quirk)]);
+	byt_cht_es8316_card.components = components_string;
 	snprintf(long_name, sizeof(long_name), "bytcht-es8316-%s-spk-%s-mic",
 		 (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo",
 		 mic_name[BYT_CHT_ES8316_MAP(quirk)]);
 	byt_cht_es8316_card.long_name = long_name;
+
+	/* register the soc card */
 	snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
 
 	ret = devm_snd_soc_register_card(dev, &byt_cht_es8316_card);
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index dd2b5ad08659..7bc6d3cec94c 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -1083,6 +1083,7 @@ static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN];
 static char byt_rt5640_codec_aif_name[12]; /*  = "rt5640-aif[1|2]" */
 static char byt_rt5640_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
 static char byt_rt5640_long_name[40]; /* = "bytcr-rt5640-*-spk-*-mic" */
+static char byt_rt5640_components[32]; /* = "cfg-spk:* cfg-mic:*" */
 
 static int byt_rt5640_suspend(struct snd_soc_card *card)
 {
@@ -1305,6 +1306,11 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 		}
 	}
 
+	snprintf(byt_rt5640_components, sizeof(byt_rt5640_components),
+		 "cfg-spk:%s cfg-mic:%s",
+		 (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? "1" : "2",
+		 map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]);
+	byt_rt5640_card.components = byt_rt5640_components;
 	snprintf(byt_rt5640_long_name, sizeof(byt_rt5640_long_name),
 		 "bytcr-rt5640-%s-spk-%s-mic",
 		 (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ?
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 4606f6f582d6..80a5674ddb1b 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -798,6 +798,7 @@ static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
 static char byt_rt5651_codec_aif_name[12]; /*  = "rt5651-aif[1|2]" */
 static char byt_rt5651_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
 static char byt_rt5651_long_name[50]; /* = "bytcr-rt5651-*-spk-*-mic[-swapped-hp]" */
+static char byt_rt5651_components[50]; /* = "cfg-spk:* cfg-mic:*" */
 
 static int byt_rt5651_suspend(struct snd_soc_card *card)
 {
@@ -876,7 +877,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	const char *platform_name;
 	struct acpi_device *adev;
 	struct device *codec_dev;
-	const char *hp_swapped;
 	bool is_bytcr = false;
 	int ret_val = 0;
 	int dai_index = 0;
@@ -1080,16 +1080,20 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		}
 	}
 
-	if (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED)
-		hp_swapped = "-hp-swapped";
-	else
-		hp_swapped = "";
-
+	snprintf(byt_rt5651_components, sizeof(byt_rt5651_components),
+		 "cfg-spk:%s cfg-mic:%s%s",
+		 (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ? "1" : "2",
+		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)],
+		 (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ?
+			" cfg-hp:lrswap" : "");
+	byt_rt5651_card.components = byt_rt5651_components;
 	snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name),
 		 "bytcr-rt5651-%s-spk-%s-mic%s",
 		 (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ?
 			"mono" : "stereo",
-		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], hp_swapped);
+		 mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)],
+		 (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ?
+			"-hp-swapped" : "");
 	byt_rt5651_card.long_name = byt_rt5651_long_name;
 
 	/* override plaform name, if required */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-12-04 21:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 21:15 [alsa-devel] [PATCH v2 00/13] ASoC: SOF: initial cleanup for DT and multi-client support Pierre-Louis Bossart
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 01/13] ASoC: intel/skl/hda - export number of digital microphones via control components Pierre-Louis Bossart
2019-12-09 18:59   ` [alsa-devel] Applied "ASoC: intel/skl/hda - export number of digital microphones via control components" to the asoc tree Mark Brown
2019-12-04 21:15 ` Pierre-Louis Bossart [this message]
2019-12-09 18:59   ` [alsa-devel] Applied "ASoC: Intel - use control components to describe card config" " Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 03/13] ASoC: Intel - do not describe I/O configuration in the long card name Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: Intel - do not describe I/O configuration in the long card name" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 04/13] ASoC: SOF: topology: remove snd_sof_init_topology() Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: topology: remove snd_sof_init_topology()" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 05/13] ASoC: SOF: core: modify the signature for snd_sof_create_page_table Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: core: modify the signature for snd_sof_create_page_table" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 06/13] ASoC: SOF: core: move check for runtime callbacks to core Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: core: move check for runtime callbacks to core" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 07/13] ASoC: SOF: Introduce default_fw_filename member in sof_dev_desc Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: Introduce default_fw_filename member in sof_dev_desc" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 08/13] ASoC: SOF: partition audio-related parts from SOF core Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: partition audio-related parts from SOF core" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 09/13] ASoC: SOF: intel: hda: Modify signature for hda_codec_probe_bus() Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: intel: hda: Modify signature for hda_codec_probe_bus()" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 10/13] ASoC: SOF: Make creation of machine device from SOF core optional Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: Make creation of machine device from SOF core optional" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 11/13] ASoC: SOF: remove nocodec_fw_filename Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: remove nocodec_fw_filename" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 12/13] ASoC: SOF: Remove unused drv_name in sof_pdata Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: Remove unused drv_name in sof_pdata" to the asoc tree Mark Brown
2019-12-04 21:15 ` [alsa-devel] [PATCH v2 13/13] ASoC: SOF: nocodec: Amend arguments for sof_nocodec_setup() Pierre-Louis Bossart
2019-12-09 18:58   ` [alsa-devel] Applied "ASoC: SOF: nocodec: Amend arguments for sof_nocodec_setup()" to the asoc tree 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=20191204211556.12671-3-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.