Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1669998 > unrolled thread

[PATCH v2 0/3] ACPI / sleep: Support power button wakeup from S2I on recent Dell laptops

Started by"Rafael J. Wysocki" <rjw@rjwysocki.net>
First post2017-06-20 00:10 +0200
Last post2017-06-20 00:10 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 0/3] ACPI / sleep: Support power button wakeup from S2I on recent Dell laptops "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-06-20 00:10 +0200
    [PATCH v2 2/3] platform: x86: intel-hid: Wake up the system from suspend-to-idle "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-06-20 00:10 +0200

#1669998 — [PATCH v2 0/3] ACPI / sleep: Support power button wakeup from S2I on recent Dell laptops

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-06-20 00:10 +0200
Subject[PATCH v2 0/3] ACPI / sleep: Support power button wakeup from S2I on recent Dell laptops
Message-ID<tUd1U-8vL-7@gated-at.bofh.it>
Hi All,

On Thursday, June 01, 2017 01:23:43 AM Rafael J. Wysocki wrote:
> 
> This is a follow-up for a patch series posted some time ago:
> 
> http://marc.info/?l=linux-kernel&m=149324246701378&w=2
> 
> The first two patches from that series are in 4.12-rc already and the rest
> have been rearranged.

Here's a v2 of the above.

The first two patches are actually the same as before, only with ACKs from Andy.

The third patch is almost the same, but it adds a new command line switch to
go back to the semi-functional power button wakeup from s2idle if someone
really wants that.

> The issue at hand is still the same as before:
> 
> On Wednesday, April 26, 2017 11:21:11 PM Rafael J. Wysocki wrote:
> >
> > The underlying issue is that on some relatively new Dell laltops, including
> > Dell XPS13 9360 and 9365, pressing the power button is not sufficient to
> > wake up the system from suspend-to-idle (it has to be pressed and held
> > down for around 5 sec for the wakeup to happen) which is not expected
> > and does not match the Windows' behavior.
> > 
> > This turns out to be a consequence of the way power button events are signaled
> > on those systems, which is through the Embedded Controller (EC).  Namely,
> > button events go to the EC which then signals the event through its ACPI GPE
> > (General Purpose Event), which triggers an ACPI SCI (System Control Interrupt),
> > whose handler executes a specicif AML control method and triggers a Notify()
> > targetting a devie object associated with the power button.  The problem with
> > suspend-to-idle is that the EC GPE is disabled during suspend, because
> > otherwise all EC events would wake up the system from suspend-to-idle (and
> > there can be many of them).
> 
> The first two patches in the current series  update the drivers used for button
> events processing on the affected systems so that they signal wakeup as
> expected and avoid propagating the wakeup events as button events to user
> space.
> 
> The third patch allows the EC GPE to become a wakeup GPE on the affected Dell
> laptops and finally makes power button events wake up those systems from
> suspend-to-idle.
> 
> After this series there still is a concern regarding the possible increase of
> power draw that may result from the processing of non-wakeup EC events while
> suspended which is why the change only affects Dell XPS13 9360 and 9365
> for now.
> 
> There is no code dependency between patches [1-2/3] and patch [3/3], but all
> of them together are necessary for the feature in question to work on both the
> affected systems, so IMO they should be applied together.

The series is based on current linux-next.  It is available from a git branch at

  git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git s2idle-dell-test

and has been included into the testing branch thereof.
  
If there are any concerns regarding this series, please let me know.

Thanks,
Rafael

[toc] | [next] | [standalone]


#1669999 — [PATCH v2 2/3] platform: x86: intel-hid: Wake up the system from suspend-to-idle

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-06-20 00:10 +0200
Subject[PATCH v2 2/3] platform: x86: intel-hid: Wake up the system from suspend-to-idle
Message-ID<tUd1V-8vL-35@gated-at.bofh.it>
In reply to#1669998
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Allow the intel-hid driver to wake up the system from suspend-to-idle
by configuring its platform device as a wakeup one by default and
switching it over to a system wakeup events triggering mode during
system suspend transitions.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

-> v2: Added tag.

---
 drivers/platform/x86/intel-hid.c |   40 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)

Index: linux-pm/drivers/platform/x86/intel-hid.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/intel-hid.c
+++ linux-pm/drivers/platform/x86/intel-hid.c
@@ -23,6 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/input/sparse-keymap.h>
 #include <linux/acpi.h>
+#include <linux/suspend.h>
 #include <acpi/acpi_bus.h>
 
 MODULE_LICENSE("GPL");
@@ -75,6 +76,7 @@ static const struct key_entry intel_arra
 struct intel_hid_priv {
 	struct input_dev *input_dev;
 	struct input_dev *array;
+	bool wakeup_mode;
 };
 
 static int intel_hid_set_enable(struct device *device, bool enable)
@@ -116,23 +118,37 @@ static void intel_button_array_enable(st
 		dev_warn(device, "failed to set button capability\n");
 }
 
-static int intel_hid_pl_suspend_handler(struct device *device)
+static int intel_hid_pm_prepare(struct device *device)
 {
-	intel_hid_set_enable(device, false);
-	intel_button_array_enable(device, false);
+	struct intel_hid_priv *priv = dev_get_drvdata(device);
+
+	priv->wakeup_mode = true;
+	return 0;
+}
 
+static int intel_hid_pl_suspend_handler(struct device *device)
+{
+	if (pm_suspend_via_firmware()) {
+		intel_hid_set_enable(device, false);
+		intel_button_array_enable(device, false);
+	}
 	return 0;
 }
 
 static int intel_hid_pl_resume_handler(struct device *device)
 {
-	intel_hid_set_enable(device, true);
-	intel_button_array_enable(device, true);
+	struct intel_hid_priv *priv = dev_get_drvdata(device);
 
+	priv->wakeup_mode = false;
+	if (pm_resume_via_firmware()) {
+		intel_hid_set_enable(device, true);
+		intel_button_array_enable(device, true);
+	}
 	return 0;
 }
 
 static const struct dev_pm_ops intel_hid_pl_pm_ops = {
+	.prepare = intel_hid_pm_prepare,
 	.freeze  = intel_hid_pl_suspend_handler,
 	.thaw  = intel_hid_pl_resume_handler,
 	.restore  = intel_hid_pl_resume_handler,
@@ -186,6 +202,19 @@ static void notify_handler(acpi_handle h
 	unsigned long long ev_index;
 	acpi_status status;
 
+	if (priv->wakeup_mode) {
+		/* Wake up on 5-button array events only. */
+		if (event == 0xc0 || !priv->array)
+			return;
+
+		if (sparse_keymap_entry_from_scancode(priv->array, event))
+			pm_wakeup_hard_event(&device->dev);
+		else
+			dev_info(&device->dev, "unknown event 0x%x\n", event);
+
+		return;
+	}
+
 	/* 0xC0 is for HID events, other values are for 5 button array */
 	if (event != 0xc0) {
 		if (!priv->array ||
@@ -270,6 +299,7 @@ static int intel_hid_probe(struct platfo
 				 "failed to enable HID power button\n");
 	}
 
+	device_init_wakeup(&device->dev, true);
 	return 0;
 
 err_remove_notify:

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web