From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Dmitry Torokhov <dtor@chromium.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Benson Leung <bleung@chromium.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ACPI: do not fail suspend if unable to configure wakeup
Date: Wed, 19 Nov 2014 00:43:51 +0100 [thread overview]
Message-ID: <2163272.NHMRkNIupX@vostro.rjw.lan> (raw)
In-Reply-To: <CAE_wzQ8FTtnMGTxyaFu8=QqyuD0=W_ZyWXCf9_BK1sWKZHh95g@mail.gmail.com>
On Tuesday, November 18, 2014 10:00:53 AM Dmitry Torokhov wrote:
> Hi Rafael,
>
> On Thu, Oct 16, 2014 at 9:05 AM, Dmitry Torokhov <dtor@chromium.org> wrote:
> > Hi Rafael,
> >
> > On Thu, Oct 16, 2014 at 10:10:20AM +0200, Rafael J. Wysocki wrote:
> >> Hi,
> >>
> >> On Thu, Oct 16, 2014 at 12:56 AM, Dmitry Torokhov <dtor@chromium.org> wrote:
> >> > 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 <bleung@chromium.org>
> >> > Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
> >> > ---
> >> > 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) {
> >>
> >> I think we just need to return an error code in that case, because otherwise
> >
> > We used to return error and that error aborted the suspend altogether,
> > which prompted creating this patch.
> >
> >> this is potentially dangerous (worst case, it may be impossible to wake up
> >> the machine at all after that).
> >
> > Yes, there is such potential, but that kind of error (no working wakeup
> > sources) will be discovered before a box is shipped. Right now we have
> > boxes in the wild that suspend fine with 3.10 and refuse to suspend with
> > 3.14 because between 3.10 and 3.14 we started placing i2c devices with
> > ACPI companions into ACPI power domain and ACPI power domain is now
> > trying to configure them as wakeup sources and fails.
>
> A gentle ping on the patch - without it (or something else) we basically
> have a regression on shipped hardware: Chromebooks that were
> suspending fine with 3.10 refuse to suspend with 3.14.
It fell of my radar, sorry about that.
So the error here is that device_may_wakeup(dev) returns true, because the
device is technically wakeup-capable, but the wakeup is not via ACPI?
I'd say this is rather not in accordance with the spec, but that means we
need to simply ignore 'wakeup' if acpi_device_can_wakeup(adev) returns false.
So what about the appended patch?
Rafael
---
drivers/acpi/device_pm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
--- linux-pm.orig/drivers/acpi/device_pm.c
+++ linux-pm/drivers/acpi/device_pm.c
@@ -878,7 +878,7 @@ int acpi_dev_suspend_late(struct device
return 0;
target_state = acpi_target_system_state();
- wakeup = device_may_wakeup(dev);
+ wakeup = device_may_wakeup(dev) && acpi_device_can_wakeup(adev);
error = acpi_device_wakeup(adev, target_state, wakeup);
if (wakeup && error)
return error;
next prev parent reply other threads:[~2014-11-18 23:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 22:56 [PATCH] ACPI: do not fail suspend if unable to configure wakeup Dmitry Torokhov
2014-10-16 8:10 ` Rafael J. Wysocki
2014-10-16 16:05 ` Dmitry Torokhov
2014-11-18 18:00 ` Dmitry Torokhov
2014-11-18 23:43 ` Rafael J. Wysocki [this message]
2014-11-18 23:31 ` Dmitry Torokhov
2014-11-19 0:00 ` Rafael J. Wysocki
2014-11-19 0:20 ` Rafael J. Wysocki
2014-11-19 0:14 ` Dmitry Torokhov
2014-11-19 1:01 ` Rafael J. Wysocki
2014-11-19 0:48 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2163272.NHMRkNIupX@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=bleung@chromium.org \
--cc=dtor@chromium.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox