Re: [PATCH] Input: pm8941-pwrkey - report wakeup events

From: Dmitry Torokhov

Date: Sun Nov 22 2026 - 23:17:10 EST


Hi Michael,

On Sat, Nov 21, 2026 at 09:41:12PM +0100, Michael Auer wrote:
> The power key (and resin, with "wakeup-source") is a wakeup source, but
> the driver never reports a wakeup event. Its wakeup_count in
> /sys/class/wakeup stays 0 even after it woke the system, so user space
> cannot tell a key press from other wakeups. PowerDevil, for example,
> uses the wakeup counts to decide whether to turn the display on after
> resume.
>
> Report a wakeup event from the interrupt handler, as other power key
> drivers do.
>
> Signed-off-by: Michael Auer <mick@xxxxxxxx>
...
> @@ -161,6 +161,9 @@ static irqreturn_t pm8941_pwrkey_irq(int irq, void *_data)
> }
> }
>
> + /* Let user space see that the key woke the system */
> + pm_wakeup_event(pwrkey->dev, 0);
> +
> err = regmap_read(pwrkey->regmap, pwrkey->baseaddr + PON_RT_STS, &sts);
> if (err)
> return IRQ_HANDLED;

Could you please move pm_wakeup_event() below regmap_read() (after the
error check, or right before reporting the key event) so that we do not
report a wakeup event when reading the status register fails?

Thanks.

--
Dmitry