* [PATCH] ASoC: snd_soc_set_dmi_name will use DMI_SYS_VENDOR if available
@ 2017-04-28 16:19 mengdong.lin
2017-04-28 16:40 ` Pierre-Louis Bossart
0 siblings, 1 reply; 4+ messages in thread
From: mengdong.lin @ 2017-04-28 16:19 UTC (permalink / raw)
To: alsa-devel, broonie
Cc: tiwai, liam.r.girdwood, Mengdong Lin, mengdong.lin,
pierre-louis.bossart
From: Mengdong Lin <mengdong.lin@linux.intel.com>
This fix is based on Daniel Drake's suggestion: most x86 machines have a
meaningfull DMI_SYS_VENDOR rather than DMI_BOARD_VENDOR.
So snd_soc_set_dmi_name will try to get vendor name from DMI_SYS_VENDOR
at first, and if that's null, then use DMI_BOARD_VENDOR.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 525f2f3..45f0a34 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1974,7 +1974,9 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour)
return 0; /* long name already set by driver or from DMI */
/* make up dmi long name as: vendor.product.version.board */
- vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+ vendor = dmi_get_system_info(DMI_SYS_VENDOR);
+ if (!vendor)
+ vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
if (!vendor) {
dev_warn(card->dev, "ASoC: no DMI vendor name!\n");
return 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: snd_soc_set_dmi_name will use DMI_SYS_VENDOR if available
2017-04-28 16:19 [PATCH] ASoC: snd_soc_set_dmi_name will use DMI_SYS_VENDOR if available mengdong.lin
@ 2017-04-28 16:40 ` Pierre-Louis Bossart
2017-05-02 10:42 ` Mengdong Lin
0 siblings, 1 reply; 4+ messages in thread
From: Pierre-Louis Bossart @ 2017-04-28 16:40 UTC (permalink / raw)
To: mengdong.lin, alsa-devel, broonie
Cc: tiwai, liam.r.girdwood, pierre-louis.bossart, mengdong.lin
On 4/28/17 11:19 AM, mengdong.lin@linux.intel.com wrote:
> From: Mengdong Lin <mengdong.lin@linux.intel.com>
>
> This fix is based on Daniel Drake's suggestion: most x86 machines have a
> meaningfull DMI_SYS_VENDOR rather than DMI_BOARD_VENDOR.
>
> So snd_soc_set_dmi_name will try to get vendor name from DMI_SYS_VENDOR
> at first, and if that's null, then use DMI_BOARD_VENDOR.
>
> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
>
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 525f2f3..45f0a34 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1974,7 +1974,9 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour)
> return 0; /* long name already set by driver or from DMI */
>
> /* make up dmi long name as: vendor.product.version.board */
> - vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
> + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
> + if (!vendor)
> + vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
We should also test all of vendor.product.version.board fields for "(To
be filled by OEM)" and "Default String" and limit each field to 20
characters if you want to stick with 80 total (or a smarter rule that
does not truncate a field if there was room saved by the others)
> if (!vendor) {
> dev_warn(card->dev, "ASoC: no DMI vendor name!\n");
> return 0;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: snd_soc_set_dmi_name will use DMI_SYS_VENDOR if available
2017-05-02 10:42 ` Mengdong Lin
@ 2017-05-02 10:41 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2017-05-02 10:41 UTC (permalink / raw)
To: Mengdong Lin
Cc: alsa-devel, mengdong.lin, Pierre-Louis Bossart, liam.r.girdwood,
broonie, pierre-louis.bossart
On Tue, 02 May 2017 12:42:05 +0200,
Mengdong Lin wrote:
>
> Daniel and I have tested this patch on our platforms.
>
> On 04/29/2017 12:40 AM, Pierre-Louis Bossart wrote:
> > On 4/28/17 11:19 AM, mengdong.lin@linux.intel.com wrote:
> >> From: Mengdong Lin <mengdong.lin@linux.intel.com>
> >>
> >> This fix is based on Daniel Drake's suggestion: most x86 machines have a
> >> meaningfull DMI_SYS_VENDOR rather than DMI_BOARD_VENDOR.
> >>
> >> So snd_soc_set_dmi_name will try to get vendor name from DMI_SYS_VENDOR
> >> at first, and if that's null, then use DMI_BOARD_VENDOR.
> >>
> >> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
> >>
> >> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> >> index 525f2f3..45f0a34 100644
> >> --- a/sound/soc/soc-core.c
> >> +++ b/sound/soc/soc-core.c
> >> @@ -1974,7 +1974,9 @@ int snd_soc_set_dmi_name(struct snd_soc_card
> >> *card, const char *flavour)
> >> return 0; /* long name already set by driver or from DMI */
> >>
> >> /* make up dmi long name as: vendor.product.version.board */
> >> - vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
> >> + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
> >> + if (!vendor)
> >> + vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
> >
> > We should also test all of vendor.product.version.board fields for "(To
> > be filled by OEM)" and "Default String" and limit each field to 20
> > characters if you want to stick with 80 total (or a smarter rule that
> > does not truncate a field if there was room saved by the others)
>
> Now the risk on string size seems okay. The maximum size of the
> vendor.product.version.board is about 60 characters found in my test
> for some Lenovo, DELL, ASUS, Minnowboard and Intel machines.
>
> Usually each field has 10 ~ 20 characters. Since it's difficult to
> judge which part in the string is more important, we just copy,
> concatenate and limit the total size of the concatenated string.
> But to save size, we've stripped SPACE characters from each field to
> reduce the string size. And if a DMI field is null, it will be skipped
> without any "Default string".
Well, the two strings, "(To be filled by OEM)" and "Default String",
are known to be bogus, and actually found on many devices with
premature BIOS, so we can safely skip them.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: snd_soc_set_dmi_name will use DMI_SYS_VENDOR if available
2017-04-28 16:40 ` Pierre-Louis Bossart
@ 2017-05-02 10:42 ` Mengdong Lin
2017-05-02 10:41 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Mengdong Lin @ 2017-05-02 10:42 UTC (permalink / raw)
To: Pierre-Louis Bossart, alsa-devel, broonie
Cc: tiwai, liam.r.girdwood, mengdong.lin, pierre-louis.bossart
Daniel and I have tested this patch on our platforms.
On 04/29/2017 12:40 AM, Pierre-Louis Bossart wrote:
> On 4/28/17 11:19 AM, mengdong.lin@linux.intel.com wrote:
>> From: Mengdong Lin <mengdong.lin@linux.intel.com>
>>
>> This fix is based on Daniel Drake's suggestion: most x86 machines have a
>> meaningfull DMI_SYS_VENDOR rather than DMI_BOARD_VENDOR.
>>
>> So snd_soc_set_dmi_name will try to get vendor name from DMI_SYS_VENDOR
>> at first, and if that's null, then use DMI_BOARD_VENDOR.
>>
>> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
>>
>> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
>> index 525f2f3..45f0a34 100644
>> --- a/sound/soc/soc-core.c
>> +++ b/sound/soc/soc-core.c
>> @@ -1974,7 +1974,9 @@ int snd_soc_set_dmi_name(struct snd_soc_card
>> *card, const char *flavour)
>> return 0; /* long name already set by driver or from DMI */
>>
>> /* make up dmi long name as: vendor.product.version.board */
>> - vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
>> + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
>> + if (!vendor)
>> + vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
>
> We should also test all of vendor.product.version.board fields for "(To
> be filled by OEM)" and "Default String" and limit each field to 20
> characters if you want to stick with 80 total (or a smarter rule that
> does not truncate a field if there was room saved by the others)
Now the risk on string size seems okay. The maximum size of the
vendor.product.version.board is about 60 characters found in my test for
some Lenovo, DELL, ASUS, Minnowboard and Intel machines.
Usually each field has 10 ~ 20 characters. Since it's difficult to judge
which part in the string is more important, we just copy, concatenate
and limit the total size of the concatenated string.
But to save size, we've stripped SPACE characters from each field to
reduce the string size. And if a DMI field is null, it will be skipped
without any "Default string".
Thanks
Mengdong
>> if (!vendor) {
>> dev_warn(card->dev, "ASoC: no DMI vendor name!\n");
>> return 0;
>>
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-02 10:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-28 16:19 [PATCH] ASoC: snd_soc_set_dmi_name will use DMI_SYS_VENDOR if available mengdong.lin
2017-04-28 16:40 ` Pierre-Louis Bossart
2017-05-02 10:42 ` Mengdong Lin
2017-05-02 10:41 ` Takashi Iwai
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.