Thread (4 messages) 4 messages, 2 authors, 2020-01-27

Re: [PATCH] dt-bindings: input: Convert gpio-keys bindings to schema

From: Rob Herring <robh@kernel.org>
Date: 2020-01-24 01:35:21
Also in: linux-devicetree

On Thu, Jan 23, 2020 at 4:25 PM Dmitry Torokhov
[off-list ref] wrote:
Hi Rob,

On Thu, Jan 23, 2020 at 03:42:22PM -0600, Rob Herring wrote:
quoted
Convert the gpio-keys and gpio-keys-polled bindings to a DT schema. As
both bindings are almost the same, combine them into a single schema.

The binding said 'interrupts' was required, but testing on dts files
showed that it isn't required.

'linux,input-value' was only documented for gpio-keys-polled, but there
doesn't seem to be any reason for it to be specific to that.
Actually, there is: with gpio-keys-polled we take a "snapshot" of the
entire device state, so we know when to generate a 0 event (the example
we have a device with several GPIOs with values assigned 1, 2, 3, 4, 5..
values, when one of the gpios is active we generate event with given
value, when all are inactive we generate 0 event). This does not work
for interrupt-only driven device.
Okay, it wasn't clear to me reading the binding doc. I'll make it conditional.

quoted
+      properties:
+        gpios:
+          maxItems: 1
quoted
+
+        interrupts:
+          maxItems: 1
We support "interrupt-only" mode where we do not have GPIO, so for
"gpio-keys" we need either interrupts or gpios or both, and for polled
we must have gpios (and I guess we simply ignore interrupts if they are
specified).

Does this binding manages to enforce this?
Yes, this hunk does that:

+      anyOf:
+        - required:
+            - interrupts
+        - required:
+            - gpios

Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help