ASoC: Use DMI name in sound card long name
Subsystems (3)
v2 cover ASoC: Use DMI name in sound card long name
From: Mengdong Lin <[email protected]>
This series is based on Liam's idea to use DMI name as the sound card short name in the audio workshop. Now we add DMI info to the card long name:
- Not change the card name (short name), keep it simple. So the card ID won't change as well.
- Use DMI name to make the card long name.
Machine drivers can use a new API to get this feature.
In user space, when the sound server ask UCM to open a sound card, UCM will try to find the best machine-specific configuration file based on the card long name, and only if not avaiable, fallback to the default configuration file that matches the card name (short name).
Please see patch:
ucm: Automatically load the best config file based on the card long name
History:
v1 from RFC: Give up using a table to map DMI info to a simple string,
since we cannot maintain such a table for each machine. Just do verbatim copy of DMI info and let user space decide how to use the DMI info in card long name to find the best UCM config file.
If device driver adds a flavor string, just append it after the DMI info fields to the card long name.
v2: Exclude card name and only keep DMI name in the long name, to
save the space since the long name cannot exceed 80 characters. Trim special characters like SPACE in the long name, because UCM configuration files & directories may use the same long name and Autoconf cannot handle special characters.
Liam Girdwood (1):
ASoC: core: Add API to use DMI name in sound card long name
Mengdong Lin (1):
ASoC: Intel: Use DMI name for sound card long name in Broadwell
machine driver
include/sound/soc.h | 4 ++ sound/soc/intel/boards/broadwell.c | 2 + sound/soc/soc-core.c | 99 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+)
Signature · 1 line
2.5.0
PATCH v2 1/2 ASoC: core: Add API to use DMI name in sound card long name
From: Liam Girdwood <[email protected]>
Intel DSP platform drivers are used by many different devices but are difficult for userspace to differentiate. This patch adds an API to allow the DMI name to be used in the sound card long name, thereby helping userspace load the correct UCM configuration. Usually machine drivers uses their own name as the sound card name (short name), and leave the long name and driver name blank. This API will use the DMI info like vendor, product and board to make up the card long name. If the machine driver has already explicitly set the long name, this API will do nothing.
This patch also allows for further differentiation as many devices that share the same DMI name i.e. Minnowboards, UP boards may be configured with different codecs or firmwares. The API supports flavoring the DMI name into the card longname to provide the extra differentiation required for these devices.
For Use Case Manager (UCM) in the user space, changing card long name by this API is backward compatible, since the card name does not change. For a given sound card, even if there is no device-specific UCM configuration file that uses the card long name, UCM will fall back to load the default configuration file that uses the card name.
include/sound/soc.h +4 -0
@@ -497,6 +497,8 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream);int snd_soc_runtime_set_dai_fmt (struct snd_soc_pcm_runtime *rtd,unsigned int dai_fmt); +int snd_soc_set_dmi_name (struct snd_soc_card *card,const char *flavour); +/* Utility functions to get clock rates from various things */ int snd_soc_calc_frame_size (int sample_size,int channels,int tdm_slots);int snd_soc_params_to_frame_size (struct snd_pcm_hw_params *params);
@@ -1094,6 +1096,8 @@ struct snd_soc_card {const char *name;const char *long_name;const char *driver_name; +char dmi_longname[80 ]; +struct device *dev;struct snd_card *snd_card;struct module *owner;
sound/soc/soc-core.c +99 -0
111 lines not on this page · raw message
Signature · 1 line
2.5.0
Liam Girdwood
maintainerRe: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 97 lines · On Tue, 2017-01-03 at 12:58 +0800, [email protected] wrote:
From: Liam Girdwood <[email protected]>
Intel DSP platform drivers are used by many different devices but are difficult for userspace to differentiate. This patch adds an API to allow the DMI name to be used in the sound card long name, thereby helping userspace load the correct UCM configuration. Usually machine drivers uses their own name as the sound card name (short name), and leave the long name and driver name blank. This API will use the DMI info like vendor, product and board to make up the card long name. If the machine driver has already explicitly set the long name, this API will do nothing.
This patch also allows for further differentiation as many devices that share the same DMI name i.e. Minnowboards, UP boards may be configured with different codecs or firmwares. The API supports flavoring the DMI name into the card longname to provide the extra differentiation required for these devices.
For Use Case Manager (UCM) in the user space, changing card long name by this API is backward compatible, since the card name does not change. For a given sound card, even if there is no device-specific UCM configuration file that uses the card long name, UCM will fall back to load the default configuration file that uses the card name.
Signed-off-by Liam Girdwood <[email protected]>Signed-off-by Mengdong Lin <[email protected]>include/sound/soc.h +4
-0@@ -497,6 +497,8 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream);int snd_soc_runtime_set_dai_fmt (struct snd_soc_pcm_runtime *rtd,unsigned int dai_fmt); +int snd_soc_set_dmi_name (struct snd_soc_card *card,const char *flavour); +/* Utility functions to get clock rates from various things */ int snd_soc_calc_frame_size (int sample_size,int channels,int tdm_slots);int snd_soc_params_to_frame_size (struct snd_pcm_hw_params *params);@@ -1094,6 +1096,8 @@ struct snd_soc_card {const char *name;const char *long_name;const char *driver_name; +char dmi_longname[80 ]; +struct device *dev;struct snd_card *snd_card;struct module *owner;sound/soc/soc-core.c +34
-0@@ -34,6 +34,7 @@#include <linux/ctype.h> #include <linux/slab.h> #include <linux/of.h> +#include <linux/dmi.h> #include <sound/core.h> #include <sound/jack.h> #include <sound/pcm.h> @@ -1886,6 +1887,104 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, }EXPORT_SYMBOL_GPL (snd_soc_runtime_set_dai_fmt); + +/* Only keep number and alphabet characters and a few separator characters. +* DMI info often has SPACE and we must trim them, since Use Case Manager in +* the user space expects the device-specific configuration files/directories +* use the same name as the card long name but Autoconf cannot support SPACE +* in file or directory name. +*/ +static void trim_special_characters (char *name) +{ +int i, j =0 ; + +for (i =0 ; name[i]; i++) { +if (isalnum (name[i]) || (name[i] =='.' ) + || (name[i] =='-' ) || (name[i] =='_' )) + name[j++] = name[i]; + } + + name[j] ='\0' ; +} + +/** +* snd_soc_set_dmi_name() - Register DMI names to card +* @card: The card to register DMI names +* @flavour: The flavour "differentiator" for the card amongst its peers. +* +* Intel DSP platform drivers are used by many different devices but are +* difficult for userspace to differentiate, since machine drivers ususally +* use their own name as the card name (short name) and leave the card long +* name blank. This function will allow DMI info to be used as the sound +* card long name, thereby helping userspace load the correct UCM (Use Case +* Manager) configuration. Character '.' are used to separate different DMI +* fields like "vendor.product.board". +*
sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, · line 1932
Quoted 10 lines
sound/soc/soc-core.c +10
-0+* Possible card long names may be: +* DellInc..XPS139343.0310JH +* IntelCorp..BroadwellClientPlatform.WilsonBeachSDS +* ASUSTeKCOMPUTERINC..T100TA.T100TA +* Circuitco.MinnowboardMaxD0PLATFORM.MinnowBoardMAX +* (Please note DMI info can also include '.' after some abbreviation like +* "Inc." so you may see double '.' sometimes) +* +* This function also supports flavoring the card longname to provide +* the extra differentiation, like "vendor.product.board.flavor".
I dont think we need vendor (it just makes it too long). The product or board name should be unique enough for us to load the correct files.
Liam
Quoted 58 lines
sound/soc/soc-core.c +55
-0+* +* We only keep number and alphabet characters and a few separator characters +* in the card long name since UCM in the user space uses the card long names +* as card configuration directory names and AudoConf cannot support special +* charactors like SPACE. +* +* Returns 0 on success, otherwise a negative error code. +*/ +int snd_soc_set_dmi_name (struct snd_soc_card *card,const char *flavour) +{ +const char *vendor, *product, *board; +char dmi_longname[80 ]; + +if (card->long_name) +return 0 ;/* long name already set by driver or from DMI */ + + vendor =dmi_get_system_info (DMI_BOARD_VENDOR ); +if (!vendor) { +dev_warn (card->dev,"ASoC: no DMI vendor name!\n" ); +return 0 ; + } + + product =dmi_get_system_info (DMI_PRODUCT_NAME ); + board =dmi_get_system_info (DMI_BOARD_NAME ); +if (!board && !product) { +/* fall back to using legacy name */ +dev_warn (card->dev,"ASoC: no DMI board/product name!\n" ); +return 0 ; + } + +/* make up dmi long name as: vendor.product.board */ +if (product && board) +snprintf (dmi_longname,sizeof (card->snd_card->longname), +"%s.%s.%s" , vendor, product, board); +else +snprintf (dmi_longname,sizeof (card->snd_card->longname), +"%s.%s" , vendor, product ? product : board); + +/* Add flavour to dmi long name */ +if (flavour) +snprintf (card->dmi_longname,sizeof (card->snd_card->longname), +"%s.%s" , dmi_longname, flavour); +else +strncpy (card->dmi_longname, dmi_longname, +sizeof (card->snd_card->longname) -1 ); + +trim_special_characters (card->dmi_longname); + +/* set long name */ + card->long_name = card->dmi_longname; + +return 0 ; +} +EXPORT_SYMBOL_GPL (snd_soc_set_dmi_name); +static int snd_soc_instantiate_card (struct snd_soc_card *card) {struct snd_soc_codec *codec;
Re: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 136 lines
-----Original Message-----
From: Liam Girdwood [mailto:[email protected]]
Sent: Tuesday, January 3, 2017 10:40 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Lin, Mengdong <[email protected]>; Koul, Vinod <[email protected]>; Bossart, Pierre-louis <[email protected]>
Subject: Re: [alsa-devel] [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long nameQuoted 10 lines · On Tue, 2017-01-03 at 12:58 +0800, [email protected] wrote:
From: Liam Girdwood <[email protected]>
Intel DSP platform drivers are used by many different devices but are difficult for userspace to differentiate. This patch adds an API to allow the DMI name to be used in the sound card long name, thereby helping userspace load the correct UCM configuration. Usually machine drivers uses their own name as the sound card name (short name), and leave the long name and driver name blank. This API will use the DMI info like vendor, product and board to make up the card long name. If the machine driver has already explicitly set the long name, this API will do
nothing.
Quoted 21 lines
This patch also allows for further differentiation as many devices that share the same DMI name i.e. Minnowboards, UP boards may be configured with different codecs or firmwares. The API supports flavoring the DMI name into the card longname to provide the extra differentiation required for these devices.
For Use Case Manager (UCM) in the user space, changing card long name by this API is backward compatible, since the card name does not change. For a given sound card, even if there is no device-specific UCM configuration file that uses the card long name, UCM will fall back to load the default configuration file that uses the card name.
Signed-off-by Liam Girdwood <[email protected]>Signed-off-by Mengdong Lin <[email protected]>include/sound/soc.h index renamed from include/sound/soc.h +0
-0795e6c4..e4f1844 100644
include/sound/soc.h +0
-0@@ -497,6 +497,8 @@ void snd_soc_runtime_deactivate(structQuoted 1 line
snd_soc_pcm_runtime*rtd, int stream); intsnd_soc_runtime_set_dai_fmt(struct
snd_soc_pcm_runtime*rtd,Quoted 8 lines
include/sound/soc.h +3
-0unsigned int dai_fmt); +int snd_soc_set_dmi_name (struct snd_soc_card *card,const char +*flavour); +/* Utility functions to get clock rates from various things */ int
snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); intsnd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);@@
Quoted 22 lines
-1094,6 +1096,8 @@ struct
snd_soc_card{include/sound/soc.h +2
-0const char *name;const char *long_name;const char *driver_name; +char dmi_longname[80 ]; +struct device *dev;struct snd_card *snd_card;struct module *owner;sound/soc/soc-core.c index renamed from sound/soc/soc-core.c +0
-0aaab26a..3dbb5aa 100644
sound/soc/soc-core.c +1
-0@@ -34,6 +34,7 @@#include <linux/ctype.h> #include <linux/slab.h> #include <linux/of.h> +#include <linux/dmi.h> #include <sound/core.h> #include <sound/jack.h> #include <sound/pcm.h> sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct · line 1891
Quoted 5 lines
sound/soc/soc-core.c +2
-0@@ -1886,6 +1887,104 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, }EXPORT_SYMBOL_GPL (snd_soc_runtime_set_dai_fmt ); + +/* Only keep number and alphabet characters and a few separator characters.
Quoted 40 lines
sound/soc/soc-core.c +40
-0+* DMI info often has SPACE and we must trim them, since Use Case +Manager in +* the user space expects the device-specific configuration +files/directories +* use the same name as the card long name but Autoconf cannot +support SPACE +* in file or directory name. +*/ +static void trim_special_characters (char *name) { +int i, j =0 ; + +for (i =0 ; name[i]; i++) { +if (isalnum (name[i]) || (name[i] =='.' ) + || (name[i] =='-' ) || (name[i] =='_' )) + name[j++] = name[i]; + } + + name[j] ='\0' ; +} + +/** +* snd_soc_set_dmi_name() - Register DMI names to card +* @card: The card to register DMI names +* @flavour: The flavour "differentiator" for the card amongst its peers. +* +* Intel DSP platform drivers are used by many different devices but +are +* difficult for userspace to differentiate, since machine drivers +ususally +* use their own name as the card name (short name) and leave the +card long +* name blank. This function will allow DMI info to be used as the +sound +* card long name, thereby helping userspace load the correct UCM +(Use Case +* Manager) configuration. Character '.' are used to separate +different DMI +* fields like "vendor.product.board". +* +* Possible card long names may be: sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, · line 1932
Quoted 10 lines
sound/soc/soc-core.c +10
-0+* DellInc..XPS139343.0310JH +* IntelCorp..BroadwellClientPlatform.WilsonBeachSDS +* ASUSTeKCOMPUTERINC..T100TA.T100TA +* Circuitco.MinnowboardMaxD0PLATFORM.MinnowBoardMAX +* (Please note DMI info can also include '.' after some abbreviation +like +* "Inc." so you may see double '.' sometimes) +* +* This function also supports flavoring the card longname to provide +* the extra differentiation, like "vendor.product.board.flavor". I dont think we need vendor (it just makes it too long). The product or board name should be unique enough for us to load the correct files.
Quoted 1 line
Liam
Yes, from the sample machines I checked, product or board name are unique. But I feel there might be the risk that two vendors happen to use the same product or board name, e.g. "T100TA".
And if we want to add the vendor field later, we may need to rename existing UCM configuration files and directories, which may be not so easy if those machines are not around us.
Thanks
Mengdong
Quoted 64 lines
Quoted 21 lines
sound/soc/soc-core.c +20
-0+* +* We only keep number and alphabet characters and a few separator +characters +* in the card long name since UCM in the user space uses the card +long names +* as card configuration directory names and AudoConf cannot support +special +* charactors like SPACE. +* +* Returns 0 on success, otherwise a negative error code. +*/ +int snd_soc_set_dmi_name (struct snd_soc_card *card,const char +*flavour) { +const char *vendor, *product, *board; +char dmi_longname[80 ]; + +if (card->long_name) +return 0 ;/* long name already set by driver or from DMI */ + + vendor =dmi_get_system_info (DMI_BOARD_VENDOR );sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
Quoted 10 lines
sound/soc/soc-core.c +10
-0+if (!vendor) { +dev_warn (card->dev,"ASoC: no DMI vendor name!\n" ); +return 0 ; + } + + product =dmi_get_system_info (DMI_PRODUCT_NAME ); + board =dmi_get_system_info (DMI_BOARD_NAME ); +if (!board && !product) { +/* fall back to using legacy name */ + dev_warn(card->dev, "ASoC: no DMI board/productname!\n");
Quoted 31 lines
sound/soc/soc-core.c +28
-0+return 0 ; + } + +/* make up dmi long name as: vendor.product.board */ +if (product && board) +snprintf (dmi_longname,sizeof (card->snd_card->longname), +"%s.%s.%s" , vendor, product, board); +else +snprintf (dmi_longname,sizeof (card->snd_card->longname), +"%s.%s" , vendor, product ? product : board); + +/* Add flavour to dmi long name */ +if (flavour) +snprintf (card->dmi_longname,sizeof (card->snd_card- longname), +"%s.%s" , dmi_longname, flavour); +else +strncpy (card->dmi_longname, dmi_longname, +sizeof (card->snd_card->longname) -1 ); + +trim_special_characters (card->dmi_longname); + +/* set long name */ + card->long_name = card->dmi_longname; + +return 0 ; +} +EXPORT_SYMBOL_GPL (snd_soc_set_dmi_name); +static int snd_soc_instantiate_card (struct snd_soc_card *card) {struct snd_soc_codec *codec;
Liam Girdwood
maintainerRe: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 136 lines · Mengdong
Quoted 136 lines
-----Original Message-----
From: Liam Girdwood [mailto:[email protected]]
Sent: Tuesday, January 3, 2017 10:40 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Lin, Mengdong <[email protected]>; Koul, Vinod <[email protected]>; Bossart, Pierre-louis <[email protected]>
Subject: Re: [alsa-devel] [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long nameQuoted 10 lines · On Tue, 2017-01-03 at 12:58 +0800, [email protected] wrote:
From: Liam Girdwood <[email protected]>
Intel DSP platform drivers are used by many different devices but are difficult for userspace to differentiate. This patch adds an API to allow the DMI name to be used in the sound card long name, thereby helping userspace load the correct UCM configuration. Usually machine drivers uses their own name as the sound card name (short name), and leave the long name and driver name blank. This API will use the DMI info like vendor, product and board to make up the card long name. If the machine driver has already explicitly set the long name, this API will do
nothing.
Quoted 21 lines
This patch also allows for further differentiation as many devices that share the same DMI name i.e. Minnowboards, UP boards may be configured with different codecs or firmwares. The API supports flavoring the DMI name into the card longname to provide the extra differentiation required for these devices.
For Use Case Manager (UCM) in the user space, changing card long name by this API is backward compatible, since the card name does not change. For a given sound card, even if there is no device-specific UCM configuration file that uses the card long name, UCM will fall back to load the default configuration file that uses the card name.
Signed-off-by Liam Girdwood <[email protected]>Signed-off-by Mengdong Lin <[email protected]>include/sound/soc.h index renamed from include/sound/soc.h +0
-0795e6c4..e4f1844 100644
include/sound/soc.h +0
-0@@ -497,6 +497,8 @@ void snd_soc_runtime_deactivate(structQuoted 1 line
snd_soc_pcm_runtime*rtd, int stream); intsnd_soc_runtime_set_dai_fmt(struct
snd_soc_pcm_runtime*rtd,Quoted 8 lines
include/sound/soc.h +3
-0unsigned int dai_fmt); +int snd_soc_set_dmi_name (struct snd_soc_card *card,const char +*flavour); +/* Utility functions to get clock rates from various things */ int
snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); intsnd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);@@
Quoted 22 lines
-1094,6 +1096,8 @@ struct
snd_soc_card{include/sound/soc.h +2
-0const char *name;const char *long_name;const char *driver_name; +char dmi_longname[80 ]; +struct device *dev;struct snd_card *snd_card;struct module *owner;sound/soc/soc-core.c index renamed from sound/soc/soc-core.c +0
-0aaab26a..3dbb5aa 100644
sound/soc/soc-core.c +1
-0@@ -34,6 +34,7 @@#include <linux/ctype.h> #include <linux/slab.h> #include <linux/of.h> +#include <linux/dmi.h> #include <sound/core.h> #include <sound/jack.h> #include <sound/pcm.h> sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct · line 1891
Quoted 5 lines
sound/soc/soc-core.c +2
-0@@ -1886,6 +1887,104 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, }EXPORT_SYMBOL_GPL (snd_soc_runtime_set_dai_fmt ); + +/* Only keep number and alphabet characters and a few separator characters.
Quoted 40 lines
sound/soc/soc-core.c +40
-0+* DMI info often has SPACE and we must trim them, since Use Case +Manager in +* the user space expects the device-specific configuration +files/directories +* use the same name as the card long name but Autoconf cannot +support SPACE +* in file or directory name. +*/ +static void trim_special_characters (char *name) { +int i, j =0 ; + +for (i =0 ; name[i]; i++) { +if (isalnum (name[i]) || (name[i] =='.' ) + || (name[i] =='-' ) || (name[i] =='_' )) + name[j++] = name[i]; + } + + name[j] ='\0' ; +} + +/** +* snd_soc_set_dmi_name() - Register DMI names to card +* @card: The card to register DMI names +* @flavour: The flavour "differentiator" for the card amongst its peers. +* +* Intel DSP platform drivers are used by many different devices but +are +* difficult for userspace to differentiate, since machine drivers +ususally +* use their own name as the card name (short name) and leave the +card long +* name blank. This function will allow DMI info to be used as the +sound +* card long name, thereby helping userspace load the correct UCM +(Use Case +* Manager) configuration. Character '.' are used to separate +different DMI +* fields like "vendor.product.board". +* +* Possible card long names may be: sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, · line 1932
Quoted 10 lines
sound/soc/soc-core.c +10
-0+* DellInc..XPS139343.0310JH +* IntelCorp..BroadwellClientPlatform.WilsonBeachSDS +* ASUSTeKCOMPUTERINC..T100TA.T100TA +* Circuitco.MinnowboardMaxD0PLATFORM.MinnowBoardMAX +* (Please note DMI info can also include '.' after some abbreviation +like +* "Inc." so you may see double '.' sometimes) +* +* This function also supports flavoring the card longname to provide +* the extra differentiation, like "vendor.product.board.flavor". I dont think we need vendor (it just makes it too long). The product or board name should be unique enough for us to load the correct files.
Quoted 5 lines
Quoted 1 line
Liam
Yes, from the sample machines I checked, product or board name are unique. But I feel there might be the risk that two vendors happen to use the same product or board name, e.g. "T100TA".
I think this would be problematic from a legal/marketing position from two different vendors so it would be unlikely.
Liam
Quoted 77 lines
And if we want to add the vendor field later, we may need to rename existing UCM configuration files and directories, which may be not so easy if those machines are not around us.
Thanks
MengdongQuoted 55 lines
Quoted 21 lines
sound/soc/soc-core.c +20
-0+* +* We only keep number and alphabet characters and a few separator +characters +* in the card long name since UCM in the user space uses the card +long names +* as card configuration directory names and AudoConf cannot support +special +* charactors like SPACE. +* +* Returns 0 on success, otherwise a negative error code. +*/ +int snd_soc_set_dmi_name (struct snd_soc_card *card,const char +*flavour) { +const char *vendor, *product, *board; +char dmi_longname[80 ]; + +if (card->long_name) +return 0 ;/* long name already set by driver or from DMI */ + + vendor =dmi_get_system_info (DMI_BOARD_VENDOR );sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
Quoted 10 lines
sound/soc/soc-core.c +10
-0+if (!vendor) { +dev_warn (card->dev,"ASoC: no DMI vendor name!\n" ); +return 0 ; + } + + product =dmi_get_system_info (DMI_PRODUCT_NAME ); + board =dmi_get_system_info (DMI_BOARD_NAME ); +if (!board && !product) { +/* fall back to using legacy name */ + dev_warn(card->dev, "ASoC: no DMI board/productname!\n");
Quoted 23 lines
sound/soc/soc-core.c +22
-0+return 0 ; + } + +/* make up dmi long name as: vendor.product.board */ +if (product && board) +snprintf (dmi_longname,sizeof (card->snd_card->longname), +"%s.%s.%s" , vendor, product, board); +else +snprintf (dmi_longname,sizeof (card->snd_card->longname), +"%s.%s" , vendor, product ? product : board); + +/* Add flavour to dmi long name */ +if (flavour) +snprintf (card->dmi_longname,sizeof (card->snd_card- longname), +"%s.%s" , dmi_longname, flavour); +else +strncpy (card->dmi_longname, dmi_longname, +sizeof (card->snd_card->longname) -1 ); + +trim_special_characters (card->dmi_longname); + +/* set long name */ Quoted 9 lines
sound/soc/soc-core.c int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, · line 1990
Quoted 8 lines
sound/soc/soc-core.c +6
-0+ card->long_name = card->dmi_longname; + +return 0 ; +} +EXPORT_SYMBOL_GPL (snd_soc_set_dmi_name); +static int snd_soc_instantiate_card (struct snd_soc_card *card) {struct snd_soc_codec *codec;_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I dont think we need vendor (it just makes it too long). The product or board name should be unique enough for us to load the correct files.
Liam
Yes, from the sample machines I checked, product or board name are unique. But I feel there might be the risk that two vendors happen to use the same product or board name, e.g. "T100TA".
I think this would be problematic from a legal/marketing position from two different vendors so it would be unlikely.
Please don't remove the manufacturer name for now...
Some vendors use product names that are indeed unique and easy enough to remember, but others like Lenovo use "1952W5R" or "20C3001VHH" (real examples you can Google to see I am not making this up). The board name can also be "SKG18 t". I really have no appetite for a UCM directory called 20C3001VHH.SKG18t :-) I would also be ready to bet that smaller manufacturers in the Chinese ecosystem use similar product names at the DMI level. removing the vendor name would likely result in mistakes.
You really want the manufacturer name to make the maintenance of these files easier on the rest of us. Sometimes the DMI version field is actually more self-explanatory, e.g. "ThinkPad 60" or "ThinkPad 10" for the two Lenovo examples, maybe this is something we ought to look at.
Re: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 12 lines · Pierre-Louis Bossart
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
I dont think we need vendor (it just makes it too long). The product or board
name should be unique enough for us to load the correct files.Liam
Yes, from the sample machines I checked, product or board name are unique. But I feel there might be the risk that two vendors happen to use the same product or board name, e.g. "T100TA".
I think this would be problematic from a legal/marketing position from two different vendors so it would be unlikely.
Quoted 15 lines
Please don't remove the manufacturer name for now...
Some vendors use product names that are indeed unique and easy enough to remember, but others like Lenovo use "1952W5R" or "20C3001VHH" (real examples you can Google to see I am not making this up). The board name can also be "SKG18 t". I really have no appetite for a UCM directory called 20C3001VHH.SKG18t :-)
I would also be ready to bet that smaller manufacturers in the Chinese ecosystem use similar product names at the DMI level. removing the vendor name would likely result in mistakes.
You really want the manufacturer name to make the maintenance of these files easier on the rest of us. Sometimes the DMI version field is actually more self-explanatory, e.g. "ThinkPad 60" or "ThinkPad 10" for the two Lenovo examples, maybe this is something we ought to look at.
So we'll keep the manufacturer name.
And let's put the "Product version" as well if available, Liam?
I also observed Lenovo puts the the user-friendly name in the product version like "Thinkpad S5 Yoga 15", while it product name is "20DQA00KCD", no self-explanatory.
It seems different manufacturer tend to put self-explanatory name in different fields:
Lenovo thinkpad: product version
Dell: product name
ASUS: both product name and board name
Intel: board name
Do we want some table to specify the field we want for major vendors? So we may just pick the most valuable DMI field for the card long name, for those manufacturers to save the space. But it may not scale if the manufacturer change their preference or use different way for different product series, since I only checked a few machines by a few vendors.
Also I wonder if we find the key word like "Dell, HP or ASUS", may we not use verbatim copy on the vendor name but just use these key words? This can also save some space.
Thanks
Mengdong
Quoted 5 lines
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Liam Girdwood
maintainerRe: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 30 lines · Mengdong Lin
Quoted 12 lines · Pierre-Louis Bossart
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
I dont think we need vendor (it just makes it too long). The product or board
name should be unique enough for us to load the correct files.Liam
Yes, from the sample machines I checked, product or board name are unique. But I feel there might be the risk that two vendors happen to use the same product or board name, e.g. "T100TA".
I think this would be problematic from a legal/marketing position from two different vendors so it would be unlikely.
Quoted 15 lines
Please don't remove the manufacturer name for now...
Some vendors use product names that are indeed unique and easy enough to remember, but others like Lenovo use "1952W5R" or "20C3001VHH" (real examples you can Google to see I am not making this up). The board name can also be "SKG18 t". I really have no appetite for a UCM directory called 20C3001VHH.SKG18t :-)
I would also be ready to bet that smaller manufacturers in the Chinese ecosystem use similar product names at the DMI level. removing the vendor name would likely result in mistakes.
You really want the manufacturer name to make the maintenance of these files easier on the rest of us. Sometimes the DMI version field is actually more self-explanatory, e.g. "ThinkPad 60" or "ThinkPad 10" for the two Lenovo examples, maybe this is something we ought to look at.
Quoted 3 lines
So we'll keep the manufacturer name.
And let's put the "Product version" as well if available, Liam?
Yes, lets keep the manufacturer name. I agree with Pierre in that we dont want meaningless directories names. Creating a directory structures like
1) manufacturer/product/board OR
2) manufacturer/product OR
3) manufacturer/board
(2 or 3 if board or product is NULL)
are fine by me and make finding the correct card simpler. You could even replace the . with / in your longname to save the string conversion later on.
Liam
Quoted 38 lines
I also observed Lenovo puts the the user-friendly name in the product version like "Thinkpad S5 Yoga 15", while it product name is "20DQA00KCD", no self-explanatory.
It seems different manufacturer tend to put self-explanatory name in different fields:
Lenovo thinkpad: product version
Dell: product name
ASUS: both product name and board name
Intel: board nameDo we want some table to specify the field we want for major vendors? So we may just pick the most valuable DMI field for the card long name, for those manufacturers to save the space. But it may not scale if the manufacturer change their preference or use different way for different product series, since I only checked a few machines by a few vendors.
Also I wonder if we find the key word like "Dell, HP or ASUS", may we not use verbatim copy on the vendor name but just use these key words? This can also save some space.
Thanks
MengdongQuoted 5 lines
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 10 lines · Liam Girdwood
Quoted 6 lines · Mengdong Lin
On 01/04/2017 04:09 AM, Pierre-Louis Bossart wrote:
So we'll keep the manufacturer name.
And let's put the "Product version" as well if available, Liam?
Yes, lets keep the manufacturer name. I agree with Pierre in that we dont want meaningless directories names.
Okay. Thanks for your confirmation!
Quoted 7 lines
Creating a directory structures
like1) manufacturer/product/board OR
2) manufacturer/product OR
3) manufacturer/board
Quoted 7 lines
(2 or 3 if board or product is NULL)
are fine by me and make finding the correct card simpler. You could even replace the . with / in your longname to save the string conversion later on.
Liam
May we keep the flat directory structure for UCM files?
For the same manufacturer, its DMI vendor name could change, e.g. "Intel Inc." or "Intel Corporation". In addition, there may be changes caused by using upper case or low case characters. Since we don't want to maintain a mapping table and just do verbatim copy of DMI info, it's hard to group all the products/boards of one manufacturer into one UCM directory. So I feel it may be better to keep the simple flat directory structure.
Thanks
Mengdong
Liam Girdwood
maintainerRe: [PATCH v2 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 24 lines · Mengdong Lin
Quoted 10 lines · Liam Girdwood
Quoted 6 lines · Mengdong Lin
On 01/04/2017 04:09 AM, Pierre-Louis Bossart wrote:
So we'll keep the manufacturer name.
And let's put the "Product version" as well if available, Liam?
Yes, lets keep the manufacturer name. I agree with Pierre in that we dont want meaningless directories names.
Okay. Thanks for your confirmation!
Quoted 9 lines
Creating a directory structures
like1) manufacturer/product/board OR
2) manufacturer/product OR
3) manufacturer/board(2 or 3 if board or product is NULL)
Quoted 7 lines
Quoted 5 lines
are fine by me and make finding the correct card simpler. You could even replace the . with / in your longname to save the string conversion later on.
Liam
May we keep the flat directory structure for UCM files?
This may lead to really long file names and a very crowded master directory.
Quoted 8 lines
For the same manufacturer, its DMI vendor name could change, e.g. "Intel Inc." or "Intel Corporation". In addition, there may be changes caused by using upper case or low case characters. Since we don't want to maintain a mapping table and just do verbatim copy of DMI info, it's hard to group all the products/boards of one manufacturer into one UCM directory. So I feel it may be better to keep the simple flat directory structure.
This wont matter if we have > 1 directory for Intel or Dell etc, as it's obvious in the naming. No mapping needed.
Liam
Quoted 7 lines
Thanks
Mengdong
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH v2 2/2 ASoC: Intel: Use DMI name for sound card long name in Broadwell machine driver
In reply to [email protected]From: Mengdong Lin <[email protected]>
Intel Broadwell machine driver will call API snd_soc_set_dmi_name() to use DMI info to make the sound card long name.
For example, here are the changed long name for two Broadwell-based machines:
Dell XPS-13(2015): DellInc..XPS139343.0310JH
Intel WilsonBeach: Intel Corp..BroadwellClientplatform.WilsonBeachSDS
They still share the same card name "broadwell-rt286".
sound/soc/intel/boards/broadwell.c +2 -0
@@ -266,6 +266,8 @@ static int broadwell_audio_probe(struct platform_device *pdev) { broadwell_rt286.dev = &pdev->dev; +snd_soc_set_dmi_name (&broadwell_rt286,NULL ); +return devm_snd_soc_register_card (&pdev->dev, &broadwell_rt286); }
Signature · 1 line
2.5.0