linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-input@vger.kernel.org
Cc: kernel@collabora.com
Subject: Re: [RFC 3/4] Input: Ignore the KEY_POWER events if hibernation is in progress
Date: Wed, 22 Oct 2025 11:40:13 -0500	[thread overview]
Message-ID: <552ba489-a876-4ef1-b23f-93cbe8ef6c93@kernel.org> (raw)
In-Reply-To: <bd186145-c85c-41e3-bdc6-c2aaba4e874f@collabora.com>

On 10/22/25 11:33 AM, Muhammad Usama Anjum wrote:
> On 10/22/25 2:14 AM, Mario Limonciello (AMD) (kernel.org) wrote:
>>
>>
>> On 10/18/2025 9:21 AM, Muhammad Usama Anjum wrote:
>>> 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.
>>>
>>> Abort the hibernation by calling pm awake API as well.
>>
>> So do you observe events both from ACPI and from input?  Or was this patch based upon an earlier version of the ACPI patch?
> Yes, I observe events from both ACPI and input driver when power button is pressed.
> AFAIU this happens because of historic reasons of button wired through keyboard
> controller.
> 
> The call to pm_wakeup_dev_event() can be removed. But I've added it for non-ACPI
> devices. Maybe those devices handle only input events through this path. Do you
> think this can be the case?

Well my point was if both are coming through - it's probably better to 
just have pm_wakeup_dev_event() in input and pass the input event from ACPI.

>   >
>> Because it feels like to me perhaps another way to solve this would be for patch 2 to to send the input event and just keep pm_wakeup_dev_event() here instead of both places.
> I was sending input event in patch 2 earlier. I was having difficulty in managing
> so many dependencies in acpi_button_notify(). It suspends the button events. I'll
> reiterate and see if I can achieve this in next series because this would be most
> clean solution.

OK!

> 
>>
>>>
>>> Without this, the event is sent to the userspace and it suspends the
>>> device after hibernation cancellation.
>>>
>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>> ---
>>>    drivers/input/input.c | 6 ++++++
>>>    1 file changed, 6 insertions(+)
>>>
>>> diff --git a/drivers/input/input.c b/drivers/input/input.c
>>> index a500e1e276c21..0979f18aae6a2 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 && hibernation_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)
>>
> 
> 


  reply	other threads:[~2025-10-22 16:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-18 14:21 [RFC 0/4] PM: Hibernate: Add hibernation cancellation support Muhammad Usama Anjum
2025-10-18 14:21 ` [RFC 1/4] PM: hibernate: export hibernation_in_progress() Muhammad Usama Anjum
2025-10-21 21:07   ` Mario Limonciello (AMD) (kernel.org)
2025-10-22  9:53     ` Rafael J. Wysocki
2025-10-22 16:27       ` Muhammad Usama Anjum
2025-10-18 14:21 ` [RFC 2/4] ACPI: button: Cancel hibernation if button is pressed during hibernation Muhammad Usama Anjum
2025-10-21 21:12   ` Mario Limonciello (AMD) (kernel.org)
2025-10-18 14:21 ` [RFC 3/4] Input: Ignore the KEY_POWER events if hibernation is in progress Muhammad Usama Anjum
2025-10-21 21:14   ` Mario Limonciello (AMD) (kernel.org)
2025-10-22 16:33     ` Muhammad Usama Anjum
2025-10-22 16:40       ` Mario Limonciello [this message]
2025-10-18 14:21 ` [RFC 4/4] PM: sleep: clear pm_abort_suspend at suspend Muhammad Usama Anjum

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=552ba489-a876-4ef1-b23f-93cbe8ef6c93@kernel.org \
    --to=superm1@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=usama.anjum@collabora.com \
    /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;
as well as URLs for NNTP newsgroup(s).