[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f1f3210-47c6-4c00-8fb9-35f48bae2581@collabora.com>
Date: Tue, 25 Nov 2025 15:22:28 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: usama.anjum@...labora.com, Len Brown <lenb@...nel.org>,
Pavel Machek <pavel@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Danilo Krummrich <dakr@...nel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Thomas Gleixner <tglx@...utronix.de>, Peter Zijlstra <peterz@...radead.org>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org, linux-input@...r.kernel.org, kernel@...labora.com,
superm1@...nel.org
Subject: Re: [PATCH 3/4] Input: Ignore the KEY_POWER events if hibernation is
in progress
On 11/24/25 11:50 PM, Rafael J. Wysocki wrote:
> On Fri, Nov 7, 2025 at 7:45 PM Muhammad Usama Anjum
> <usama.anjum@...labora.com> wrote:
>>
>> Input (Serio) drivers call input_handle_event(). Although the serio
>> drivers have duplicate events, they have separate code path and call
>> input_handle_event(). Ignore the KEY_POWER such that this event isn't
>> sent to the userspace if hibernation is in progress.
>
> Your change affects suspend too.
>
> Also, what's the goal you want to achieve?
Two goals:
* Don't send event to userspace
* Set pm_wakeup for hibernation cancellation for non-acpi devices (This api
call should be tested on non-acpi devices such as arm board to see if it
helps. I don't have an arm board in hand)
>
>> Abort the hibernation by calling pm_wakeup_dev_event(). In case of serio,
>> doesn't have wakeup source registered, this call doesn't do anything.
>> But there may be other input drivers which will require this.
>>
>> Without this, the event is sent to the userspace and it suspends the
>> device after hibernation cancellation.
>
> I think that's because user space handles it this way, isn't it?
Yes, it depends on how userspace handles such events. There are different settings
configured for systemd-logind when power event is received. The purpose is to consume
this event to cancel the hibernation without letting userspace know about it.
Thinking more about it, I wasn't sure if all of such events are compulsory to be
delivered to userspace. But then I found an example: In acpi_button_notify(), all
such events are not sent to userspace if button is suspended. So it seems okay to
not send this as well and just consume in the kernel.
>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
>> ---
>> Changes since RFC:
>> - Use pm_sleep_transition_in_progress()
>> - Update description
>> ---
>> drivers/input/input.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/input/input.c b/drivers/input/input.c
>> index a500e1e276c21..7939bd9e47668 100644
>> --- a/drivers/input/input.c
>> +++ b/drivers/input/input.c
>> @@ -26,6 +26,7 @@
>> #include <linux/kstrtox.h>
>> #include <linux/mutex.h>
>> #include <linux/rcupdate.h>
>> +#include <linux/suspend.h>
>> #include "input-compat.h"
>> #include "input-core-private.h"
>> #include "input-poller.h"
>> @@ -362,6 +363,11 @@ void input_handle_event(struct input_dev *dev,
>>
>> lockdep_assert_held(&dev->event_lock);
>>
>> + if (code == KEY_POWER && pm_sleep_transition_in_progress()) {
>> + pm_wakeup_dev_event(&dev->dev, 0, true);
>> + return;
>> + }
>> +
>> disposition = input_get_disposition(dev, type, code, &value);
>> if (disposition != INPUT_IGNORE_EVENT) {
>> if (type != EV_SYN)
>> --
--
---
Thanks,
Usama
Powered by blists - more mailing lists