From: "Mario Limonciello (AMD) (kernel.org)" <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 2/4] ACPI: button: Cancel hibernation if button is pressed during hibernation
Date: Tue, 21 Oct 2025 16:12:19 -0500 [thread overview]
Message-ID: <c1c72b45-1f0b-48da-98e5-47f5d63463a2@kernel.org> (raw)
In-Reply-To: <20251018142114.897445-3-usama.anjum@collabora.com>
On 10/18/2025 9:21 AM, Muhammad Usama Anjum wrote:
> acpi_pm_wakeup_event() is called from acpi_button_notify() which is
> called when power button is pressed. But system doesn't wake up as
> pm_wakeup_dev_event() isn't called with hard parameter set in case of
> hibernation. It gets set only for s2idle cases.
>
> Call acpi_pm_wakeup_event() if power button is pressed and hibernation
> is in progress. Set the hard parameter such that pm_system_wakeup()
> gets called which increments pm_abort_suspend counter. Hence hibernation
> would be cancelled as in hibernation path, this counter is checked if it
> should be aborted.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> drivers/acpi/button.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
> index 0a70260401882..4a2575c0c44e3 100644
> --- a/drivers/acpi/button.c
> +++ b/drivers/acpi/button.c
> @@ -20,6 +20,7 @@
> #include <linux/acpi.h>
> #include <linux/dmi.h>
> #include <acpi/button.h>
> +#include <linux/suspend.h>
>
> #define ACPI_BUTTON_CLASS "button"
> #define ACPI_BUTTON_FILE_STATE "state"
> @@ -458,11 +459,16 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
> acpi_pm_wakeup_event(&device->dev);
>
> button = acpi_driver_data(device);
> - if (button->suspended || event == ACPI_BUTTON_NOTIFY_WAKE)
> - return;
> -
> input = button->input;
> keycode = test_bit(KEY_SLEEP, input->keybit) ? KEY_SLEEP : KEY_POWER;
> + if (event == ACPI_BUTTON_NOTIFY_STATUS && keycode == KEY_POWER &&
> + hibernation_in_progress()) {
> + pm_wakeup_dev_event(&device->dev, 0, true);
The comments for pm_wakeup_dev_event() say that hard is used
specifically for suspend to idle, but now you're overloading it.
So I think the comment in pm_wakeup_dev_event() needs to be updated if
this is the way forward.
> + return;
> + }
> +
> + if (button->suspended || event == ACPI_BUTTON_NOTIFY_WAKE)
> + return;
>
> input_report_key(input, keycode, 1);
> input_sync(input);
next prev parent reply other threads:[~2025-10-21 21:12 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) [this message]
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
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=c1c72b45-1f0b-48da-98e5-47f5d63463a2@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).