Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751519AbdIRV3c (ORCPT ); Mon, 18 Sep 2017 17:29:32 -0400 Received: from esa8.dell-outbound.iphmx.com ([68.232.149.218]:30214 "EHLO esa8.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbdIRV3a (ORCPT ); Mon, 18 Sep 2017 17:29:30 -0400 From: X-LoopCount0: from 10.166.132.187 X-IronPort-AV: E=Sophos;i="5.42,414,1500958800"; d="scan'208";a="551610527" X-DLP: DLP_GlobalPCIDSS To: , CC: , , , , , Subject: RE: [PATCH] platform/x86: intel-hid: Power button suspend on Dell Latitude 7275 Thread-Topic: [PATCH] platform/x86: intel-hid: Power button suspend on Dell Latitude 7275 Thread-Index: AQHTMAhtgvNy/2FU8keTnAL/0yDRZaK7KcYA Date: Mon, 18 Sep 2017 21:29:06 +0000 Message-ID: <4b5c673c2858470a8b6d0af43a2cd250@ausx13mpc120.AMER.DELL.COM> References: <20170917225712.12136-1-jerome.debretagne@gmail.com> In-Reply-To: <20170917225712.12136-1-jerome.debretagne@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.18.86] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v8ILTba3026016 Content-Length: 2974 Lines: 71 > -----Original Message----- > From: Jérôme de Bretagne [mailto:jerome.debretagne@gmail.com] > Sent: Sunday, September 17, 2017 5:57 PM > To: platform-driver-x86@vger.kernel.org > Cc: Darren Hart ; LKML ; > Linux ACPI ; Rafael J. Wysocki ; > Andy Shevchenko ; Limonciello, Mario > ; Alex Hung > Subject: [PATCH] platform/x86: intel-hid: Power button suspend on Dell Latitude > 7275 > > From: Jérôme de Bretagne > > 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. > They were ignored as the intel-hid driver was not prepared to > take care of them until recently. > > Power button wakeup from suspend-to-idle was added in: > 635173a17b03 ("intel-hid: Wake up Dell Latitude 7275 from > suspend-to-idle"). However power button suspend doesn't work > yet on this platform so it would be good to add it also. > > On the affected platform (for which priv->array is NULL), add > a new upfront check against the power button press notification > (0xCE) to notify_handler(), outside the wakeup mode this time, > which allows to report the power button press event and > trigger the suspend. Also catch and ignore the corresponding > power button release notification (0xCF) to stop it from being > reported as an "unknown event" in the logs. > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=196115 > Tested-by: Jérôme de Bretagne > Signed-off-by: Jérôme de Bretagne > --- > drivers/platform/x86/intel-hid.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c > index a782c78e7c63..b19f8dcf9d8c 100644 > --- a/drivers/platform/x86/intel-hid.c > +++ b/drivers/platform/x86/intel-hid.c > @@ -226,6 +226,22 @@ static void notify_handler(acpi_handle handle, u32 event, > void *context) > return; > } > > + /* > + * Needed for suspend to work on some platforms that don't expose > + * the 5-button array, but still send notifies with power button > + * event code to this device object on power button actions. > + * > + * Report the power button press; catch and ignore the button release. > + */ > + if (!priv->array) { > + if (event == 0xce) { > + input_report_key(priv->input_dev, KEY_POWER, 1); > + input_sync(priv->input_dev); > + return; > + } else if (event == 0xcf) > + return; > + } > + > /* 0xC0 is for HID events, other values are for 5 button array */ > if (event != 0xc0) { > if (!priv->array || LGTM, it's improved from what you posted to that bug already. Acked-By: Mario Limonciello