* [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; 6+ 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] 6+ 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-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, 1 reply; 6+ 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 [flat|nested] 6+ 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-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, 1 reply; 6+ 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 [flat|nested] 6+ 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; 6+ 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] 6+ 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-14 7:51 ` Markus Schneider-Pargmann
0 siblings, 0 replies; 6+ 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] 6+ 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-14 10:13 ` Krzysztof Kozlowski
0 siblings, 0 replies; 6+ 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] 6+ messages in thread
end of thread, other threads:[~2026-09-14 10:13 UTC | newest]
Thread overview: 6+ 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-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 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
all inboxes | Powered by JetHome®