From: Michael Auer <mick@yoxcu.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Michael Auer <mick@yoxcu.de>
Subject: [PATCH] Input: pm8941-pwrkey - report wakeup events
Date: Sat, 21 Nov 2026 21:41:12 +0100 [thread overview]
Message-ID: <20261121204112.847960-1-mick@yoxcu.de> (raw)
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@yoxcu.de>
---
Tested on a OnePlus 6 (sdm845, PM8998) with an sdm845-mainline 7.1-rc1
based kernel: a power key wakeup from suspend moves wakeup_count from 0
to 1. On input/next it was only build tested (W=1, arm64 and x86_64
allmodconfig).
The event is reported for every interrupt, press and release. After
resume the press can be read as a release (the handler then simulates
the press), so reporting only presses could miss the wakeup.
Tool use: the analysis, the code and the commit messages were
written with an LLM coding assistant (Claude Code). I reviewed all
of it and tested it on my phone as described above.
drivers/input/misc/pm8941-pwrkey.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
index 34b4afbb1984..3827e751297a 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -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;
base-commit: ab13b5fc808e043a13f861a7c1c2ba8173c22b84
--
2.43.0
reply other threads:[~2026-11-21 20:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261121204112.847960-1-mick@yoxcu.de \
--to=mick@yoxcu.de \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®