[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251021213520.GA2546203@robin.jannau.net>
Date: Tue, 21 Oct 2025 23:35:20 +0200
From: Janne Grunau <j@...nau.net>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: James Calligeros <jcalligeros99@...il.com>,
Sven Peter <sven@...nel.org>,
Alyssa Rosenzweig <alyssa@...enzweig.io>,
Neal Gompa <neal@...pa.dev>, Lee Jones <lee@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>, asahi@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-rtc@...r.kernel.org,
linux-hwmon@...r.kernel.org, linux-input@...r.kernel.org,
Hector Martin <marcan@...can.st>
Subject: Re: [PATCH v2 07/11] input: macsmc-hid: New driver to handle the
Apple Mac SMC buttons/lid
On Fri, Aug 29, 2025 at 11:11:22AM +0000, Dmitry Torokhov wrote:
> Hi James,
>
> On Wed, Aug 27, 2025 at 09:22:41PM +1000, James Calligeros wrote:
> > +static void macsmc_hid_event_button(struct macsmc_hid *smchid, unsigned long event)
> > +{
> > + u8 button = (event >> 8) & 0xff;
> > + u8 state = !!(event & 0xff);
> > +
> > + switch (button) {
> > + case BTN_POWER:
> > + case BTN_TOUCHID:
> > + if (smchid->wakeup_mode) {
> > + if (state)
> > + pm_wakeup_hard_event(smchid->dev);
> > + } else {
> > + input_report_key(smchid->input, KEY_POWER, state);
> > + input_sync(smchid->input);
> > + }
>
> I believe you should be using pm_wakeup_event() in all cases so that
> pressing power would interrupt suspend even if resume() handler has not
> been run yet.
pm_wakeup_event() does not wake from s2idle. pm_wakeup_dev_event()'s
`hard` parameter is explicitily documented to wake from s2idle. So using
pm_wakeup_dev_event and use `smchid->wakeup_mode && state` as hard
parameter seems the correct thing to do.
> Also I do not think suppressing KEY_POWER is needed.
> Userspace should be smart and decide whether to shutdown the system or
> not when receiving KEY_POWER depending on the overall system state.
Not all user space. Using the power button to wake from s2idle while
showing agetty's login prompt on a tty results in an immediate shutdown.
Janne
Powered by blists - more mailing lists