From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Subject: [PATCH v2 3/3] mmc: sdhci-acpi: Add DMI fix_up_power_blacklist Date: Wed, 5 Apr 2017 15:00:07 +0200 Message-ID: <20170405130007.5826-3-hdegoede@redhat.com> References: <20170405130007.5826-1-hdegoede@redhat.com> Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50400 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933175AbdDENAU (ORCPT ); Wed, 5 Apr 2017 09:00:20 -0400 In-Reply-To: <20170405130007.5826-1-hdegoede@redhat.com> Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-mmc@vger.kernel.org To: Adrian Hunter , Ulf Hansson Cc: Hans de Goede , Takashi Iwai , linux-mmc@vger.kernel.org Add a DMI based blacklist for systems where calling acpi_device_fix_up_power() is harmful. Signed-off-by: Hans de Goede --- Changes in v2: -Adjust for changes in mmc: sdhci-acpi: Add fix_up_power_blacklist module option -Only use a single fix_up_power_dmi_blacklist for the GPDwin further testing has shown that the DMI strings are unique enough that we do not need the bios-date in there --- drivers/mmc/host/sdhci-acpi.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 5a73174..ba9e688 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -384,6 +385,27 @@ static const struct acpi_device_id sdhci_acpi_ids[] = { }; MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); +static const struct dmi_system_id fix_up_power_dmi_blacklist[] = { + { + /* + * Match for the GPDwin which unfortunately uses somewhat + * generic dmi strings, which is why we test for 4 strings. + * Comparing against 15 other byt/cht boards, board_vendor + * and board_name are unique to the GPDwin, where as only one + * other board has the same board_serial and 2 others have + * the same default product_name. + */ + .driver_data = "80860F14:2", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), + DMI_MATCH(DMI_BOARD_NAME, "Default string"), + DMI_MATCH(DMI_BOARD_SERIAL, "Default string"), + DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), + }, + }, + { } +}; + static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid, const char *uid) { @@ -407,6 +429,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev) const char *fix_up_power_bl = fix_up_power_blacklist; bool fix_up_power = true; struct acpi_device *device, *child; + const struct dmi_system_id *dmi_id; struct sdhci_acpi_host *c; struct sdhci_host *host; struct resource *iomem; @@ -421,6 +444,12 @@ static int sdhci_acpi_probe(struct platform_device *pdev) hid = acpi_device_hid(device); uid = device->pnp.unique_id; + if (!fix_up_power_bl) { + dmi_id = dmi_first_match(fix_up_power_dmi_blacklist); + if (dmi_id) + fix_up_power_bl = dmi_id->driver_data; + } + if (sdhci_acpi_compare_hid_uid(fix_up_power_bl, hid, uid)) fix_up_power = false; -- 2.9.3