From patchwork Tue Apr 4 08:50:12 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: 9660975 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 D3A3B602B9 for ; Tue, 4 Apr 2017 08:51:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C89C328425 for ; Tue, 4 Apr 2017 08:51:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDA47284D1; Tue, 4 Apr 2017 08:51:40 +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 631B028425 for ; Tue, 4 Apr 2017 08:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752218AbdDDIvh (ORCPT ); Tue, 4 Apr 2017 04:51:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbdDDIuT (ORCPT ); Tue, 4 Apr 2017 04:50:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0AE627E9D0; Tue, 4 Apr 2017 08:50:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0AE627E9D0 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=hdegoede@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0AE627E9D0 Received: from shalem.localdomain.com (unknown [10.36.118.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD7739100E; Tue, 4 Apr 2017 08:50:17 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson Cc: Hans de Goede , Takashi Iwai , linux-mmc@vger.kernel.org Subject: [PATCH 2/3] mmc: sdhci-acpi: Add fix_up_power module option Date: Tue, 4 Apr 2017 10:50:12 +0200 Message-Id: <20170404085013.19837-3-hdegoede@redhat.com> In-Reply-To: <20170404085013.19837-1-hdegoede@redhat.com> References: <20170404085013.19837-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 04 Apr 2017 08:50:19 +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 GPDwin mini clam-shell PC which has a pcie 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). This commit adds a new sdhci_acpi.fix_up_power module option which defaults to 1 (leaving the existing behavior intact) and can be set to 0 disable the calling of acpi_device_fix_up_power() fixing the wifi not working on this machine. Signed-off-by: Hans de Goede --- drivers/mmc/host/sdhci-acpi.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 9fd8d7a..8fe46ba 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -83,6 +83,8 @@ struct sdhci_acpi_host { bool use_runtime_pm; }; +static int fix_up_power = 1; + static inline bool sdhci_acpi_flag(struct sdhci_acpi_host *c, unsigned int flag) { return c->slot && (c->slot->flags & flag); @@ -394,10 +396,12 @@ static int sdhci_acpi_probe(struct platform_device *pdev) return -ENODEV; /* Power on the SDHCI controller and its children */ - acpi_device_fix_up_power(device); - list_for_each_entry(child, &device->children, node) - if (child->status.present && child->status.enabled) - acpi_device_fix_up_power(child); + if (fix_up_power) { + acpi_device_fix_up_power(device); + list_for_each_entry(child, &device->children, node) + if (child->status.present && child->status.enabled) + acpi_device_fix_up_power(child); + } if (sdhci_acpi_byt_defer(dev)) return -EPROBE_DEFER; @@ -575,6 +579,10 @@ static struct platform_driver sdhci_acpi_driver = { module_platform_driver(sdhci_acpi_driver); +module_param(fix_up_power, int, 0444); +MODULE_PARM_DESC(fix_up_power, + "Call acpi_device_fix_up_power on sdio host and its children"); + MODULE_DESCRIPTION("Secure Digital Host Controller Interface ACPI driver"); MODULE_AUTHOR("Adrian Hunter"); MODULE_LICENSE("GPL v2");