* [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state
@ 2026-09-12 21:33 Kendall Willis
2026-09-12 21:33 ` [PATCH 1/2] dt-bindings: input: gpio-keys: add pinctrl states Kendall Willis
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Kendall Willis @ 2026-09-12 21:33 UTC (permalink / raw)
To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: msp, s-kochidanadu, a-kaur, s-tripathi1, vishalm, k-willis,
linux-input, linux-kernel, devicetree
Add 'wakeup' pinctrl state to support separate pin wakeup
configurations for GPIO. Upon suspend the 'wakeup' pinctrl state is
chosen if it exists. On resume the 'default' pinctrl state is selected.
The 'wakeup' pinctrl state allows wakeup from low-power states if a
specific pin configuration is needed.
On TI K3 AM62 family of devices, the GPIO controller is turned off in
suspend to RAM states, so no interrupt can be received by the
controller. This prevents system wakeup from low-power states.
Alternatively, the pins can wakeup the system if a wakeup flag is set on
the pin by using pinctrl.
A corresponding device tree patch using the 'wakeup' pinctrl state can
be found under "arm64: dts: ti: k3-am62l3-evm: add wakeup-source for GPIO
button".
Tested GPIO wakeup from suspend on AM62L EVM and AM62P EVM.
Signed-off-by: Kendall Willis <k-willis@ti.com>
---
Kendall Willis (2):
dt-bindings: input: gpio-keys: add pinctrl states
Input: gpio-keys - support wakeup pinctrl state on suspend
Documentation/devicetree/bindings/input/gpio-keys.yaml | 16 ++++++++++++++++
drivers/input/keyboard/gpio_keys.c | 13 +++++++++++++
2 files changed, 29 insertions(+)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260904-upstream-gpio-wakeup-52a54080c948
Best regards,
--
Kendall Willis <k-willis@ti.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] dt-bindings: input: gpio-keys: add pinctrl states 2026-09-12 21:33 [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state Kendall Willis @ 2026-09-12 21:33 ` Kendall Willis 2026-09-12 21:41 ` sashiko-bot 2026-09-14 10:13 ` Krzysztof Kozlowski 2026-09-12 21:33 ` [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend Kendall Willis 2026-09-14 5:59 ` [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state Francesco Dolcini 2 siblings, 2 replies; 8+ messages in thread From: Kendall Willis @ 2026-09-12 21:33 UTC (permalink / raw) To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: msp, s-kochidanadu, a-kaur, s-tripathi1, vishalm, k-willis, linux-input, linux-kernel, devicetree Document pinctrl properties on the gpio-keys device node. By using the wakeup pinctrl state, the pins are able to wakeup the system from a low-power state. The default pinctrl state describes the default pin configuration. Signed-off-by: Kendall Willis <k-willis@ti.com> --- Documentation/devicetree/bindings/input/gpio-keys.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml index cc78c2152921308fe0cad3e29ca78a5fad08f066..b554933e93412d8b6c2ec401dc1e1eeff57d4190 100644 --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml @@ -22,6 +22,22 @@ properties: poll-interval: true + pinctrl-0: + description: Default pinctrl state + + pinctrl-1: + description: Wakeup pinctrl state + + pinctrl-names: + description: + When present should contain at least "default" describing the default pin + states. The second state called "wakeup" describes the pins in their + wakeup configuration required to exit sleep states. + minItems: 1 + items: + - const: default + - const: wakeup + patternProperties: "^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$": $ref: input.yaml# -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: input: gpio-keys: add pinctrl states 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 1 sibling, 0 replies; 8+ messages in thread From: sashiko-bot @ 2026-09-12 21:41 UTC (permalink / raw) To: Kendall Willis; +Cc: conor+dt, robh, devicetree, linux-input, dmitry.torokhov Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Schema constraint on `pinctrl-names` breaks validation for existing device trees using standard PM states. -- commit 7cccd8c7baf951e7fe028bb369bca736764010d5 Author: Kendall Willis <k-willis@ti.com> dt-bindings: input: gpio-keys: add pinctrl states This patch adds pinctrl-0, pinctrl-1, and pinctrl-names properties to the gpio-keys device tree binding to document the default and wakeup pin configurations. > diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml > index cc78c21529213..b554933e93412 100644 > --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml > +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml [ ... ] > + pinctrl-names: > + description: > + When present should contain at least "default" describing the default pin > + states. The second state called "wakeup" describes the pins in their > + wakeup configuration required to exit sleep states. > + minItems: 1 > + items: > + - const: default > + - const: wakeup [Severity: Medium] Does this strict schema constraint break validation for existing device trees? By explicitly restricting the pinctrl-names items to exactly "default" and "wakeup" in Documentation/devicetree/bindings/input/gpio-keys.yaml, this generic binding will now cause device tree validation (make dtbs_check) to fail for existing upstream boards. Many boards correctly use standard pinctrl power management states like "sleep" (for example, pinctrl-names = "default", "sleep";) which are now rejected by this schema. -- Sashiko AI review · https://sashiko.dev/#/patchset/20260912-upstream-gpio-wakeup-v1-0-f0e12484b836@ti.com?part=1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: input: gpio-keys: add pinctrl states 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 1 sibling, 0 replies; 8+ messages in thread From: Krzysztof Kozlowski @ 2026-09-14 10:13 UTC (permalink / raw) To: Kendall Willis Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley, msp, s-kochidanadu, a-kaur, s-tripathi1, vishalm, linux-input, linux-kernel, devicetree On Sat, Sep 12, 2026 at 04:33:53PM -0500, Kendall Willis wrote: > Document pinctrl properties on the gpio-keys device node. By using the > wakeup pinctrl state, the pins are able to wakeup the system from a > low-power state. The default pinctrl state describes the default pin > configuration. > > Signed-off-by: Kendall Willis <k-willis@ti.com> > --- > Documentation/devicetree/bindings/input/gpio-keys.yaml | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml > index cc78c2152921308fe0cad3e29ca78a5fad08f066..b554933e93412d8b6c2ec401dc1e1eeff57d4190 100644 > --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml > +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml > @@ -22,6 +22,22 @@ properties: > > poll-interval: true > > + pinctrl-0: > + description: Default pinctrl state > + > + pinctrl-1: > + description: Wakeup pinctrl state > + > + pinctrl-names: > + description: > + When present should contain at least "default" describing the default pin > + states. The second state called "wakeup" describes the pins in their > + wakeup configuration required to exit sleep states. > + minItems: 1 > + items: > + - const: default > + - const: wakeup This will introduce new warnings, which should be being fixed in this patchset (e.g. at91-kizbox3-hs.dts). But nevertheless, isn't second state the sleep state? How can you configure pins for the wakeup state - like being in the wakeup? You configure the pins for given state, which will be a system suspend, so sleep? Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend 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:33 ` Kendall Willis 2026-09-12 21:42 ` sashiko-bot 2026-09-14 7:51 ` Markus Schneider-Pargmann 2026-09-14 5:59 ` [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state Francesco Dolcini 2 siblings, 2 replies; 8+ messages in thread From: Kendall Willis @ 2026-09-12 21:33 UTC (permalink / raw) To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: msp, s-kochidanadu, a-kaur, s-tripathi1, vishalm, k-willis, linux-input, linux-kernel, devicetree 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); + for (i = 0; i < ddata->pdata->nbuttons; i++) { bdata = &ddata->data[i]; if (bdata->button->wakeup) { @@ -1039,6 +1049,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); + for (i = 0; i < ddata->pdata->nbuttons; i++) { bdata = &ddata->data[i]; bdata->suspended = false; -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend 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 1 sibling, 0 replies; 8+ messages in thread From: sashiko-bot @ 2026-09-12 21:42 UTC (permalink / raw) To: Kendall Willis; +Cc: linux-input, robh, devicetree, conor+dt, dmitry.torokhov Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Missing restoration of default pinctrl state on error path in gpio_keys_enable_wakeup(). -- commit 794b05f8c21f23224e4ff7b076c2d675310e6432 Author: Kendall Willis <k-willis@ti.com> Input: gpio-keys - support wakeup pinctrl state on suspend This commit enables GPIO controllers on TI K3 AM62 devices to act as a wakeup source during suspend to RAM by selecting a wakeup pinctrl state and restoring the default on resume. > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c > index 129fc4212a5ed..b409e17970519 100644 > --- a/drivers/input/keyboard/gpio_keys.c > +++ b/drivers/input/keyboard/gpio_keys.c [ ... ] > @@ -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); > + > for (i = 0; i < ddata->pdata->nbuttons; i++) { > bdata = &ddata->data[i]; > if (bdata->button->wakeup) { [Severity: Medium] Does the error path in this function need to restore the default pinctrl state? Looking at gpio_keys_enable_wakeup in drivers/input/keyboard/gpio_keys.c, the pinctrl state is changed to wakeup at the start of the function. However, if gpio_keys_button_enable_wakeup fails for any button, the code jumps to the err_out label: err_out: while (i--) { bdata = &ddata->data[i]; if (bdata->button->wakeup) gpio_keys_button_disable_wakeup(bdata); bdata->suspended = false; } return error; Since a failure here aborts the device's suspend transition, the PM core will not invoke the corresponding resume callback. Could this leave the hardware pins stuck in the wakeup configuration instead of reverting to the default state for normal runtime operation? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260912-upstream-gpio-wakeup-v1-0-f0e12484b836@ti.com?part=2 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend 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 1 sibling, 0 replies; 8+ messages in thread From: Markus Schneider-Pargmann @ 2026-09-14 7:51 UTC (permalink / raw) To: Kendall Willis, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: msp, s-kochidanadu, a-kaur, s-tripathi1, vishalm, linux-input, linux-kernel, devicetree [-- Attachment #1: Type: text/plain, Size: 2777 bytes --] 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. Best Markus > @@ -1039,6 +1049,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); > + > for (i = 0; i < ddata->pdata->nbuttons; i++) { > bdata = &ddata->data[i]; > bdata->suspended = false; [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 289 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state 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:33 ` [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend Kendall Willis @ 2026-09-14 5:59 ` Francesco Dolcini 2 siblings, 0 replies; 8+ messages in thread From: Francesco Dolcini @ 2026-09-14 5:59 UTC (permalink / raw) To: Kendall Willis Cc: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley, msp, s-kochidanadu, a-kaur, s-tripathi1, vishalm, linux-input, linux-kernel, devicetree Hello Kendall, On Sat, Sep 12, 2026 at 04:33:52PM -0500, Kendall Willis wrote: > Add 'wakeup' pinctrl state to support separate pin wakeup > configurations for GPIO. Upon suspend the 'wakeup' pinctrl state is > chosen if it exists. On resume the 'default' pinctrl state is selected. > The 'wakeup' pinctrl state allows wakeup from low-power states if a > specific pin configuration is needed. > > On TI K3 AM62 family of devices, the GPIO controller is turned off in > suspend to RAM states, so no interrupt can be received by the > controller. This prevents system wakeup from low-power states. > Alternatively, the pins can wakeup the system if a wakeup flag is set on > the pin by using pinctrl. > > A corresponding device tree patch using the 'wakeup' pinctrl state can > be found under "arm64: dts: ti: k3-am62l3-evm: add wakeup-source for GPIO > button". > > Tested GPIO wakeup from suspend on AM62L EVM and AM62P EVM. > > Signed-off-by: Kendall Willis <k-willis@ti.com> This is going to be useful also for verdin am62 (verdin_key_wakeup / k3-am62-verdin.dtsi). Thanks, Francesco ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-14 10:13 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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-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-14 5:59 ` [PATCH 0/2] Input: gpio-keys - support wakeup pinctrl state Francesco Dolcini
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).