Linux Input/HID development
 help / color / mirror / Atom feed
From: Kendall Willis <k-willis@ti.com>
To: Markus Schneider-Pargmann <msp@baylibre.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, <s-kochidanadu@ti.com>,
	<a-kaur@ti.com>, <s-tripathi1@ti.com>, <vishalm@ti.com>,
	<linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend
Date: Tue, 15 Sep 2026 11:09:50 -0500	[thread overview]
Message-ID: <20260915160950.fortr3ptp2izzxjn@uda0506412> (raw)
In-Reply-To: <DLEVJIB1SL4O.2WZY8O2F54YL4@baylibre.com>

On 09:51-20260914, Markus Schneider-Pargmann wrote:
> Hi Kendall,
> 
> On Sat Sep 12, 2026 at 11:33 PM CEST, Kendall Willis wrote:
> > GPIO can be used as a wakeup source for TI K3 AM62 devices during
> > suspend to RAM states. The GPIO controller is powered off in these
> > states, so a wakeup enable flag must be set on the GPIO pin in the
> > pinctrl in order to allow wakeup.
> >
> > If the device is wakeup enabled, select the 'wakeup' pinctrl state on
> > suspend and restore the default pinctrl state on resume.
> >
> > Signed-off-by: Kendall Willis <k-willis@ti.com>
> > ---
> >  drivers/input/keyboard/gpio_keys.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> > index 129fc4212a5ed126496b331ce626682d441c53bf..b409e179705195e5fec172ff62088395109cd758 100644
> > --- a/drivers/input/keyboard/gpio_keys.c
> > +++ b/drivers/input/keyboard/gpio_keys.c
> > @@ -28,6 +28,7 @@
> >  #include <linux/of.h>
> >  #include <linux/of_irq.h>
> >  #include <linux/spinlock.h>
> > +#include <linux/pinctrl/consumer.h>
> >  #include <dt-bindings/input/gpio-keys.h>
> >  
> >  struct gpio_button_data {
> > @@ -60,6 +61,8 @@ struct gpio_keys_drvdata {
> >  	struct input_dev *input;
> >  	struct mutex disable_lock;
> >  	unsigned short *keymap;
> > +	struct pinctrl *pinctrl;
> > +	struct pinctrl_state *pinctrl_wakeup;
> >  	struct gpio_button_data data[];
> >  };
> >  
> > @@ -884,6 +887,10 @@ static int gpio_keys_probe(struct platform_device *pdev)
> >  	platform_set_drvdata(pdev, ddata);
> >  	input_set_drvdata(input, ddata);
> >  
> > +	ddata->pinctrl = devm_pinctrl_get(dev);
> > +	if (!IS_ERR_OR_NULL(ddata->pinctrl))
> > +		ddata->pinctrl_wakeup = pinctrl_lookup_state(ddata->pinctrl, "wakeup");
> > +
> >  	input->name = pdata->name ? : pdev->name;
> >  	input->phys = "gpio-keys/input0";
> >  	input->dev.parent = dev;
> > @@ -1010,6 +1017,9 @@ gpio_keys_enable_wakeup(struct gpio_keys_drvdata *ddata)
> >  	int error;
> >  	int i;
> >  
> > +	if (!IS_ERR_OR_NULL(ddata->pinctrl_wakeup))
> > +		pinctrl_select_state(ddata->pinctrl, ddata->pinctrl_wakeup);
> 
> If wakeup state selection failed, should it really just continue here?
> 
> > +
> >  	for (i = 0; i < ddata->pdata->nbuttons; i++) {
> >  		bdata = &ddata->data[i];
> >  		if (bdata->button->wakeup) {
> 
> There is some error handling below in this function. The selected
> pinctrl state is not rolled back in the error path.
> 

Thanks for pointing this out, will fix in v2.

Best,
Kendall


  reply	other threads:[~2026-09-15 16:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 21:33 [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state Kendall Willis
2026-09-12 21:33 ` [PATCH 1/2] dt-bindings: input: gpio-keys: add pinctrl states Kendall Willis
2026-09-12 21:41   ` sashiko-bot
2026-09-14 10:13   ` Krzysztof Kozlowski
2026-09-15 16:48     ` Kendall Willis
2026-09-15 17:05       ` Krzysztof Kozlowski
2026-09-15 17:07         ` Krzysztof Kozlowski
2026-09-15 17:41           ` Kendall Willis
2026-09-16  7:17             ` Krzysztof Kozlowski
2026-09-16 15:36               ` Markus Schneider-Pargmann
2026-09-20 10:24                 ` Krzysztof Kozlowski
2026-09-21 19:35                   ` Dmitry Torokhov
2026-09-22  8:48                     ` Krzysztof Kozlowski
2026-09-25 15:48       ` Kendall Willis
2026-09-12 21:33 ` [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend Kendall Willis
2026-09-12 21:42   ` sashiko-bot
2026-09-14  7:51   ` Markus Schneider-Pargmann
2026-09-15 16:09     ` Kendall Willis [this message]
2026-09-14  5:59 ` [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state Francesco Dolcini

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=20260915160950.fortr3ptp2izzxjn@uda0506412 \
    --to=k-willis@ti.com \
    --cc=a-kaur@ti.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msp@baylibre.com \
    --cc=robh@kernel.org \
    --cc=s-kochidanadu@ti.com \
    --cc=s-tripathi1@ti.com \
    --cc=vishalm@ti.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