mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: platform-drivers-x86@vger.kernel.org
Cc: "Darren Hart" <dvhart@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Linux ACPI" <linux-acpi@vger.kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Jérôme de Bretagne" <jerome.debretagne@gmail.com>,
	"Mario Limonciello" <mario.limonciello@dell.com>,
	"Alex Hung" <alex.hung@canonical.com>
Subject: [PATCH] platform/x86: intel-hid: Wake up Dell Latitude 7275 from suspend-to-idle
Date: Fri, 28 Jul 2017 02:06:36 +0200	[thread overview]
Message-ID: <7313224.XbtxUoJtXM@aspire.rjw.lan> (raw)

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

On Dell Latitude 7275 the 5-button array is not exposed in the
ACPI tables, but still notifies are sent to the Intel HID device
object (device ID INT33D5) in response to power button actions while
suspended to idle.  However, they are currently ignored as the
intel-hid driver is not prepared to take care of them.

As a result, power button wakeup from suspend-to-idle doesn't work
on this platform, but suspend-to-idle is the only reliable suspend
variant on it (the S3 implementation in the platform firmware turns
out to be broken), so it would be good to handle it properly.

For this reason, add an upfront check against the power button press
event (0xCE) to notify_handler() in the wakeup mode which allows it
to catch the power button wakeup notification on the affected
platform (even though priv->array is NULL on it) and should not
change the behavior on platforms with priv->array present (because
priv->array contains the event in question in those cases).

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196115
Tested-by: Jérôme de Bretagne <jerome.debretagne@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/platform/x86/intel-hid.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 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
@@ -203,15 +203,26 @@ static void notify_handler(acpi_handle h
 	acpi_status status;
 
 	if (priv->wakeup_mode) {
+		/*
+		 * Needed for wakeup from suspend-to-idle to work on some
+		 * platforms that don't expose the 5-button array, but still
+		 * send notifies with the power button event code to this
+		 * device object on power button actions while suspended.
+		 */
+		if (event == 0xce)
+			goto wakeup;
+
 		/* 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
+		if (!sparse_keymap_entry_from_scancode(priv->array, event)) {
 			dev_info(&device->dev, "unknown event 0x%x\n", event);
+			return;
+		}
 
+wakeup:
+		pm_wakeup_hard_event(&device->dev);
 		return;
 	}
 

             reply	other threads:[~2017-07-28  0:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28  0:06 Rafael J. Wysocki [this message]
2017-07-31 21:46 ` Rafael J. Wysocki
2017-07-31 23:21   ` Andy Shevchenko
2017-08-01 11:56     ` Rafael J. Wysocki
2017-08-01 12:37       ` Andy Shevchenko
2017-08-01 17:04         ` Mario.Limonciello
2017-08-02  9:07           ` Jérôme de Bretagne

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=7313224.XbtxUoJtXM@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=alex.hung@canonical.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dvhart@infradead.org \
    --cc=jerome.debretagne@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@dell.com \
    --cc=platform-drivers-x86@vger.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

all inboxes | Powered by JetHome®