From patchwork Wed Oct 15 22:56:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5087411 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C1B9CC11AC for ; Wed, 15 Oct 2014 22:57:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D95CD2013A for ; Wed, 15 Oct 2014 22:57:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECBDF20138 for ; Wed, 15 Oct 2014 22:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751116AbaJOW5B (ORCPT ); Wed, 15 Oct 2014 18:57:01 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:50072 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750721AbaJOW5A (ORCPT ); Wed, 15 Oct 2014 18:57:00 -0400 Received: by mail-pa0-f51.google.com with SMTP id lj1so2185655pab.10 for ; Wed, 15 Oct 2014 15:57:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=TySL0d8JXrU7sznJTTbr9rXziKthAb3ZYsUzE8wgwbc=; b=TXBAMhgg1fQ/+EuzkJikWuxu72UzeqG2PMWOI149UE5HR0mfncCaOz2Xf2Pq5BQp+6 Hi/8nWOwuVifjGfVWRMrUHqmgt0sU4fJZaXIoFg6YFeVkJ5IDD6nOLQVEdqNBKQaCprK IIvnM3Y4uVPuhzU+u6upRJK7ora666/V1aVky2EQ529fObaTdph2bG8hIGVVXmm+ceSV EHv0RG2vkThZgsf1KIrS1ovn5fw4tYVCF7AC1q2cuhEJACeRgiyekKhdejHOyV2rklBi sqTVW/biHCtYcMhPZjIFdjXKQpAr34kWWb4PzvWqFGUy2G3a7H5sLVpJjLtTOYmYqeWt 23bQ== X-Gm-Message-State: ALoCoQmoJ0t585PgTl3HoDdWQ+8jo54/aANl29PUKqFPyabGYJn+v0EcoY9haRE1MP0fGe8YOJhB X-Received: by 10.66.218.42 with SMTP id pd10mr5534633pac.151.1413413819997; Wed, 15 Oct 2014 15:56:59 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1301:10ef:7b36:434e:6d93]) by mx.google.com with ESMTPSA id ty8sm18220547pab.26.2014.10.15.15.56.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 15 Oct 2014 15:56:59 -0700 (PDT) Date: Wed, 15 Oct 2014 15:56:57 -0700 From: Dmitry Torokhov To: "Rafael J. Wysocki" Cc: Benson Leung , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ACPI: do not fail suspend if unable to configure wakeup Message-ID: <20141015225657.GA818@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Newer kernels put i2c devices with ACPI companion in ACPI power domain and then ACPI will try to configure them for wakeup (if requested). Unfortunately on some Chromebooks firmware separates wakeup GPIO into a completely separate device (which is handled by the kernel as a sleep button), leaving the touchpads themselves not wakeup capable (as far as ACPI is concerned). This causes ACPI late suspend code to fail to configure them as wakeup sources and aborts entire suspend. To work around this issues let's not abort entire suspend process if driver asked to be a wakeup source but ACPI can not satisfy that request. Note that originally I tried to simply change the driver to not mark device as wakeup source, unfortunately then we do not know that we should not be powering down the device completely, otherwise we can't wake up. Verified by making sure that "echo mem > /sys/power/state" works on Squawks. Reviewed-by: Benson Leung Signed-off-by: Dmitry Torokhov --- drivers/acpi/device_pm.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 67075f8..440bc3d 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -871,6 +871,7 @@ int acpi_dev_suspend_late(struct device *dev) struct acpi_device *adev = ACPI_COMPANION(dev); u32 target_state; bool wakeup; + bool can_wakeup; int error; if (!adev) @@ -878,12 +879,19 @@ int acpi_dev_suspend_late(struct device *dev) target_state = acpi_target_system_state(); wakeup = device_may_wakeup(dev); - error = acpi_device_wakeup(adev, target_state, wakeup); - if (wakeup && error) - return error; + can_wakeup = acpi_device_can_wakeup(adev); + + if (can_wakeup) { + error = acpi_device_wakeup(adev, target_state, wakeup); + if (wakeup && error) + return error; + } else if (wakeup) { + dev_warn(dev, + "device is not wakeup-capable, not enabling wakeup\n"); + } error = acpi_dev_pm_low_power(dev, adev, target_state); - if (error) + if (error && can_wakeup) acpi_device_wakeup(adev, ACPI_STATE_UNKNOWN, false); return error;