Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kendall Willis" <k-willis@ti.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
	dmitry.torokhov@gmail.com, robh@kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v4 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend
Date: Mon, 05 Oct 2026 20:58:43 +0000	[thread overview]
Message-ID: <20261005205844.2A7A51F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261005-upstream-gpio-wakeup-v4-2-96f092de4690@ti.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] input: spurious key press on resume due to LIFO violation in pinctrl teardown
--

commit 77748a917235cbadd6477449603ad11920308ecf
Author: Kendall Willis <k-willis@ti.com>

Input: gpio-keys - support wakeup pinctrl state on suspend

This commit adds support for selecting a wakeup pinctrl state on suspend and
restoring the default state on resume for GPIO devices. This enables wakeup
support on certain platforms where the GPIO controller is powered down during
suspend.

> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index e196174856796..b8ecaaded6a44 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
[ ... ]
> @@ -1022,6 +1042,9 @@ gpio_keys_enable_wakeup(struct gpio_keys_drvdata *ddata)
>  	return 0;
>  
>  err_out:
> +	if (!IS_ERR_OR_NULL(ddata->pinctrl_wakeup))
> +		pinctrl_pm_select_default_state(ddata->input->dev.parent);
> +
[Severity: Medium]
Could this error path in gpio_keys_enable_wakeup() in
drivers/input/keyboard/gpio_keys.c trigger a spurious IRQ?

The default pinctrl state is restored before the successfully configured
wakeup IRQs are disabled. If switching the pinctrl state causes a glitch
on the GPIO line, an IRQ might fire prematurely.

>  	while (i--) {
>  		bdata = &ddata->data[i];
>  		if (bdata->button->wakeup)
> @@ -1038,6 +1061,9 @@ gpio_keys_disable_wakeup(struct gpio_keys_drvdata *ddata)
>  	struct gpio_button_data *bdata;
>  	int i;
>  
> +	if (!IS_ERR_OR_NULL(ddata->pinctrl_wakeup))
> +		pinctrl_pm_select_default_state(ddata->input->dev.parent);
> +
[Severity: Medium]
Can this ordering in gpio_keys_disable_wakeup() in
drivers/input/keyboard/gpio_keys.c inject a spurious key press on system
resume?

On resume, gpio_keys_disable_wakeup() restores the default pinctrl state
before disabling the wakeup IRQs and clearing bdata->suspended. If the
pinctrl state transition causes a line glitch, the IRQ fires while
bdata->suspended is still true.

The IRQ handler then sees bdata->suspended is true and explicitly
simulates a key press to handle transient wakeup events. If this key is
mapped to a power or sleep button, it might cause the system to immediately
re-suspend or power off.

Should the default pinctrl state be restored after disabling the IRQs and
clearing the suspended state to maintain a strict LIFO teardown order?

>  	for (i = 0; i < ddata->pdata->nbuttons; i++) {
>  		bdata = &ddata->data[i];
>  		bdata->suspended = false;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261005-upstream-gpio-wakeup-v4-1-96f092de4690@ti.com?part=2

      reply	other threads:[~2026-10-05 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 20:47 [PATCH v4 0/2] Input: gpio-keys - support wakeup pinctrl state Kendall Willis
2026-10-05 20:47 ` [PATCH v4 1/2] dt-bindings: input: gpio-keys: add pinctrl states Kendall Willis
2026-10-05 20:47 ` [PATCH v4 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend Kendall Willis
2026-10-05 20:58   ` sashiko-bot [this message]

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=20261005205844.2A7A51F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=k-willis@ti.com \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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