ASoC: add control components management
Subsystems (3)
Jaroslav Kysela
maintainerPATCH v2 1/3 ASoC: add control components management
This ASCII string can carry additional information about soundcard components or configuration. Add the possibility to set this string via the ASoC card.
--- include/sound/soc.h | 1 + sound/soc/soc-core.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)
include/sound/soc.h +1 -0
@@ -982,6 +982,7 @@ struct snd_soc_card {const char *name;const char *long_name;const char *driver_name; +const char *components;char dmi_longname[80 ];char topology_shortname[32 ];
sound/soc/soc-core.c +13 -0
@@ -2121,6 +2121,19 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)soc_setup_card_name (card->snd_card->driver, card->driver_name, card->name,1 ); +if (card->components) { +/* the current implementation of snd_component_add() accepts */ +/* multiple components in the string separated by space, */ +/* but the string collision (identical string) check might */ +/* not work correctly */ + ret =snd_component_add (card->snd_card, card->components); +if (ret <0 ) { +dev_err (card->dev,"ASoC: %s snd_component_add() failed: %d\n" , + card->name, ret); + goto probe_end; + } + } +if (card->late_probe) { ret = card->late_probe (card);if (ret <0 ) {
Signature · 5 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Jaroslav Kysela
maintainerPATCH v2 2/3 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.
--- sound/soc/intel/boards/bytcht_es8316.c | 10 +++++++++- sound/soc/intel/boards/bytcr_rt5640.c | 6 ++++++ sound/soc/intel/boards/bytcr_rt5651.c | 18 +++++++++++------- 3 files changed, 26 insertions(+), 8 deletions(-)
sound/soc/intel/boards/bytcht_es8316.c +9 -1
@@ -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,17 +573,24 @@ 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);if (ret) {gpiod_put (priv->speaker_en_gpio);dev_err (dev,"snd_soc_register_card failed: %d\n" , ret); +return ret; }platform_set_drvdata (pdev, &byt_cht_es8316_card);
sound/soc/intel/boards/bytcr_rt5640.c +6 -0
@@ -1081,6 +1081,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) {
@@ -1303,6 +1304,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) ?
sound/soc/intel/boards/bytcr_rt5651.c +11 -7
@@ -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 */
Signature · 5 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Jaroslav Kysela
maintainerRe: [alsa-devel] [PATCH v2 2/3] ASoC: Intel - use control components to describe card config
Dne 20. 11. 19 v 8:28 Jaroslav Kysela napsal(a):
Quoted 1 line
sound/soc/intel/boards/bytcht_es8316.c +0
-0
...
sound/soc/intel/boards/bytcht_es8316.c static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) · line 596
Quoted 11 lines
sound/soc/intel/boards/bytcht_es8316.c +2
-0+/* 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);if (ret) {gpiod_put (priv->speaker_en_gpio);dev_err (dev,"snd_soc_register_card failed: %d\n" , ret); +return ret; }platform_set_drvdata (pdev, &byt_cht_es8316_card);
Please, remove this extra new line when you apply the patch.
Thanks,
Jaroslav
Signature · 6 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc. _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Jaroslav Kysela
maintainerPATCH v2 3/3 ASoC: Intel - do not describe I/O configuration in the long card name
In reply to Jaroslav KyselaThe long card name might be used in GUI. This information should be hidden.
Add CONFIG_SND_SOC_INTEL_USER_FRIENDLY_NAMES configuration option.
--- sound/soc/intel/boards/Kconfig | 9 +++++++++ sound/soc/intel/boards/bytcht_es8316.c | 4 ++++ sound/soc/intel/boards/bytcr_rt5640.c | 4 ++++ sound/soc/intel/boards/bytcr_rt5651.c | 4 ++++ 4 files changed, 21 insertions(+)
sound/soc/intel/boards/Kconfig +9 -0
@@ -13,6 +13,15 @@ menuconfig SND_SOC_INTEL_MACH if SND_SOC_INTEL_MACH +config SND_SOC_INTEL_USER_FRIENDLY_NAMES + bool "Use more user friendly long card names" + help + Some drivers might pass the I/O configuration through the + soundcard's driver name in the control user space API. It may + be used in GUI. If you do not like this and the user space + does not depend on this (like UCM - Use Case Manager), + then select "Y". + if SND_SOC_INTEL_HASWELL config SND_SOC_INTEL_HASWELL_MACH
sound/soc/intel/boards/bytcht_es8316.c +4 -0
@@ -360,7 +360,9 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = {/* SoC card */ static char codec_name[SND_ACPI_I2C_ID_LEN ]; +#if !IS_ENABLED (CONFIG_SND_SOC_INTEL_USER_FRIENDLY_NAMES )static char long_name[50 ];/* = "bytcht-es8316-*-spk-*-mic" */ +#endif static char components_string[32 ];/* = "cfg-spk:* cfg-mic:* */ static int byt_cht_es8316_suspend (struct snd_soc_card *card)
@@ -578,10 +580,12 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) (quirk &BYT_CHT_ES8316_MONO_SPEAKER ) ?"1" :"2" , mic_name[BYT_CHT_ES8316_MAP(quirk)]); byt_cht_es8316_card.components = components_string; +#if !IS_ENABLED (CONFIG_SND_SOC_INTEL_USER_FRIENDLY_NAMES )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; +#endif /* register the soc card */ snd_soc_card_set_drvdata (&byt_cht_es8316_card, priv);
sound/soc/intel/boards/bytcr_rt5640.c +4 -0
@@ -1080,7 +1080,9 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = {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" */ +#if !IS_ENABLED (CONFIG_SND_SOC_INTEL_USER_FRIENDLY_NAMES )static char byt_rt5640_long_name[40 ];/* = "bytcr-rt5640-*-spk-*-mic" */ +#endif static char byt_rt5640_components[32 ];/* = "cfg-spk:* cfg-mic:*" */ static int byt_rt5640_suspend (struct snd_soc_card *card)
@@ -1309,12 +1311,14 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) (byt_rt5640_quirk &BYT_RT5640_MONO_SPEAKER ) ?"1" :"2" , map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]); byt_rt5640_card.components = byt_rt5640_components; +#if !IS_ENABLED (CONFIG_SND_SOC_INTEL_USER_FRIENDLY_NAMES )snprintf (byt_rt5640_long_name,sizeof (byt_rt5640_long_name),"bytcr-rt5640-%s-spk-%s-mic" , (byt_rt5640_quirk &BYT_RT5640_MONO_SPEAKER ) ?"mono" :"stereo" , map_name[BYT_RT5640_MAP (byt_rt5640_quirk)]); byt_rt5640_card.long_name = byt_rt5640_long_name; +#endif /* override plaform name, if required */ platform_name = mach->mach_params.platform;
sound/soc/intel/boards/bytcr_rt5651.c +4 -0
@@ -797,7 +797,9 @@ static struct snd_soc_dai_link byt_rt5651_dais[] = {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" */ +#if !IS_ENABLED (CONFIG_SND_SOC_INTEL_USER_FRIENDLY_NAMES )static char byt_rt5651_long_name[50 ];/* = "bytcr-rt5651-*-spk-*-mic[-swapped-hp]" */ +#endif static char byt_rt5651_components[50 ];/* = "cfg-spk:* cfg-mic:*" */ static int byt_rt5651_suspend (struct snd_soc_card *card)
@@ -1087,6 +1089,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) (byt_rt5651_quirk &BYT_RT5651_HP_LR_SWAPPED ) ? " cfg-hp:lrswap" : ""); byt_rt5651_card.components = byt_rt5651_components; +#if !IS_ENABLED (CONFIG_SND_SOC_INTEL_USER_FRIENDLY_NAMES ) snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name), "bytcr-rt5651-%s-spk-%s-mic%s", (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ?
@@ -1095,6 +1098,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) (byt_rt5651_quirk &BYT_RT5651_HP_LR_SWAPPED ) ? "-hp-swapped" : ""); byt_rt5651_card.long_name = byt_rt5651_long_name; +#endif /* override plaform name, if required */ platform_name = mach->mach_params.platform;
Signature · 5 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [alsa-devel] [PATCH v2 3/3] ASoC: Intel - do not describe I/O configuration in the long card name
Quoted 2 lines
+config
SND_SOC_INTEL_USER_FRIENDLY_NAMES
LONGNAMES?
sound/soc/intel/boards/Kconfig menuconfig SND_SOC_INTEL_MACH · line 23
Quoted 7 lines
sound/soc/intel/boards/Kconfig +7
-0+ bool "Use more user friendly long card names" + help + Some drivers might pass the I/O configuration through the + soundcard's driver name in the control user space API. It may + be used in GUI. If you do not like this and the user space + does not depend on this (like UCM - Use Case Manager), + then select "Y".
Sorry for being picky here, but I find the wording confusing with two negatives resulting in a Y.
maybe
Some drivers report the I/O configuration to userspace through the
soundcard's long card name in the control user space AP. An unfortunate side effect is that this long name may also be used by the GUI, confusing users with information they don't need. This option prevents the long name from being modified, and the I/O configuration will be provided through a different component interface.
Select Y if userspace like UCM (Use Case Manager) uses the component interface.
If unsure select N.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Jaroslav Kysela
maintainerRe: [alsa-devel] [PATCH v2 3/3] ASoC: Intel - do not describe I/O configuration in the long card name
Dne 20. 11. 19 v 17:08 Pierre-Louis Bossart napsal(a):
Quoted 18 lines
Quoted 2 lines
+config
SND_SOC_INTEL_USER_FRIENDLY_NAMESLONGNAMES?
sound/soc/intel/boards/Kconfig menuconfig SND_SOC_INTEL_MACH · line 23
Quoted 7 lines
sound/soc/intel/boards/Kconfig +7
-0+ bool "Use more user friendly long card names" + help + Some drivers might pass the I/O configuration through the + soundcard's driver name in the control user space API. It may + be used in GUI. If you do not like this and the user space + does not depend on this (like UCM - Use Case Manager), + then select "Y".Sorry for being picky here, but I find the wording confusing with two negatives resulting in a Y.
maybe
Quoted 9 lines
Some drivers report the I/O configuration to userspace through the soundcard's long card name in the control user space AP. An unfortunate side effect is that this long name may also be used by the GUI, confusing users with information they don't need.
This option prevents the long name from being modified, and the I/O configuration will be provided through a different component interface. Select Y if userspace like UCM (Use Case Manager) uses the component interface.
If unsure select N.
Thanks, I used your text. The v3 patches are sent without the first one which is already merged to the Mark's tree.
Thanks for review,
Jaroslav
Signature · 6 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc. _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel