Commit 0d5c8187 authored by Jaroslav Kysela's avatar Jaroslav Kysela Committed by Mark Brown

ASoC: Intel - use control components to describe card config

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: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20191204211556.12671-3-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8cd9956f
...@@ -361,6 +361,7 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = { ...@@ -361,6 +361,7 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = {
/* SoC card */ /* SoC card */
static char codec_name[SND_ACPI_I2C_ID_LEN]; static char codec_name[SND_ACPI_I2C_ID_LEN];
static char long_name[50]; /* = "bytcht-es8316-*-spk-*-mic" */ 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) 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) ...@@ -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", snprintf(long_name, sizeof(long_name), "bytcht-es8316-%s-spk-%s-mic",
(quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo", (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo",
mic_name[BYT_CHT_ES8316_MAP(quirk)]); mic_name[BYT_CHT_ES8316_MAP(quirk)]);
byt_cht_es8316_card.long_name = long_name; byt_cht_es8316_card.long_name = long_name;
/* register the soc card */
snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv); snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
ret = devm_snd_soc_register_card(dev, &byt_cht_es8316_card); ret = devm_snd_soc_register_card(dev, &byt_cht_es8316_card);
......
...@@ -1083,6 +1083,7 @@ static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN]; ...@@ -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_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */
static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ 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_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) 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) ...@@ -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), snprintf(byt_rt5640_long_name, sizeof(byt_rt5640_long_name),
"bytcr-rt5640-%s-spk-%s-mic", "bytcr-rt5640-%s-spk-%s-mic",
(byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ?
......
...@@ -798,6 +798,7 @@ static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN]; ...@@ -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_codec_aif_name[12]; /* = "rt5651-aif[1|2]" */
static char byt_rt5651_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ 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_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) 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) ...@@ -876,7 +877,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
const char *platform_name; const char *platform_name;
struct acpi_device *adev; struct acpi_device *adev;
struct device *codec_dev; struct device *codec_dev;
const char *hp_swapped;
bool is_bytcr = false; bool is_bytcr = false;
int ret_val = 0; int ret_val = 0;
int dai_index = 0; int dai_index = 0;
...@@ -1080,16 +1080,20 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) ...@@ -1080,16 +1080,20 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
} }
} }
if (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) snprintf(byt_rt5651_components, sizeof(byt_rt5651_components),
hp_swapped = "-hp-swapped"; "cfg-spk:%s cfg-mic:%s%s",
else (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ? "1" : "2",
hp_swapped = ""; 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), snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name),
"bytcr-rt5651-%s-spk-%s-mic%s", "bytcr-rt5651-%s-spk-%s-mic%s",
(byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ? (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ?
"mono" : "stereo", "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; byt_rt5651_card.long_name = byt_rt5651_long_name;
/* override plaform name, if required */ /* override plaform name, if required */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment