From patchwork Wed Apr 12 18:19:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9678145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A70AA60383 for ; Wed, 12 Apr 2017 18:19:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DCF828622 for ; Wed, 12 Apr 2017 18:19:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9286C28694; Wed, 12 Apr 2017 18:19:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CDFF28622 for ; Wed, 12 Apr 2017 18:19:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752372AbdDLST0 (ORCPT ); Wed, 12 Apr 2017 14:19:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54208 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbdDLST0 (ORCPT ); Wed, 12 Apr 2017 14:19:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FCF03B708; Wed, 12 Apr 2017 18:19:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9FCF03B708 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=hdegoede@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9FCF03B708 Received: from shalem.localdomain.com (ovpn-116-234.ams2.redhat.com [10.36.116.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id 738B8173C6; Wed, 12 Apr 2017 18:19:24 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson Cc: Hans de Goede , Takashi Iwai , linux-mmc@vger.kernel.org Subject: [PATCH v3 2/3] mmc: sdhci-acpi: Add blacklist module option Date: Wed, 12 Apr 2017 20:19:21 +0200 Message-Id: <20170412181922.31833-2-hdegoede@redhat.com> In-Reply-To: <20170412181922.31833-1-hdegoede@redhat.com> References: <20170412181922.31833-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 12 Apr 2017 18:19:25 +0000 (UTC) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when probing") introduced unconditional calling of acpi_device_fix_up_power() on the mmc controller and its children. This broke wifi on some systems because acpi_device_fix_up_power() was called even for disabled children sometimes leaving gpio-s in a state where wifi would not work, this was fixed in commit e1d070c3793a ("mmc: sdhci-acpi: Only powered up enabled acpi child devices"). Unfortunately on some devices calling acpi_device_fix_up_power() still causes issues. Specifically on the GPD-win mini clam-shell PC which has a pci-e wifi module, it causes the wifi module to get turned off. This is a BIOS bug and I've tried to get the manufacturer to fix this but sofar they have not responded (and even if they do then we cannot assume all users will update their BIOS). Since the GPD-win uses a pci-e wifi module the sdhci controller for sdio cards really should not get initialized on it at all. This commit adds a new sdhci_acpi.blacklist module option which can be set to an ACPI hid:uid pair, e.g. "80860F14:2" to disable probing for the sdhci host matching the hid:uid pair, fixing the wifi not working on this machine. Signed-off-by: Hans de Goede --- Changes in v2: -Make the module option take a hid:uid pair string, instead of it being a boolean option, so that it only applies to one host Changes in v3: -Make the module option skip probing the device entirely (return -ENODEV) --- drivers/mmc/host/sdhci-acpi.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 9fd8d7a..42bbc9a 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -83,6 +83,29 @@ struct sdhci_acpi_host { bool use_runtime_pm; }; +static char *blacklist; + +static bool sdhci_acpi_compare_hid_uid(const char *match, const char *hid, + const char *uid) +{ + const char *sep; + + if (!match) + return false; + + sep = strchr(match, ':'); + if (!match) + return false; + + if (strncmp(match, hid, sep - match)) + return false; + + if (strcmp(sep + 1, uid)) + return false; + + return true; +} + static inline bool sdhci_acpi_flag(struct sdhci_acpi_host *c, unsigned int flag) { return c->slot && (c->slot->flags & flag); @@ -381,6 +404,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; acpi_handle handle = ACPI_HANDLE(dev); + const char *bl = blacklist; struct acpi_device *device, *child; struct sdhci_acpi_host *c; struct sdhci_host *host; @@ -393,6 +417,12 @@ static int sdhci_acpi_probe(struct platform_device *pdev) if (acpi_bus_get_device(handle, &device)) return -ENODEV; + hid = acpi_device_hid(device); + uid = device->pnp.unique_id; + + if (sdhci_acpi_compare_hid_uid(bl, hid, uid)) + return -ENODEV; + /* Power on the SDHCI controller and its children */ acpi_device_fix_up_power(device); list_for_each_entry(child, &device->children, node) @@ -402,9 +432,6 @@ static int sdhci_acpi_probe(struct platform_device *pdev) if (sdhci_acpi_byt_defer(dev)) return -EPROBE_DEFER; - hid = acpi_device_hid(device); - uid = device->pnp.unique_id; - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!iomem) return -ENOMEM; @@ -575,6 +602,9 @@ static struct platform_driver sdhci_acpi_driver = { module_platform_driver(sdhci_acpi_driver); +module_param(blacklist, charp, 0444); +MODULE_PARM_DESC(blacklist, "ACPI which should be ignored"); + MODULE_DESCRIPTION("Secure Digital Host Controller Interface ACPI driver"); MODULE_AUTHOR("Adrian Hunter"); MODULE_LICENSE("GPL v2");