Message ID | 20231129110618.27551-1-tony@atomide.com |
---|---|
State | Not Applicable |
Headers | show |
Series | [v5,1/2] dt-bindings: input: gpio-keys: Allow optional dedicated wakeirq | expand |
Context | Check | Description |
---|---|---|
robh/checkpatch | success | |
robh/patch-applied | success | |
robh/dtbs-check | warning | build log |
robh/dt-meta-schema | success |
On Wed, Nov 29, 2023 at 01:06:14PM +0200, Tony Lindgren wrote: > Allow configuring an optional dedicated wakeirq for gpio-keys that > some SoCs have. > > Let's use the common interrupt naming "irq" and "wakeup" that we already > have in use for some drivers and subsystems like i2c framework. > > Note that the gpio-keys interrupt property is optional. If only a gpio > property is specified, the driver tries to translate the gpio into an > interrupt. > > Reviewed-by: Rob Herring <robh@kernel.org> > Signed-off-by: Tony Lindgren <tony@atomide.com> Applied, thank you.
On Wed, Nov 29, 2023 at 01:06:15PM +0200, Tony Lindgren wrote: > Some SoCs have a separate dedicated wake-up interrupt controller that can > be used to wake up the system from deeper idle states. We already support > configuring a separate interrupt for a gpio-keys button to be used with a > gpio line. However, we are lacking support system suspend for cases where > a separate interrupt needs to be used in deeper sleep modes. > > Because of it's nature, gpio-keys does not know about the runtime PM state > of the button gpios, and may have several gpio buttons configured for each > gpio-keys device instance. Implementing runtime PM support for gpio-keys > does not help, and we cannot use drivers/base/power/wakeirq.c support. We > need to implement custom wakeirq support for gpio-keys. > > For handling a dedicated wakeirq for system suspend, we enable and disable > it with gpio_keys_enable_wakeup() and gpio_keys_disable_wakeup() that we > already use based on device_may_wakeup(). > > Some systems may have a dedicated wakeirq that can also be used as the > main interrupt, this is already working for gpio-keys. Let's add some > wakeirq related comments while at it as the usage with a gpio line and > separate interrupt line may not be obvious. > > Tested-by: Dhruva Gole <d-gole@ti.com> > Signed-off-by: Tony Lindgren <tony@atomide.com> Applied, thank you.
diff --git a/Documentation/devicetree/bindings/input/gpio-keys.yaml b/Documentation/devicetree/bindings/input/gpio-keys.yaml --- a/Documentation/devicetree/bindings/input/gpio-keys.yaml +++ b/Documentation/devicetree/bindings/input/gpio-keys.yaml @@ -31,7 +31,23 @@ patternProperties: maxItems: 1 interrupts: - maxItems: 1 + oneOf: + - items: + - description: Optional key interrupt or wakeup interrupt + - items: + - description: Key interrupt + - description: Wakeup interrupt + + interrupt-names: + description: + Optional interrupt names, can be used to specify a separate dedicated + wake-up interrupt in addition to the gpio irq + oneOf: + - items: + - enum: [ irq, wakeup ] + - items: + - const: irq + - const: wakeup label: description: Descriptive name of the key. @@ -97,6 +113,20 @@ patternProperties: - required: - gpios + allOf: + - if: + properties: + interrupts: + minItems: 2 + required: + - interrupts + then: + properties: + interrupt-names: + minItems: 2 + required: + - interrupt-names + dependencies: wakeup-event-action: [ wakeup-source ] linux,input-value: [ gpios ] @@ -137,6 +167,15 @@ examples: linux,code = <108>; interrupts = <1 IRQ_TYPE_EDGE_FALLING>; }; + + key-wakeup { + label = "GPIO Key WAKEUP"; + linux,code = <143>; + interrupts-extended = <&intc 2 IRQ_TYPE_EDGE_FALLING>, + <&intc_wakeup 0 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "irq", "wakeup"; + wakeup-source; + }; }; ...