All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Takashi Iwai <tiwai@suse.de>,
	russianneuromancer@ya.ru, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH 1/3] firmware: dmi_scan: Add dmi_product_name kernel cmdline option
Date: Tue, 4 Apr 2017 12:21:42 +0200	[thread overview]
Message-ID: <d934d06c-5bc7-6eb3-52c3-807bd82609ad@redhat.com> (raw)
In-Reply-To: <5dd43c51-789b-2e73-4e6c-9527a6806c33@redhat.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Hans de Goede <hdegoede@redhat.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Takashi Iwai <tiwai@suse.de>,
	russianneuromancer@ya.ru, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.orgTakashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH 1/3] firmware: dmi_scan: Add dmi_product_name kernel cmdline option
Date: Tue, 4 Apr 2017 12:21:42 +0200	[thread overview]
Message-ID: <d934d06c-5bc7-6eb3-52c3-807bd82609ad@redhat.com> (raw)
In-Reply-To: <5dd43c51-789b-2e73-4e6c-9527a6806c33@redhat.com>

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

  parent reply	other threads:[~2017-04-04 10:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 17:23 [PATCH 0/3] Allow setting dmi-product-name on the cmdline + dmi sdhci quirk Hans de Goede
2017-02-25 17:23 ` [PATCH 1/3] firmware: dmi_scan: Add dmi_product_name kernel cmdline option Hans de Goede
2017-03-03  9:24   ` Jean Delvare
2017-03-03 14:27     ` Hans de Goede
2017-03-09  9:59       ` Jean Delvare
2017-03-09 10:43         ` Hans de Goede
2017-03-20 17:35           ` Takashi Iwai
2017-04-04 10:21           ` Hans de Goede [this message]
2017-04-04 10:21             ` Hans de Goede
2017-02-25 17:23 ` [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power() Hans de Goede
2017-02-25 18:31   ` Hans de Goede
2017-03-02 11:53   ` Adrian Hunter
2017-03-03  9:09   ` Jean Delvare
2017-03-03 13:59     ` Hans de Goede
2017-02-25 17:23 ` [PATCH 3/3] mmc: sdhci-acpi: Add a quirk to not break wifi on GPD WIN I55 machines Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d934d06c-5bc7-6eb3-52c3-807bd82609ad@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=jdelvare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=russianneuromancer@ya.ru \
    --cc=tiwai@suse.de \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.