Re: [PATCH 1/2] dt-bindings: input: gpio-keys: Allow optional dedicated wakeirq

From: Rob Herring
Date: Fri Aug 11 2023 - 11:10:58 EST


On Fri, Aug 11, 2023 at 02:04:31PM +0300, Tony Lindgren wrote:
> Allow configuring optional dedicated wakeirq that some SoCs have.
> Let's use the interrupt naming "irq" and "wakeup" that we already have
> in use for some drivers and subsystems like i2c.
>
> Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
> ---
> .../devicetree/bindings/input/gpio-keys.yaml | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> 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,17 @@ patternProperties:
> maxItems: 1
>
> interrupts:
> - maxItems: 1
> + description:
> + Optional interrupts if different from the gpio interrupt
> + maxItems: 2
> +
> + interrupt-names:
> + description:
> + Optional interrupt names, can be used to specify a separate
> + dedicated wake-up interrupt
> + items:
> + -const: irq
> + -const: wakeup

Also need a space after '-'.

>
> label:
> description: Descriptive name of the key.
> @@ -130,6 +140,9 @@ examples:
> label = "GPIO Key UP";
> linux,code = <103>;
> gpios = <&gpio1 0 1>;
> + interrupts-extended = <&intc_wakeup 0 IRQ_TYPE_LEVEL_HIGH>;
> + interrupt-names = "wakeup";

That's not what your schema allows. You need:

minItems: 1
items:
- enum: [ irq, wakeup ]
- const: wakeup

(repeating 'wakeup' is disallowed globally for ".*-names".)

> + wakeup-source;

Of course with this, a single interrupt is the wake-up source and
doesn't need a name. So you could define that 'interrupt-names' is only
used when there are 2 interrupts. In that case, the schema is right and
the example is wrong.

Rob