From patchwork Fri Apr 21 10:08:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 9692373 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 7331260328 for ; Fri, 21 Apr 2017 10:14:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66EFF2861A for ; Fri, 21 Apr 2017 10:14:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BAB92861E; Fri, 21 Apr 2017 10:14:01 +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 0C2A32861A for ; Fri, 21 Apr 2017 10:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1037821AbdDUKN7 (ORCPT ); Fri, 21 Apr 2017 06:13:59 -0400 Received: from mga02.intel.com ([134.134.136.20]:46651 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1037819AbdDUKN5 (ORCPT ); Fri, 21 Apr 2017 06:13:57 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Apr 2017 03:13:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,229,1488873600"; d="scan'208";a="848353379" Received: from ahunter-desktop.fi.intel.com ([10.237.72.168]) by FMSMGA003.fm.intel.com with ESMTP; 21 Apr 2017 03:13:54 -0700 From: Adrian Hunter To: Ulf Hansson Cc: linux-mmc , linux-pm , linux-acpi , "Rafael J. Wysocki" Subject: [PATCH RFC 3/4] mmc: sdhci-acpi: Set MMC_CAP2_NO_SDIO_RESET if child has wake from S4 (hibernate) Date: Fri, 21 Apr 2017 13:08:07 +0300 Message-Id: <1492769288-7474-4-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492769288-7474-1-git-send-email-adrian.hunter@intel.com> References: <1492769288-7474-1-git-send-email-adrian.hunter@intel.com> 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 SDIO reset interferes with a SDIO function driver's restore from hibernation. Set MMC_CAP2_NO_SDIO_RESET if a child node has _S4W method which indicates a capability to wake from S4 (hibernate). Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci-acpi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index c6a9a1bfaa22..e053a45db6b1 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -374,6 +374,14 @@ static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid, return NULL; } +static bool sdhci_acpi_child_has_s4w(struct acpi_device *child) +{ + acpi_handle handle = child->handle; + unsigned long long ret; + + return ACPI_SUCCESS(acpi_evaluate_integer(handle, "_S4W", NULL, &ret)); +} + static int sdhci_acpi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -382,6 +390,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev) struct sdhci_acpi_host *c; struct sdhci_host *host; struct resource *iomem; + bool child_has_s4w = false; resource_size_t len; const char *hid; const char *uid; @@ -393,8 +402,11 @@ static int sdhci_acpi_probe(struct platform_device *pdev) /* 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) + if (child->status.present && child->status.enabled) { acpi_device_fix_up_power(child); + if (sdhci_acpi_child_has_s4w(child)) + child_has_s4w = true; + } if (acpi_bus_get_status(device) || !device->status.present) return -ENODEV; @@ -439,6 +451,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) goto err_free; } + if (child_has_s4w) + host->mmc->caps2 |= MMC_CAP2_NO_SDIO_RESET; + if (c->slot) { if (c->slot->probe_slot) { err = c->slot->probe_slot(pdev, hid, uid);