Message ID | 20170917225712.12136-1-jerome.debretagne@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBKw6lyw7RtZSBkZSBCcmV0YWdu ZSBbbWFpbHRvOmplcm9tZS5kZWJyZXRhZ25lQGdtYWlsLmNvbV0NCj4gU2VudDogU3VuZGF5LCBT ZXB0ZW1iZXIgMTcsIDIwMTcgNTo1NyBQTQ0KPiBUbzogcGxhdGZvcm0tZHJpdmVyLXg4NkB2Z2Vy Lmtlcm5lbC5vcmcNCj4gQ2M6IERhcnJlbiBIYXJ0IDxkdmhhcnRAaW5mcmFkZWFkLm9yZz47IExL TUwgPGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc+Ow0KPiBMaW51eCBBQ1BJIDxsaW51eC1h Y3BpQHZnZXIua2VybmVsLm9yZz47IFJhZmFlbCBKLiBXeXNvY2tpIDxyandAcmp3eXNvY2tpLm5l dD47DQo+IEFuZHkgU2hldmNoZW5rbyA8YW5keS5zaGV2Y2hlbmtvQGdtYWlsLmNvbT47IExpbW9u Y2llbGxvLCBNYXJpbw0KPiA8TWFyaW9fTGltb25jaWVsbG9ARGVsbC5jb20+OyBBbGV4IEh1bmcg PGFsZXguaHVuZ0BjYW5vbmljYWwuY29tPg0KPiBTdWJqZWN0OiBbUEFUQ0hdIHBsYXRmb3JtL3g4 NjogaW50ZWwtaGlkOiBQb3dlciBidXR0b24gc3VzcGVuZCBvbiBEZWxsIExhdGl0dWRlDQo+IDcy NzUNCj4gDQo+IEZyb206IErDqXLDtG1lIGRlIEJyZXRhZ25lIDxqZXJvbWUuZGVicmV0YWduZUBn bWFpbC5jb20+DQo+IA0KPiBPbiBEZWxsIExhdGl0dWRlIDcyNzUgdGhlIDUtYnV0dG9uIGFycmF5 IGlzIG5vdCBleHBvc2VkIGluIHRoZQ0KPiBBQ1BJIHRhYmxlcywgYnV0IHN0aWxsI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29tZSBwbGF0Zm9ybXMgdGhhdCBk b24ndCBleHBvc2UNCj4gKwkgKiB0aGUgNS1idXR0b24gYXJyYXksIGJ1dCBzdGlsbCBzZW5kIG5v dGlmaWVzIHdpdGggcG93ZXIgYnV0dG9uDQo+ICsJICogZXZlbnQgY29kZSB0byB0aGlzIGRldmlj ZSBvYmplY3Qgb24gcG93ZXIgYnV0dG9uIGFjdGlvbnMuDQo+ICsJICoNCj4gKwkgKiBSZXBvcnQg dGhlIHBvd2VyIGJ1dHRvbiBwcmVzczsgY2F0Y2ggYW5kIGlnbm9yZSB0aGUgYnV0dG9uIHJlbGVh c2UuDQo+ICsJICovDQo+ICsJaWYgKCFwcml2LT5hcnJheSkgew0KPiArCQlpZiAoZXZlbnQgPT0g MHhjZSkgew0KPiArCQkJaW5wdXRfcmVwb3J0X2tleShwcml2LT5pbnB1dF9kZXYsIEtFWV9QT1dF UiwgMSk7DQo+ICsJCQlpbnB1dF9zeW5jKHByaXYtPmlucHV0X2Rldik7DQo+ICsJCQlyZXR1cm47 DQo+ICsJCX0gZWxzZSBpZiAoZXZlbnQgPT0gMHhjZikNCj4gKwkJCXJldHVybjsNCj4gKwl9DQo+ ICsNCj4gIAkvKiAweEMwIGlzIGZvciBISUQgZXZlbnRzLCBvdGhlciB2YWx1ZXMgYXJlIGZvciA1 IGJ1dHRvbiBhcnJheSAqLw0KPiAgCWlmIChldmVudCAhPSAweGMwKSB7DQo+ICAJCWlmICghcHJp di0+YXJyYXkgfHwNCg0KTEdUTSwgaXQncyBpbXByb3ZlZCBmcm9tIHdoYXQgeW91IHBvc3RlZCB0 byB0aGF0IGJ1ZyBhbHJlYWR5Lg0KDQpBY2tlZC1CeTogTWFyaW8gTGltb25jaWVsbG8gPG1hcmlv LmxpbW9uY2llbGxvQGRlbGwuY29tPg0K -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2017-09-18 23:29 GMT+02:00 <Mario.Limonciello@dell.com>: >> -----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 <dvhart@infradead.org>; LKML <linux-kernel@vger.kernel.org>; >> Linux ACPI <linux-acpi@vger.kernel.org>; Rafael J. Wysocki <rjw@rjwysocki.net>; >> Andy Shevchenko <andy.shevchenko@gmail.com>; Limonciello, Mario >> <Mario_Limonciello@Dell.com>; Alex Hung <alex.hung@canonical.com> >> Subject: [PATCH] platform/x86: intel-hid: Power button suspend on Dell Latitude >> 7275 >> >> From: Jérôme de Bretagne <jerome.debretagne@gmail.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. >> 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 <jerome.debretagne@gmail.com> >> Signed-off-by: Jérôme de Bretagne <jerome.debretagne@gmail.com> >> --- >> 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 <mario.limonciello@dell.com> Thanks Mario. In fact, I updated my initial fix proposal on the 12th in [1] and this patch matches exactly the updated version. You didn't receive the update notification from Bugzilla? [1] https://bugzilla.kernel.org/show_bug.cgi?id=196115#c12 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: Jérôme de Bretagne [mailto:jerome.debretagne@gmail.com] > Sent: Monday, September 18, 2017 5:41 PM > To: Limonciello, Mario <Mario_Limonciello@Dell.com> > Cc: platform-driver-x86@vger.kernel.org; Darren Hart <dvhart@infradead.org>; > LKML <linux-kernel@vger.kernel.org>; ACPI Devel Maling List <linux- > acpi@vger.kernel.org>; Rafael J. Wysocki <rjw@rjwysocki.net>; Andy Shevchenko > <andy.shevchenko@gmail.com>; Alex Hung <alex.hung@canonical.com> > Subject: Re: [PATCH] platform/x86: intel-hid: Power button suspend on Dell > Latitude 7275 > > 2017-09-18 23:29 GMT+02:00 <Mario.Limonciello@dell.com>: > >> -----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 <dvhart@infradead.org>; LKML <linux-kernel@vger.kernel.org>; > >> Linux ACPI <linux-acpi@vger.kernel.org>; Rafael J. Wysocki > <rjw@rjwysocki.net>; > >> Andy Shevchenko <andy.shevchenko@gmail.com>; Limonciello, Mario > >> <Mario_Limonciello@Dell.com>; Alex Hung <alex.hung@canonical.com> > >> Subject: [PATCH] platform/x86: intel-hid: Power button suspend on Dell Latitude > >> 7275 > >> > >> From: Jérôme de Bretagne <jerome.debretagne@gmail.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. > >> 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 <jerome.debretagne@gmail.com> > >> Signed-off-by: Jérôme de Bretagne <jerome.debretagne@gmail.com> > >> --- > >> 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 <mario.limonciello@dell.com> > > Thanks Mario. > > In fact, I updated my initial fix proposal on the 12th in [1] and > this patch matches exactly the updated version. You didn't receive > the update notification from Bugzilla? > > [1] https://bugzilla.kernel.org/show_bug.cgi?id=196115#c12 No I didn't get one (or some enterprise spam filter helpfully avoided letting it into my inbox).
On Mon, Sep 18, 2017 at 12:57:12AM +0200, Jérôme de Bretagne wrote: > From: Jérôme de Bretagne <jerome.debretagne@gmail.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. > 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 <jerome.debretagne@gmail.com> > Signed-off-by: Jérôme de Bretagne <jerome.debretagne@gmail.com> > --- > 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; Minor CodingStyle nit. If the if block uses parens, so does the else block. In this case, since the if returns, just skip the else entirely. See Documentation/process/coding-style.rst The example immediatley *before* 3.1) Spaces. I've made this change and queued for testing. > + } > + > /* 0xC0 is for HID events, other values are for 5 button array */ > if (event != 0xc0) { > if (!priv->array || >
On Sat, Sep 23, 2017 at 2:45 AM, Darren Hart <dvhart@infradead.org> wrote: > On Mon, Sep 18, 2017 at 12:57:12AM +0200, Jérôme de Bretagne wrote: >> + if (event == 0xce) { >> + input_report_key(priv->input_dev, KEY_POWER, 1); >> + input_sync(priv->input_dev); >> + return; >> + } else if (event == 0xcf) >> + return; > > Minor CodingStyle nit. If the if block uses parens, so does the else block. In > this case, since the if returns, just skip the else entirely. > > See Documentation/process/coding-style.rst > The example immediatley *before* 3.1) Spaces. > > I've made this change and queued for testing. > >> + } Actually in this case even 'else' is redundant.
On Mon, Sep 25, 2017 at 01:57:48PM +0300, Andy Shevchenko wrote: > On Sat, Sep 23, 2017 at 2:45 AM, Darren Hart <dvhart@infradead.org> wrote: > > On Mon, Sep 18, 2017 at 12:57:12AM +0200, Jérôme de Bretagne wrote: > > >> + if (event == 0xce) { > >> + input_report_key(priv->input_dev, KEY_POWER, 1); > >> + input_sync(priv->input_dev); > >> + return; > >> + } else if (event == 0xcf) > >> + return; > > > > Minor CodingStyle nit. If the if block uses parens, so does the else block. In > > this case, since the if returns, just skip the else entirely. > > > > See Documentation/process/coding-style.rst > > The example immediatley *before* 3.1) Spaces. > > > > I've made this change and queued for testing. > > > >> + } > > Actually in this case even 'else' is redundant. Yes, this is what I meant above by "skip the else entirely", and is the change I made prior to committing. I was just pointing out the coding style at the same time :-)
On Wed, Sep 27, 2017 at 10:31 AM, Darren Hart <dvhart@infradead.org> wrote: > On Mon, Sep 25, 2017 at 01:57:48PM +0300, Andy Shevchenko wrote: >> On Sat, Sep 23, 2017 at 2:45 AM, Darren Hart <dvhart@infradead.org> wrote: >> > On Mon, Sep 18, 2017 at 12:57:12AM +0200, Jérôme de Bretagne wrote: >> >> >> + if (event == 0xce) { >> >> + input_report_key(priv->input_dev, KEY_POWER, 1); >> >> + input_sync(priv->input_dev); >> >> + return; >> >> + } else if (event == 0xcf) >> >> + return; >> > >> > Minor CodingStyle nit. If the if block uses parens, so does the else block. In >> > this case, since the if returns, just skip the else entirely. >> > >> > See Documentation/process/coding-style.rst >> > The example immediatley *before* 3.1) Spaces. >> > >> > I've made this change and queued for testing. >> > >> >> + } >> >> Actually in this case even 'else' is redundant. > > Yes, this is what I meant above by "skip the else entirely", and is the > change I made prior to committing. I was just pointing out the coding > style at the same time :-) Good we are on the same page WRT such pattern.
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 ||