Re: [PATCH 1/3] firmware: dmi_scan: Add dmi_product_name kernel cmdline option

From: Hans de Goede
Date: Tue Apr 04 2017 - 06:21:53 EST


Hi,

On 09-03-17 11:43, Hans de Goede wrote:
Hi,

On 09-03-17 10:59, Jean Delvare wrote:

<snip>

So I would really like to see support for this kernel cmdline option merged.
Takashi Iwai has been working on some quirks for headphone detection for
the GPDwin machine, which also rely on being able to use a fake dmi_id to
identify the machine.

I'll discuss that with Takashi when he returns from vacation.

Ok, lets wait for that then.

So Takashi is back (and has responded) but in the mean time
I've been thinking about this and tried to find a better solution
as I really want the kernel to do the right thing automatically.

So I've been dumping all the /sys/class/dmi/id strings on all
Bay Trail and Cherry Trail devices I've (7 different models)
and seeing if anything stands out.

The GPDwin for which I mainly wrote this patch is the only
one to set board_vendor to "AMI Corporation", which is a
string one would usually expect in bios_vendor. So I decided
that we can use normal DMI matching for this after all,
to play things safe I've also added a check for the bios_date
(which should be reasonable unique) + 2 other strings,
resulting in:

+static const struct dmi_system_id fix_up_power_blacklist[] = {
+ {
+ /*
+ * Match for the GPDwin which unfortunately uses somewhat
+ * generic dmi strings, which is why the bios-date match is
+ * included and we need multiple entries :| These strings have
+ * been checked against 6 other byt/cht boards and board_vendor
+ * and board_name are unique to the GPDwin (in the test set)
+ * where as only one other board has the same board_version.
+ */
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
+ DMI_MATCH(DMI_BOARD_NAME, "Default string"),
+ DMI_MATCH(DMI_BOARD_VERSION, "Default string"),
+ DMI_MATCH(DMI_BIOS_DATE, "10/25/2016"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
+ DMI_MATCH(DMI_BOARD_NAME, "Default string"),
+ DMI_MATCH(DMI_BOARD_VERSION, "Default string"),
+ DMI_MATCH(DMI_BIOS_DATE, "11/18/2016"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
+ DMI_MATCH(DMI_BOARD_NAME, "Default string"),
+ DMI_MATCH(DMI_BOARD_VERSION, "Default string"),
+ DMI_MATCH(DMI_BIOS_DATE, "02/21/2017"),
+ },
+ },
+ { }
+};

Which is not the prettiest but gets the job done and has the big
advantage over my dmi_product_name kernel cmdline option proposal
that it will just work. So you can consider this patch dropped
from my pov.

Regards,

Hans