ASoC: Use DMI name in sound card long name
Subsystems (3)
v3 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.
v3: Also include DMI product version in the long name, since vendors
like Lenovo may only put self-explanatory name in this field.
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 | 122 +++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+)
Signature · 1 line
2.5.0
PATCH v3 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 +122 -0
134 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v3 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.01.0310JH
Intel WilsonBeach: Intel Corp..BroadwellClientplatform.0.1.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
Re: [PATCH v3 1/2] ASoC: core: Add API to use DMI name in sound card long name
In reply to [email protected]Quoted 14 lines · On Tue, 10 Jan 2017 07:42:49 +0100, [email protected] wrote:
+/**
+ *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.
+ *
+ * An Intel machine driver may be 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. To differentiate such devices and fix bugs due to lack of
+ * device-specific configurations, this function allows DMI info to be used
+ * as the sound card long name, in the format of
+ * "vendor.product.version.board"
+ * (Character '.' are used to separate different DMI fields here).
Quoted 8 lines
+ * This will help the userspace to load the correct UCM (Use Case Manager)
+ * configuration.
+ *
+ * Possible card long names may be:
+ * DellInc..XPS139343.01.0310JH
+ * ASUSTeKCOMPUTERINC..T100TA.1.0.T100TA
+ * Circuitco.MinnowboardMaxD0PLATFORM.D0.MinnowBoardMAX
+ * (Please note DMI can also include '.' like"Inc." so you may see double '.
'
Quoted 1 line
+ * sometimes)
Looking at the examples above, I wonder whether the dot is the best choice as the separator. Might other letters (e.g. ":" or "=") would be clearer? The colon might be bad if it were combined with the alsa-lib plugin syntax, but I guess it won't happen?
thanks,
Takashi
Re: [PATCH v3 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 24 lines · Takashi Iwai
Quoted 14 lines · On Tue, 10 Jan 2017 07:42:49 +0100, [email protected] wrote:
+/**
+ *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.
+ *
+ * An Intel machine driver may be 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. To differentiate such devices and fix bugs due to lack of
+ * device-specific configurations, this function allows DMI info to be used
+ * as the sound card long name, in the format of
+ * "vendor.product.version.board"
+ * (Character '.' are used to separate different DMI fields here).Quoted 8 lines
+ * This will help the userspace to load the correct UCM (Use Case Manager)
+ * configuration.
+ *
+ * Possible card long names may be:
+ * DellInc..XPS139343.01.0310JH
+ * ASUSTeKCOMPUTERINC..T100TA.1.0.T100TA
+ * Circuitco.MinnowboardMaxD0PLATFORM.D0.MinnowBoardMAX
+ * (Please note DMI can also include '.' like"Inc." so you may see double '.
Quoted 8 lines
'
Quoted 1 line
+ * sometimes)
Looking at the examples above, I wonder whether the dot is the best choice as the separator. Might other letters (e.g. ":" or "=") would be clearer? The colon might be bad if it were combined with the alsa-lib plugin syntax, but I guess it won't happen?
Hi Takashi,
I found we cannot use ":" as separator. It's because we want to use the card long name as the name of the directory to store UCM configuration files for this card, and Autoconf cannot support ":" in the directory name.
Both "=" and "-" can work, which would you suggest to use?
I've not observed "-" or "=" in DMI fields till now, and I guess "=" is less likely to be used by vendors.
Thanks
Mengdong
Re: [PATCH v3 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 36 lines · Mengdong Lin
Quoted 24 lines · Takashi Iwai
Quoted 14 lines · On Tue, 10 Jan 2017 07:42:49 +0100, [email protected] wrote:
+/**
+ *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.
+ *
+ * An Intel machine driver may be 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. To differentiate such devices and fix bugs due to lack of
+ * device-specific configurations, this function allows DMI info to be used
+ * as the sound card long name, in the format of
+ * "vendor.product.version.board"
+ * (Character '.' are used to separate different DMI fields here).Quoted 8 lines
+ * This will help the userspace to load the correct UCM (Use Case Manager)
+ * configuration.
+ *
+ * Possible card long names may be:
+ * DellInc..XPS139343.01.0310JH
+ * ASUSTeKCOMPUTERINC..T100TA.1.0.T100TA
+ * Circuitco.MinnowboardMaxD0PLATFORM.D0.MinnowBoardMAX
+ * (Please note DMI can also include '.' like"Inc." so you may see double '.Quoted 8 lines
'
Quoted 1 line
+ * sometimes)
Looking at the examples above, I wonder whether the dot is the best choice as the separator. Might other letters (e.g. ":" or "=") would be clearer? The colon might be bad if it were combined with the alsa-lib plugin syntax, but I guess it won't happen?
Quoted 6 lines
Hi Takashi,
I found we cannot use ":" as separator. It's because we want to use the card long name as the name of the directory to store UCM configuration files for this card, and Autoconf cannot support ":" in the directory name.
OK, fair enough.
Quoted 3 lines
Both "=" and "-" can work, which would you suggest to use? I've not observed "-" or "=" in DMI fields till now, and I guess "=" is less likely to be used by vendors.
Yes, but OTOH, "=" would become tricky if you want to handle it in a shell script.
One alternative is to use "." or "-" for a separator while converting the existing such letters to a different one like "_".
thanks,
Takashi
Re: [PATCH v3 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 45 lines · Takashi Iwai
Quoted 36 lines · Mengdong Lin
Quoted 24 lines · Takashi Iwai
Quoted 14 lines · On Tue, 10 Jan 2017 07:42:49 +0100, [email protected] wrote:
+/**
+ *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.
+ *
+ * An Intel machine driver may be 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. To differentiate such devices and fix bugs due to lack of
+ * device-specific configurations, this function allows DMI info to be used
+ * as the sound card long name, in the format of
+ * "vendor.product.version.board"
+ * (Character '.' are used to separate different DMI fields here).Quoted 8 lines
+ * This will help the userspace to load the correct UCM (Use Case Manager)
+ * configuration.
+ *
+ * Possible card long names may be:
+ * DellInc..XPS139343.01.0310JH
+ * ASUSTeKCOMPUTERINC..T100TA.1.0.T100TA
+ * Circuitco.MinnowboardMaxD0PLATFORM.D0.MinnowBoardMAX
+ * (Please note DMI can also include '.' like"Inc." so you may see double '.Quoted 8 lines
'
Quoted 1 line
+ * sometimes)
Looking at the examples above, I wonder whether the dot is the best choice as the separator. Might other letters (e.g. ":" or "=") would be clearer? The colon might be bad if it were combined with the alsa-lib plugin syntax, but I guess it won't happen?
Quoted 6 lines
Hi Takashi,
I found we cannot use ":" as separator. It's because we want to use the card long name as the name of the directory to store UCM configuration files for this card, and Autoconf cannot support ":" in the directory name.
Quoted 8 lines
OK, fair enough.
Quoted 3 lines
Both "=" and "-" can work, which would you suggest to use? I've not observed "-" or "=" in DMI fields till now, and I guess "=" is less likely to be used by vendors.
Yes, but OTOH, "=" would become tricky if you want to handle it in a shell script.
Okay. So we won't use "=".
Quoted 4 lines
One alternative is to use "." or "-" for a separator while converting the existing such letters to a different one like "_".
It looks nice. Thanks for the tips! I'll use "-" as the separator, and convert the the existing "-" in DMI strings to "_".
Thanks
Mengdong
Mark Brown
maintainerRe: [PATCH v3 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 5 lines · Mengdong Lin
Quoted 3 lines · Takashi Iwai
Quoted 2 lines · Mengdong Lin
Quoted 1 line · Takashi Iwai
[email protected] wrote:
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ * Possible card long names may be:
+ * DellInc..XPS139343.01.0310JH
+ * ASUSTeKCOMPUTERINC..T100TA.1.0.T100TA
+ * Circuitco.MinnowboardMaxD0PLATFORM.D0.MinnowBoardMAXIt looks nice. Thanks for the tips! I'll use "-" as the separator, and convert the the existing "-" in DMI strings to "_".
"nice" seems like a very strong term here :) Not sure there's any options that will look much better but still.
Re: [PATCH v3 1/2] ASoC: core: Add API to use DMI name in sound card long name
Quoted 12 lines · Mark Brown
Quoted 9 lines · Mengdong Lin
Quoted 8 lines · Takashi Iwai
Quoted 7 lines · Mengdong Lin
Quoted 6 lines · Takashi Iwai
Quoted 4 lines · [email protected] wrote:
+ * Possible card long names may be:
+ * DellInc..XPS139343.01.0310JH
+ * ASUSTeKCOMPUTERINC..T100TA.1.0.T100TA
+ * Circuitco.MinnowboardMaxD0PLATFORM.D0.MinnowBoardMAX
Quoted 5 lines
Quoted 2 lines
It looks nice. Thanks for the tips! I'll use "-" as the separator, and convert the the existing "-" in DMI strings to "_".
"nice" seems like a very strong term here :) Not sure there's any options that will look much better but still.
Yeah, it's still not photogenic. But the merit is rather that it makes easier to parse.
Takashi