Skip to contentSkip to conversation

dt-bindings: input: Common property clean-ups and adc-keys conversion

PATCH In review Rob Herring 6 participants 17 messages Jun 8, 2022 – Jul 8, 2022

Subsystems (6)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

v2 cover dt-bindings: input: Common property clean-ups and adc-keys conversion

This series refactors the common 'linux,code', 'linux,keycodes', and 'linux,input-type' properties defined in various binding schemas. As the properties are common, they should only have a single common schema type definition. Note that 'linux,input-value' was not included here as it is only used in 1 binding (gpio-keys).

The clean-ups are are result of the discussion on v1 of the adc-keys binding conversion[1].

Rob

[1] https://lore.kernel.org/all/[email protected]/

Rob Herring (5):
dt-bindings: input: Increase maximum keycode value to 0x2ff
dt-bindings: input: Centralize 'linux,code' definition
dt-bindings: input: Use common 'linux,keycodes' definition
dt-bindings: input: Centralize 'linux,input-type' definition
dt-bindings: input: Convert adc-keys to DT schema

 .../bindings/input/adc-joystick.yaml          |   2 +-
 .../devicetree/bindings/input/adc-keys.txt    |  67 ------------
 .../devicetree/bindings/input/adc-keys.yaml   | 103 ++++++++++++++++++
 .../input/allwinner,sun4i-a10-lradc-keys.yaml |   5 +-
 .../bindings/input/azoteq,iqs7222.yaml        |   8 +-
 .../devicetree/bindings/input/gpio-keys.yaml  |   8 +-
 .../devicetree/bindings/input/input.yaml      |  24 +++-
 .../devicetree/bindings/input/iqs269a.yaml    |  15 +--
 .../devicetree/bindings/input/iqs626a.yaml    |  11 +-
 .../bindings/input/iqs62x-keys.yaml           |   9 +-
 .../bindings/input/max77650-onkey.yaml        |   8 +-
 11 files changed, 150 insertions(+), 110 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/adc-keys.txt
 create mode 100644 Documentation/devicetree/bindings/input/adc-keys.yaml
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v2 1/5 dt-bindings: input: Increase maximum keycode value to 0x2ff

The maximum keycode value for Linux is 0x2ff, not 0xff. There's already users and examples with values greater than 0xff, but the schema is not yet applied in those cases.

---
 Documentation/devicetree/bindings/input/input.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/input/input.yaml +1 -1
index d41d8743aad4..43d2f299c332 100644
@@ -21,7 +21,7 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32-array
     items:
       minimum: 0
-      maximum: 0xff
+      maximum: 0x2ff
 
   poll-interval:
     description: Poll interval time in milliseconds.
Signature · 1 line
2.34.1
author maintainer
#5 lore raw

PATCH v2 2/5 dt-bindings: input: Centralize 'linux,code' definition

In reply to Rob Herring

Multiple bindings use 'linux,code', but there is not a central definition and type. Add 'linux,code' to input.yaml and update all the users to use it.

---
 .../devicetree/bindings/input/adc-joystick.yaml   |  2 +-
 .../input/allwinner,sun4i-a10-lradc-keys.yaml     |  5 ++---
 .../devicetree/bindings/input/azoteq,iqs7222.yaml |  7 ++-----
 .../devicetree/bindings/input/gpio-keys.yaml      |  1 -
 .../devicetree/bindings/input/input.yaml          |  8 ++++++++
 .../devicetree/bindings/input/iqs269a.yaml        | 15 ++++++---------
 .../devicetree/bindings/input/iqs626a.yaml        |  5 ++---
 .../devicetree/bindings/input/iqs62x-keys.yaml    |  5 ++---
 .../devicetree/bindings/input/max77650-onkey.yaml |  8 ++++----
 9 files changed, 27 insertions(+), 29 deletions(-)
Documentation/devicetree/bindings/input/adc-joystick.yaml +1 -1
index 2ee04e03bc22..64d961458ac7 100644
@@ -45,6 +45,7 @@ additionalProperties: false
 patternProperties:
   "^axis@[0-9a-f]+$":
     type: object
+    $ref: input.yaml#
     description: >
       Represents a joystick axis bound to the given ADC channel.
       For each entry in the io-channels list, one axis subnode with a matching
@@ -57,7 +58,6 @@ patternProperties:
         description: Index of an io-channels list entry bound to this axis.
 
       linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
         description: EV_ABS specific event code generated by the axis.
 
       abs-range:
Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml +2 -3
index 3399fc288afb..9700dc468b25 100644
@@ -44,14 +44,13 @@ properties:
 patternProperties:
   "^button-[0-9]+$":
     type: object
+    $ref: input.yaml#
     properties:
       label:
         $ref: /schemas/types.yaml#/definitions/string
         description: Descriptive name of the key
 
-      linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
-        description: Keycode to emit
+      linux,code: true
 
       channel:
         $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +2 -5
index a3a1e5a65306..5ea10fe7ffe9 100644
@@ -421,6 +421,7 @@ patternProperties:
     patternProperties:
       "^event-(prox|touch)$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity or touch event reported by the channel.
 
@@ -467,11 +468,7 @@ patternProperties:
               The IQS7222B does not feature channel-specific timeouts; the time-
               out specified for any one channel applies to all channels.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description:
-              Numeric key or switch code associated with the event. Specify
-              KEY_RESERVED (0) to opt out of event reporting.
+          linux,code: true
 
           linux,input-type:
             $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/gpio-keys.yaml +0 -1
index 7fe1966ea28a..cd07107fd5ed 100644
@@ -34,7 +34,6 @@ patternProperties:
 
         linux,code:
           description: Key / Axis code to emit.
-          $ref: /schemas/types.yaml#/definitions/uint32
 
         linux,input-type:
           description:
Documentation/devicetree/bindings/input/input.yaml +8 -0
index 43d2f299c332..e3701a0bc500 100644
@@ -23,6 +23,14 @@ properties:
       minimum: 0
       maximum: 0x2ff
 
+  linux,code:
+    description:
+      Specifies a single numeric keycode value to be used for reporting
+      button/switch events. Specify KEY_RESERVED (0) to opt out of event
+      reporting.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 0x2ff
+
   poll-interval:
     description: Poll interval time in milliseconds.
     $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/iqs269a.yaml +6 -9
index 9c154e5e1a91..c22f8f27913a 100644
@@ -370,6 +370,7 @@ patternProperties:
     patternProperties:
       "^event-prox(-alt)?$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity event reported by the channel in response to
           a decrease in counts. Node names suffixed with '-alt' instead corre-
@@ -396,14 +397,13 @@ patternProperties:
             default: 10
             description: Specifies the threshold for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
         additionalProperties: false
 
       "^event-touch(-alt)?$":
         type: object
+        $ref: input.yaml#
         description: Represents a touch event reported by the channel.
 
         properties:
@@ -421,14 +421,13 @@ patternProperties:
             default: 4
             description: Specifies the hysteresis for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
         additionalProperties: false
 
       "^event-deep(-alt)?$":
         type: object
+        $ref: input.yaml#
         description: Represents a deep-touch event reported by the channel.
 
         properties:
@@ -446,9 +445,7 @@ patternProperties:
             default: 0
             description: Specifies the hysteresis for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
         additionalProperties: false
 
Documentation/devicetree/bindings/input/iqs626a.yaml +2 -3
index 0cb736c541c9..e645521da8ba 100644
@@ -449,6 +449,7 @@ patternProperties:
     patternProperties:
       "^event-(prox|touch|deep)(-alt)?$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity, touch or deep-touch event reported by the
           channel in response to a decrease in counts. Node names suffixed with
@@ -487,9 +488,7 @@ patternProperties:
               Specifies the hysteresis for the event (touch and deep-touch
               events only).
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
           linux,input-type:
             $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/iqs62x-keys.yaml +2 -3
index 77fe3b545b35..e677e31fe8fe 100644
@@ -89,15 +89,14 @@ properties:
 patternProperties:
   "^hall-switch-(north|south)$":
     type: object
+    $ref: input.yaml#
     description:
       Represents north/south-field Hall-effect sensor touch or proximity
       events. Note that north/south-field orientation is reversed on the
       IQS620AXzCSR device due to its flip-chip package.
 
     properties:
-      linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
-        description: Numeric switch code associated with the event.
+      linux,code: true
 
       azoteq,use-prox:
         $ref: /schemas/types.yaml#/definitions/flag
Documentation/devicetree/bindings/input/max77650-onkey.yaml +4 -4
index 3a2ad6ec64db..48edc0c8c1dd 100644
@@ -16,15 +16,15 @@ description: |
   The onkey controller is represented as a sub-node of the PMIC node on
   the device tree.
 
+allOf:
+  - $ref: input.yaml#
+
 properties:
   compatible:
     const: maxim,max77650-onkey
 
   linux,code:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description:
-      The key-code to be reported when the key is pressed. Defaults
-      to KEY_POWER.
+    default: 116  # KEY_POWER
 
   maxim,onkey-slide:
     $ref: /schemas/types.yaml#/definitions/flag
Signature · 1 line
2.34.1
author maintainer
#9 lore raw

PATCH v2 3/5 dt-bindings: input: Use common 'linux,keycodes' definition

In reply to Rob Herring

The common input schema, input.yaml, already defines 'linux,keycodes' property. Update the users to use it.

---
 Documentation/devicetree/bindings/input/iqs626a.yaml     | 2 +-
 Documentation/devicetree/bindings/input/iqs62x-keys.yaml | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/input/iqs626a.yaml +1 -1
index e645521da8ba..008959f2d425 100644
@@ -510,6 +510,7 @@ patternProperties:
 
   "^trackpad-3x[2-3]$":
     type: object
+    $ref: input.yaml#
     description:
       Represents all channels associated with the trackpad. The channels are
       collectively active if the trackpad is defined and inactive otherwise.
@@ -678,7 +679,6 @@ patternProperties:
           Specifies the raw count filter strength during low-power mode.
 
       linux,keycodes:
-        $ref: /schemas/types.yaml#/definitions/uint32-array
         minItems: 1
         maxItems: 6
         description: |
Documentation/devicetree/bindings/input/iqs62x-keys.yaml +3 -1
index e677e31fe8fe..0aa951f0ab92 100644
@@ -9,6 +9,9 @@ title: Azoteq IQS620A/621/622/624/625 Keys and Switches
 maintainers:
   - Jeff LaBundy <[email protected]>
 
+allOf:
+  - $ref: input.yaml#
+
 description: |
   The Azoteq IQS620A, IQS621, IQS622, IQS624 and IQS625 multi-function sensors
   feature a variety of self-capacitive, mutual-inductive and Hall-effect sens-
@@ -30,7 +33,6 @@ properties:
       - azoteq,iqs625-keys
 
   linux,keycodes:
-    $ref: /schemas/types.yaml#/definitions/uint32-array
     minItems: 1
     maxItems: 16
     description: |
Signature · 1 line
2.34.1
author maintainer
#13 lore raw

PATCH v2 5/5 dt-bindings: input: Convert adc-keys to DT schema

In reply to Rob Herring

Convert the adc-keys binding to DT schema format.

The old binding has 'label' as required, but it should never be required given it's just a human readable description.

---
v2:
- Drop Heinrich as a maintainer
- Use common linux,code definition
- Drop label as required

---
 .../devicetree/bindings/input/adc-keys.txt    |  67 ------------
 .../devicetree/bindings/input/adc-keys.yaml   | 103 ++++++++++++++++++
 2 files changed, 103 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/adc-keys.txt
 create mode 100644 Documentation/devicetree/bindings/input/adc-keys.yaml
Documentation/devicetree/bindings/input/adc-keys.txt deleted +0 -67
deleted file mode 100644
index 6c8be6a9ace2..000000000000
@@ -1,67 +0,0 @@
-ADC attached resistor ladder buttons
-------------------------------------
-
-Required properties:
- - compatible: "adc-keys"
- - io-channels: Phandle to an ADC channel
- - io-channel-names = "buttons";
- - keyup-threshold-microvolt: Voltage above or equal to which all the keys are
-			      considered up.
-
-Optional properties:
-	- poll-interval: Poll interval time in milliseconds
-	- autorepeat: Boolean, Enable auto repeat feature of Linux input
-	  subsystem.
-
-Each button (key) is represented as a sub-node of "adc-keys":
-
-Required subnode-properties:
-	- label: Descriptive name of the key.
-	- linux,code: Keycode to emit.
-	- press-threshold-microvolt: voltage above or equal to which this key is
-				     considered pressed.
-
-No two values of press-threshold-microvolt may be the same.
-All values of press-threshold-microvolt must be less than
-keyup-threshold-microvolt.
-
-Example:
-
-#include <dt-bindings/input/input.h>
-
-	adc-keys {
-		compatible = "adc-keys";
-		io-channels = <&lradc 0>;
-		io-channel-names = "buttons";
-		keyup-threshold-microvolt = <2000000>;
-
-		button-up {
-			label = "Volume Up";
-			linux,code = <KEY_VOLUMEUP>;
-			press-threshold-microvolt = <1500000>;
-		};
-
-		button-down {
-			label = "Volume Down";
-			linux,code = <KEY_VOLUMEDOWN>;
-			press-threshold-microvolt = <1000000>;
-		};
-
-		button-enter {
-			label = "Enter";
-			linux,code = <KEY_ENTER>;
-			press-threshold-microvolt = <500000>;
-		};
-	};
-
-+--------------------------------+------------------------+
-| 2.000.000 <= value             | no key pressed         |
-+--------------------------------+------------------------+
-| 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed   |
-+--------------------------------+------------------------+
-| 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
-+--------------------------------+------------------------+
-|   500.000 <= value < 1.000.000 | KEY_ENTER pressed      |
-+--------------------------------+------------------------+
-|              value <   500.000 | no key pressed         |
-+--------------------------------+------------------------+
Documentation/devicetree/bindings/input/adc-keys.yaml new file +103 -0

103 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#11 lore raw

PATCH v2 4/5 dt-bindings: input: Centralize 'linux,input-type' definition

In reply to Rob Herring

Multiple bindings use 'linux,input-type', but there is not a central definition and type. Add 'linux,input-type' to input.yaml and update all the users to use it.

---
 .../devicetree/bindings/input/azoteq,iqs7222.yaml  |  1 -
 .../devicetree/bindings/input/gpio-keys.yaml       |  7 +------
 Documentation/devicetree/bindings/input/input.yaml | 14 ++++++++++++++
 .../devicetree/bindings/input/iqs626a.yaml         |  4 ----
 4 files changed, 15 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +0 -1
index 5ea10fe7ffe9..a13bd3e41dd3 100644
@@ -471,7 +471,6 @@ patternProperties:
           linux,code: true
 
           linux,input-type:
-            $ref: /schemas/types.yaml#/definitions/uint32
             enum: [1, 5]
             default: 1
             description:
Documentation/devicetree/bindings/input/gpio-keys.yaml +1 -6
index cd07107fd5ed..6b49b1afdd95 100644
@@ -36,12 +36,7 @@ patternProperties:
           description: Key / Axis code to emit.
 
         linux,input-type:
-          description:
-            Specify event type this button/key generates. If not specified defaults to
-            <1> == EV_KEY.
-          $ref: /schemas/types.yaml#/definitions/uint32
-
-          default: 1
+          default: 1  # EV_KEY
 
         linux,input-value:
           description: |
Documentation/devicetree/bindings/input/input.yaml +14 -0
index e3701a0bc500..17512f4347fd 100644
@@ -31,6 +31,17 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     maximum: 0x2ff
 
+  linux,input-type:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 1   # EV_KEY
+      - 2   # EV_REL
+      - 3   # EV_ABS
+      - 5   # EV_SW
+    description:
+      Specifies whether the event is to be interpreted as a key, relative,
+      absolute, or switch.
+
   poll-interval:
     description: Poll interval time in milliseconds.
     $ref: /schemas/types.yaml#/definitions/uint32
@@ -47,4 +58,7 @@ properties:
       reset automatically. Device with key pressed reset feature can specify
       this property.
 
+dependencies:
+  linux,input-type: [ "linux,code" ]
+
 additionalProperties: true
Documentation/devicetree/bindings/input/iqs626a.yaml +0 -4
index 008959f2d425..4df27646c980 100644
@@ -491,16 +491,12 @@ patternProperties:
           linux,code: true
 
           linux,input-type:
-            $ref: /schemas/types.yaml#/definitions/uint32
             enum: [1, 5]
             description:
               Specifies whether the event is to be interpreted as a key (1) or
               a switch (5). By default, Hall-channel events are interpreted as
               switches and all others are interpreted as keys.
 
-        dependencies:
-          linux,input-type: ["linux,code"]
-
         additionalProperties: false
 
     dependencies:
Signature · 1 line
2.34.1
Reviewed-by on v2 1/5
#2 lore raw

Re: [PATCH v2 1/5] dt-bindings: input: Increase maximum keycode value to 0x2ff

In reply to Rob Herring

Hi Rob,

Quoted 5 lines · Rob Herring

The maximum keycode value for Linux is 0x2ff, not 0xff. There's already users and examples with values greater than 0xff, but the schema is not yet applied in those cases.

As the creator of a few said examples:

Quoted 20 lines
---
 Documentation/devicetree/bindings/input/input.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/input/input.yaml +1 -1
index d41d8743aad4..43d2f299c332 100644
@@ -21,7 +21,7 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32-array
     items:
       minimum: 0
-      maximum: 0xff
+      maximum: 0x2ff
 
   poll-interval:
     description: Poll interval time in milliseconds.
Signature · 1 line
2.34.1

Thank you for driving this series.

Kind regards,
Jeff LaBundy

Acked-by on v2 2/5
#6 lore raw

Re: [PATCH v2 2/5] dt-bindings: input: Centralize 'linux,code' definition

In reply to Rob Herring

Hi Rob,

Quoted 5 lines · Rob Herring

Multiple bindings use 'linux,code', but there is not a central definition and type. Add 'linux,code' to input.yaml and update all the users to use it.

For *iqs*.yaml:

Quoted 238 lines
---
 .../devicetree/bindings/input/adc-joystick.yaml   |  2 +-
 .../input/allwinner,sun4i-a10-lradc-keys.yaml     |  5 ++---
 .../devicetree/bindings/input/azoteq,iqs7222.yaml |  7 ++-----
 .../devicetree/bindings/input/gpio-keys.yaml      |  1 -
 .../devicetree/bindings/input/input.yaml          |  8 ++++++++
 .../devicetree/bindings/input/iqs269a.yaml        | 15 ++++++---------
 .../devicetree/bindings/input/iqs626a.yaml        |  5 ++---
 .../devicetree/bindings/input/iqs62x-keys.yaml    |  5 ++---
 .../devicetree/bindings/input/max77650-onkey.yaml |  8 ++++----
 9 files changed, 27 insertions(+), 29 deletions(-)
Documentation/devicetree/bindings/input/adc-joystick.yaml +1 -1
index 2ee04e03bc22..64d961458ac7 100644
@@ -45,6 +45,7 @@ additionalProperties: false
 patternProperties:
   "^axis@[0-9a-f]+$":
     type: object
+    $ref: input.yaml#
     description: >
       Represents a joystick axis bound to the given ADC channel.
       For each entry in the io-channels list, one axis subnode with a matching
@@ -57,7 +58,6 @@ patternProperties:
         description: Index of an io-channels list entry bound to this axis.
 
       linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
         description: EV_ABS specific event code generated by the axis.
 
       abs-range:
Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml +2 -3
index 3399fc288afb..9700dc468b25 100644
@@ -44,14 +44,13 @@ properties:
 patternProperties:
   "^button-[0-9]+$":
     type: object
+    $ref: input.yaml#
     properties:
       label:
         $ref: /schemas/types.yaml#/definitions/string
         description: Descriptive name of the key
 
-      linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
-        description: Keycode to emit
+      linux,code: true
 
       channel:
         $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +2 -5
index a3a1e5a65306..5ea10fe7ffe9 100644
@@ -421,6 +421,7 @@ patternProperties:
     patternProperties:
       "^event-(prox|touch)$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity or touch event reported by the channel.
 
@@ -467,11 +468,7 @@ patternProperties:
               The IQS7222B does not feature channel-specific timeouts; the time-
               out specified for any one channel applies to all channels.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description:
-              Numeric key or switch code associated with the event. Specify
-              KEY_RESERVED (0) to opt out of event reporting.
+          linux,code: true
 
           linux,input-type:
             $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/gpio-keys.yaml +0 -1
index 7fe1966ea28a..cd07107fd5ed 100644
@@ -34,7 +34,6 @@ patternProperties:
 
         linux,code:
           description: Key / Axis code to emit.
-          $ref: /schemas/types.yaml#/definitions/uint32
 
         linux,input-type:
           description:
Documentation/devicetree/bindings/input/input.yaml +8 -0
index 43d2f299c332..e3701a0bc500 100644
@@ -23,6 +23,14 @@ properties:
       minimum: 0
       maximum: 0x2ff
 
+  linux,code:
+    description:
+      Specifies a single numeric keycode value to be used for reporting
+      button/switch events. Specify KEY_RESERVED (0) to opt out of event
+      reporting.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 0x2ff
+
   poll-interval:
     description: Poll interval time in milliseconds.
     $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/iqs269a.yaml +6 -9
index 9c154e5e1a91..c22f8f27913a 100644
@@ -370,6 +370,7 @@ patternProperties:
     patternProperties:
       "^event-prox(-alt)?$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity event reported by the channel in response to
           a decrease in counts. Node names suffixed with '-alt' instead corre-
@@ -396,14 +397,13 @@ patternProperties:
             default: 10
             description: Specifies the threshold for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
         additionalProperties: false
 
       "^event-touch(-alt)?$":
         type: object
+        $ref: input.yaml#
         description: Represents a touch event reported by the channel.
 
         properties:
@@ -421,14 +421,13 @@ patternProperties:
             default: 4
             description: Specifies the hysteresis for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
         additionalProperties: false
 
       "^event-deep(-alt)?$":
         type: object
+        $ref: input.yaml#
         description: Represents a deep-touch event reported by the channel.
 
         properties:
@@ -446,9 +445,7 @@ patternProperties:
             default: 0
             description: Specifies the hysteresis for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
         additionalProperties: false
 
Documentation/devicetree/bindings/input/iqs626a.yaml +2 -3
index 0cb736c541c9..e645521da8ba 100644
@@ -449,6 +449,7 @@ patternProperties:
     patternProperties:
       "^event-(prox|touch|deep)(-alt)?$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity, touch or deep-touch event reported by the
           channel in response to a decrease in counts. Node names suffixed with
@@ -487,9 +488,7 @@ patternProperties:
               Specifies the hysteresis for the event (touch and deep-touch
               events only).
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with the event.
+          linux,code: true
 
           linux,input-type:
             $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/iqs62x-keys.yaml +2 -3
index 77fe3b545b35..e677e31fe8fe 100644
@@ -89,15 +89,14 @@ properties:
 patternProperties:
   "^hall-switch-(north|south)$":
     type: object
+    $ref: input.yaml#
     description:
       Represents north/south-field Hall-effect sensor touch or proximity
       events. Note that north/south-field orientation is reversed on the
       IQS620AXzCSR device due to its flip-chip package.
 
     properties:
-      linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
-        description: Numeric switch code associated with the event.
+      linux,code: true
 
       azoteq,use-prox:
         $ref: /schemas/types.yaml#/definitions/flag
Documentation/devicetree/bindings/input/max77650-onkey.yaml +4 -4
index 3a2ad6ec64db..48edc0c8c1dd 100644
@@ -16,15 +16,15 @@ description: |
   The onkey controller is represented as a sub-node of the PMIC node on
   the device tree.
 
+allOf:
+  - $ref: input.yaml#
+
 properties:
   compatible:
     const: maxim,max77650-onkey
 
   linux,code:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description:
-      The key-code to be reported when the key is pressed. Defaults
-      to KEY_POWER.
+    default: 116  # KEY_POWER
 
   maxim,onkey-slide:
     $ref: /schemas/types.yaml#/definitions/flag
Signature · 1 line
2.34.1

Kind regards,
Jeff LaBundy

Acked-by on v2 3/5
#10 lore raw

Re: [PATCH v2 3/5] dt-bindings: input: Use common 'linux,keycodes' definition

In reply to Rob Herring

Hi Rob,

Quoted 4 lines · Rob Herring

The common input schema, input.yaml, already defines 'linux,keycodes' property. Update the users to use it.

Quoted 50 lines
---
 Documentation/devicetree/bindings/input/iqs626a.yaml     | 2 +-
 Documentation/devicetree/bindings/input/iqs62x-keys.yaml | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/input/iqs626a.yaml +1 -1
index e645521da8ba..008959f2d425 100644
@@ -510,6 +510,7 @@ patternProperties:
 
   "^trackpad-3x[2-3]$":
     type: object
+    $ref: input.yaml#
     description:
       Represents all channels associated with the trackpad. The channels are
       collectively active if the trackpad is defined and inactive otherwise.
@@ -678,7 +679,6 @@ patternProperties:
           Specifies the raw count filter strength during low-power mode.
 
       linux,keycodes:
-        $ref: /schemas/types.yaml#/definitions/uint32-array
         minItems: 1
         maxItems: 6
         description: |
Documentation/devicetree/bindings/input/iqs62x-keys.yaml +3 -1
index e677e31fe8fe..0aa951f0ab92 100644
@@ -9,6 +9,9 @@ title: Azoteq IQS620A/621/622/624/625 Keys and Switches
 maintainers:
   - Jeff LaBundy <[email protected]>
 
+allOf:
+  - $ref: input.yaml#
+
 description: |
   The Azoteq IQS620A, IQS621, IQS622, IQS624 and IQS625 multi-function sensors
   feature a variety of self-capacitive, mutual-inductive and Hall-effect sens-
@@ -30,7 +33,6 @@ properties:
       - azoteq,iqs625-keys
 
   linux,keycodes:
-    $ref: /schemas/types.yaml#/definitions/uint32-array
     minItems: 1
     maxItems: 16
     description: |
Signature · 1 line
2.34.1

Kind regards,
Jeff LaBundy

Acked-by on v2 4/5
#12 lore raw

Re: [PATCH v2 4/5] dt-bindings: input: Centralize 'linux,input-type' definition

In reply to Rob Herring

Hi Rob,

Quoted 5 lines · Rob Herring

Multiple bindings use 'linux,input-type', but there is not a central definition and type. Add 'linux,input-type' to input.yaml and update all the users to use it.

For *iqs*.yaml:

Quoted 91 lines
---
 .../devicetree/bindings/input/azoteq,iqs7222.yaml  |  1 -
 .../devicetree/bindings/input/gpio-keys.yaml       |  7 +------
 Documentation/devicetree/bindings/input/input.yaml | 14 ++++++++++++++
 .../devicetree/bindings/input/iqs626a.yaml         |  4 ----
 4 files changed, 15 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +0 -1
index 5ea10fe7ffe9..a13bd3e41dd3 100644
@@ -471,7 +471,6 @@ patternProperties:
           linux,code: true
 
           linux,input-type:
-            $ref: /schemas/types.yaml#/definitions/uint32
             enum: [1, 5]
             default: 1
             description:
Documentation/devicetree/bindings/input/gpio-keys.yaml +1 -6
index cd07107fd5ed..6b49b1afdd95 100644
@@ -36,12 +36,7 @@ patternProperties:
           description: Key / Axis code to emit.
 
         linux,input-type:
-          description:
-            Specify event type this button/key generates. If not specified defaults to
-            <1> == EV_KEY.
-          $ref: /schemas/types.yaml#/definitions/uint32
-
-          default: 1
+          default: 1  # EV_KEY
 
         linux,input-value:
           description: |
Documentation/devicetree/bindings/input/input.yaml +14 -0
index e3701a0bc500..17512f4347fd 100644
@@ -31,6 +31,17 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     maximum: 0x2ff
 
+  linux,input-type:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 1   # EV_KEY
+      - 2   # EV_REL
+      - 3   # EV_ABS
+      - 5   # EV_SW
+    description:
+      Specifies whether the event is to be interpreted as a key, relative,
+      absolute, or switch.
+
   poll-interval:
     description: Poll interval time in milliseconds.
     $ref: /schemas/types.yaml#/definitions/uint32
@@ -47,4 +58,7 @@ properties:
       reset automatically. Device with key pressed reset feature can specify
       this property.
 
+dependencies:
+  linux,input-type: [ "linux,code" ]
+
 additionalProperties: true
Documentation/devicetree/bindings/input/iqs626a.yaml +0 -4
index 008959f2d425..4df27646c980 100644
@@ -491,16 +491,12 @@ patternProperties:
           linux,code: true
 
           linux,input-type:
-            $ref: /schemas/types.yaml#/definitions/uint32
             enum: [1, 5]
             description:
               Specifies whether the event is to be interpreted as a key (1) or
               a switch (5). By default, Hall-channel events are interpreted as
               switches and all others are interpreted as keys.
 
-        dependencies:
-          linux,input-type: ["linux,code"]
-
         additionalProperties: false
 
     dependencies:
Signature · 1 line
2.34.1

Kind regards,
Jeff LaBundy

#3 lore raw

Re: [PATCH v2 1/5] dt-bindings: input: Increase maximum keycode value to 0x2ff

In reply to Rob Herring
Quoted 14 lines · Rob Herring

The maximum keycode value for Linux is 0x2ff, not 0xff. There's already users and examples with values greater than 0xff, but the schema is not yet applied in those cases.

---
  Documentation/devicetree/bindings/input/input.yaml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/input/input.yaml +0 -0
index d41d8743aad4..43d2f299c332 100644

Documentation/devicetree/bindings/input/input.yaml properties: · line 24

Quoted 5 lines
Documentation/devicetree/bindings/input/input.yaml +1 -1
@@ -21,7 +21,7 @@ properties:
      $ref: /schemas/types.yaml#/definitions/uint32-array
      items:
        minimum: 0
-      maximum: 0xff
+      maximum: 0x2ff

Can this value of 0x2ff be make exportable such that we can use it as a reference in devicetree/bindings/input/adc-keys.yaml. E.g. define a type that only take values in the 0-0x2ff range?

Best regards

Heinrich

Quoted 3 lines
Documentation/devicetree/bindings/input/input.yaml +0 -0
    poll-interval:
      description: Poll interval time in milliseconds.
#14 lore raw

Re: [PATCH v2 5/5] dt-bindings: input: Convert adc-keys to DT schema

In reply to Rob Herring
Quoted 130 lines · Rob Herring

Convert the adc-keys binding to DT schema format.

The old binding has 'label' as required, but it should never be required given it's just a human readable description.

---
v2:
- Drop Heinrich as a maintainer
- Use common linux,code definition
- Drop label as required

---
  .../devicetree/bindings/input/adc-keys.txt    |  67 ------------
  .../devicetree/bindings/input/adc-keys.yaml   | 103 ++++++++++++++++++
  2 files changed, 103 insertions(+), 67 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/input/adc-keys.txt create mode 100644 Documentation/devicetree/bindings/input/adc-keys.yaml

Documentation/devicetree/bindings/input/adc-keys.txt deleted +0 -67
deleted file mode 100644
index 6c8be6a9ace2..000000000000
@@ -1,67 +0,0 @@
-ADC attached resistor ladder buttons
-------------------------------------
-
-Required properties:
- - compatible: "adc-keys"
- - io-channels: Phandle to an ADC channel
- - io-channel-names = "buttons";
- - keyup-threshold-microvolt: Voltage above or equal to which all the keys are
-			      considered up.
-
-Optional properties:
-	- poll-interval: Poll interval time in milliseconds
-	- autorepeat: Boolean, Enable auto repeat feature of Linux input
-	  subsystem.
-
-Each button (key) is represented as a sub-node of "adc-keys":
-
-Required subnode-properties:
-	- label: Descriptive name of the key.
-	- linux,code: Keycode to emit.
-	- press-threshold-microvolt: voltage above or equal to which this key is
-				     considered pressed.
-
-No two values of press-threshold-microvolt may be the same.
-All values of press-threshold-microvolt must be less than
-keyup-threshold-microvolt.
-
-Example:
-
-#include <dt-bindings/input/input.h>
-
-	adc-keys {
-		compatible = "adc-keys";
-		io-channels = <&lradc 0>;
-		io-channel-names = "buttons";
-		keyup-threshold-microvolt = <2000000>;
-
-		button-up {
-			label = "Volume Up";
-			linux,code = <KEY_VOLUMEUP>;
-			press-threshold-microvolt = <1500000>;
-		};
-
-		button-down {
-			label = "Volume Down";
-			linux,code = <KEY_VOLUMEDOWN>;
-			press-threshold-microvolt = <1000000>;
-		};
-
-		button-enter {
-			label = "Enter";
-			linux,code = <KEY_ENTER>;
-			press-threshold-microvolt = <500000>;
-		};
-	};
-
-+--------------------------------+------------------------+
-| 2.000.000 <= value             | no key pressed         |
-+--------------------------------+------------------------+
-| 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed   |
-+--------------------------------+------------------------+
-| 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
-+--------------------------------+------------------------+
-|   500.000 <= value < 1.000.000 | KEY_ENTER pressed      |
-+--------------------------------+------------------------+
-|              value <   500.000 | no key pressed         |
-+--------------------------------+------------------------+
Documentation/devicetree/bindings/input/adc-keys.yaml new file +33 -0
new file mode 100644
index 000000000000..7aa078dead37
@@ -0,0 +1,103 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/adc-keys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ADC attached resistor ladder buttons
+
+maintainers:
+  - Alexandre Belloni <[email protected]>
+
+allOf:
+  - $ref: input.yaml#
+
+properties:
+  compatible:
+    const: adc-keys
+
+  io-channels:
+    maxItems: 1
+
+  io-channel-names:
+    const: buttons
+
+  keyup-threshold-microvolt:
+    description:
+      Voltage above or equal to which all the keys are considered up.
+
+  poll-interval: true
+  autorepeat: true
+
+patternProperties:
+  '^button-':

Documentation/devicetree/bindings/input/adc-keys.yaml line 43

Quoted 10 lines
Documentation/devicetree/bindings/input/adc-keys.yaml new file +10 -0
+    type: object
+    $ref: input.yaml#
+    additionalProperties: false
+    description:
+      Each button (key) is represented as a sub-node.
+
+    properties:
+      label: true
+
+      linux,code: true

Can we provide a reference to a new type in Documentation/devicetree/bindings/input/input.yaml limiting the range to 0 - 0x2ff?

Best regards

Heinrich

Quoted 60 lines
Documentation/devicetree/bindings/input/adc-keys.yaml new file +60 -0
+
+      press-threshold-microvolt:
+        description:
+          Voltage above or equal to which this key is considered pressed. No
+          two values of press-threshold-microvolt may be the same. All values
+          of press-threshold-microvolt must be less than
+          keyup-threshold-microvolt.
+
+    required:
+      - linux,code
+      - press-threshold-microvolt
+
+required:
+  - compatible
+  - io-channels
+  - io-channel-names
+  - keyup-threshold-microvolt
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/input/input.h>
+    // +--------------------------------+------------------------+
+    // | 2.000.000 <= value             | no key pressed         |
+    // +--------------------------------+------------------------+
+    // | 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed   |
+    // +--------------------------------+------------------------+
+    // | 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
+    // +--------------------------------+------------------------+
+    // |   500.000 <= value < 1.000.000 | KEY_ENTER pressed      |
+    // +--------------------------------+------------------------+
+    // |              value <   500.000 | no key pressed         |
+    // +--------------------------------+------------------------+
+
+    adc-keys {
+        compatible = "adc-keys";
+        io-channels = <&lradc 0>;
+        io-channel-names = "buttons";
+        keyup-threshold-microvolt = <2000000>;
+
+        button-up {
+            label = "Volume Up";
+            linux,code = <KEY_VOLUMEUP>;
+            press-threshold-microvolt = <1500000>;
+        };
+
+        button-down {
+            label = "Volume Down";
+            linux,code = <KEY_VOLUMEDOWN>;
+            press-threshold-microvolt = <1000000>;
+        };
+
+        button-enter {
+            label = "Enter";
+            linux,code = <KEY_ENTER>;
+            press-threshold-microvolt = <500000>;
+        };
+    };
+...
author maintainer
#4 lore raw

Re: [PATCH v2 1/5] dt-bindings: input: Increase maximum keycode value to 0x2ff

In reply to Heinrich Schuchardt
Quoted 10 lines · Heinrich Schuchardt
Quoted 9 lines · Rob Herring

The maximum keycode value for Linux is 0x2ff, not 0xff. There's already users and examples with values greater than 0xff, but the schema is not yet applied in those cases.

---
  Documentation/devicetree/bindings/input/input.yaml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

Documentation/devicetree/bindings/input/input.yaml properties: · line 24

Quoted 10 lines
Documentation/devicetree/bindings/input/input.yaml +1 -1
index d41d8743aad4..43d2f299c332 100644
@@ -21,7 +21,7 @@ properties:
      $ref: /schemas/types.yaml#/definitions/uint32-array
      items:
        minimum: 0
-      maximum: 0xff
+      maximum: 0x2ff

Can this value of 0x2ff be make exportable such that we can use it as a reference in devicetree/bindings/input/adc-keys.yaml. E.g. define a type that only take values in the 0-0x2ff range?

There's no need. The $ref to input.yaml in does that effectively already. That's why 'linux,code' doesn't need any schema constraints unless it has additional constraints. max77650-onkey.yaml in patch 2 has an example of that. If you wanted to add a new, custom property with those constraints, then we could do something like this:

$defs:
input-codes:

    minimum: 0
    maximum: 0x2ff
    ...

And then have: $ref: input.yaml#/$defs/input-codes

Rob

Acked-by on v2 2/5
#7 lore raw

Re: [PATCH v2 2/5] dt-bindings: input: Centralize 'linux,code' definition

In reply to Rob Herring
Quoted 5 lines · Rob Herring

Multiple bindings use 'linux,code', but there is not a central definition and type. Add 'linux,code' to input.yaml and update all the users to use it.

For adc-joystick.yaml:

Quoted 270 lines
---
 .../devicetree/bindings/input/adc-joystick.yaml   |  2 +-
 .../input/allwinner,sun4i-a10-lradc-keys.yaml     |  5 ++---
 .../devicetree/bindings/input/azoteq,iqs7222.yaml |  7 ++-----
 .../devicetree/bindings/input/gpio-keys.yaml      |  1 -
 .../devicetree/bindings/input/input.yaml          |  8 ++++++++
 .../devicetree/bindings/input/iqs269a.yaml        | 15 ++++++---------
 .../devicetree/bindings/input/iqs626a.yaml        |  5 ++---
 .../devicetree/bindings/input/iqs62x-keys.yaml    |  5 ++---
 .../devicetree/bindings/input/max77650-onkey.yaml |  8 ++++----
 9 files changed, 27 insertions(+), 29 deletions(-)
Documentation/devicetree/bindings/input/adc-joystick.yaml +1 -0
index 2ee04e03bc22..64d961458ac7 100644
@@ -45,6 +45,7 @@ additionalProperties: false
 patternProperties:
   "^axis@[0-9a-f]+$":
     type: object
+    $ref: input.yaml#
     description: >
       Represents a joystick axis bound to the given ADC channel.
       For each entry in the io-channels list, one axis subnode with a 

matching

Documentation/devicetree/bindings/input/adc-joystick.yaml +0 -0
@@ -57,7 +58,6 @@ patternProperties:
         description: Index of an io-channels list entry bound to this 

axis.

linux,code:
- $ref: /schemas/types.yaml#/definitions/uint32
description: EV_ABS specific event code generated by the axis.

abs-range:
diff --git a/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml b/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml index 3399fc288afb..9700dc468b25 100644
---
a/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml
+++
b/Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml

Documentation/devicetree/bindings/input/adc-joystick.yaml +2 -3
@@ -44,14 +44,13 @@ properties:
 patternProperties:
   "^button-[0-9]+$":
     type: object
+    $ref: input.yaml#
     properties:
       label:
         $ref: /schemas/types.yaml#/definitions/string
         description: Descriptive name of the key
 
-      linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
-        description: Keycode to emit
+      linux,code: true
 
       channel:
         $ref: /schemas/types.yaml#/definitions/uint32

diff --git a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml index a3a1e5a65306..5ea10fe7ffe9 100644

Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +1 -0
@@ -421,6 +421,7 @@ patternProperties:
     patternProperties:
       "^event-(prox|touch)$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity or touch event reported by the 

channel.

Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +0 -0
@@ -467,11 +468,7 @@ patternProperties:
               The IQS7222B does not feature channel-specific

timeouts; the time-
out specified for any one channel applies to all
channels.

Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +0 -4
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description:
-              Numeric key or switch code associated with the event. 

Specify

Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +1 -1
-              KEY_RESERVED (0) to opt out of event reporting.
+          linux,code: true
 
           linux,input-type:
             $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/gpio-keys.yaml +0 -1
index 7fe1966ea28a..cd07107fd5ed 100644
@@ -34,7 +34,6 @@ patternProperties:
 
         linux,code:
           description: Key / Axis code to emit.
-          $ref: /schemas/types.yaml#/definitions/uint32
 
         linux,input-type:
           description:
Documentation/devicetree/bindings/input/input.yaml +3 -0
index 43d2f299c332..e3701a0bc500 100644
@@ -23,6 +23,14 @@ properties:
       minimum: 0
       maximum: 0x2ff
 
+  linux,code:
+    description:
+      Specifies a single numeric keycode value to be used for 

reporting
+ button/switch events. Specify KEY_RESERVED (0) to opt out of
event

Documentation/devicetree/bindings/input/input.yaml +4 -0
+      reporting.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 0x2ff
+
   poll-interval:
     description: Poll interval time in milliseconds.
     $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/iqs269a.yaml +1 -0
index 9c154e5e1a91..c22f8f27913a 100644
@@ -370,6 +370,7 @@ patternProperties:
     patternProperties:
       "^event-prox(-alt)?$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity event reported by the channel in 

response to
a decrease in counts. Node names suffixed with '-alt'
instead corre-

Documentation/devicetree/bindings/input/iqs269a.yaml +0 -3
@@ -396,14 +397,13 @@ patternProperties:
             default: 10
             description: Specifies the threshold for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with 

the event.

Documentation/devicetree/bindings/input/iqs269a.yaml +2 -3
+          linux,code: true
 
         additionalProperties: false
 
       "^event-touch(-alt)?$":
         type: object
+        $ref: input.yaml#
         description: Represents a touch event reported by the channel.
 
         properties:
@@ -421,14 +421,13 @@ patternProperties:
             default: 4
             description: Specifies the hysteresis for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with 

the event.

Documentation/devicetree/bindings/input/iqs269a.yaml +2 -0
+          linux,code: true
 
         additionalProperties: false
 
       "^event-deep(-alt)?$":
         type: object
+        $ref: input.yaml#
         description: Represents a deep-touch event reported by the 

channel.

properties:

Documentation/devicetree/bindings/input/iqs269a.yaml +0 -3
@@ -446,9 +445,7 @@ patternProperties:
             default: 0
             description: Specifies the hysteresis for the event.
 
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with 

the event.

Documentation/devicetree/bindings/input/iqs269a.yaml +1 -0
+          linux,code: true
 
         additionalProperties: false
Documentation/devicetree/bindings/input/iqs626a.yaml +1 -0
index 0cb736c541c9..e645521da8ba 100644
@@ -449,6 +449,7 @@ patternProperties:
     patternProperties:
       "^event-(prox|touch|deep)(-alt)?$":
         type: object
+        $ref: input.yaml#
         description:
           Represents a proximity, touch or deep-touch event reported 

by the
channel in response to a decrease in counts. Node names
suffixed with

Documentation/devicetree/bindings/input/iqs626a.yaml +0 -0
@@ -487,9 +488,7 @@ patternProperties:
               Specifies the hysteresis for the event (touch and 

deep-touch
events only).

Documentation/devicetree/bindings/input/iqs626a.yaml +0 -3
-          linux,code:
-            $ref: /schemas/types.yaml#/definitions/uint32
-            description: Numeric key or switch code associated with 

the event.

Documentation/devicetree/bindings/input/iqs626a.yaml +1 -0
+          linux,code: true
 
           linux,input-type:
             $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/input/iqs62x-keys.yaml +1 -0
index 77fe3b545b35..e677e31fe8fe 100644
@@ -89,15 +89,14 @@ properties:
 patternProperties:
   "^hall-switch-(north|south)$":
     type: object
+    $ref: input.yaml#
     description:
       Represents north/south-field Hall-effect sensor touch or 

proximity
events. Note that north/south-field orientation is reversed on
the
IQS620AXzCSR device due to its flip-chip package.

properties:

Documentation/devicetree/bindings/input/iqs62x-keys.yaml +1 -3
-      linux,code:
-        $ref: /schemas/types.yaml#/definitions/uint32
-        description: Numeric switch code associated with the event.
+      linux,code: true
 
       azoteq,use-prox:
         $ref: /schemas/types.yaml#/definitions/flag

diff --git a/Documentation/devicetree/bindings/input/max77650-onkey.yaml b/Documentation/devicetree/bindings/input/max77650-onkey.yaml index 3a2ad6ec64db..48edc0c8c1dd 100644

Documentation/devicetree/bindings/input/max77650-onkey.yaml +0 -0
@@ -16,15 +16,15 @@ description: |
   The onkey controller is represented as a sub-node of the PMIC node 

on
the device tree.

Documentation/devicetree/bindings/input/max77650-onkey.yaml +4 -4
+allOf:
+  - $ref: input.yaml#
+
 properties:
   compatible:
     const: maxim,max77650-onkey
 
   linux,code:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description:
-      The key-code to be reported when the key is pressed. Defaults
-      to KEY_POWER.
+    default: 116  # KEY_POWER
 
   maxim,onkey-slide:
     $ref: /schemas/types.yaml#/definitions/flag
author maintainer
#15 lore raw
In reply to Rob Herring
Quoted 14 lines · Rob Herring

This series refactors the common 'linux,code', 'linux,keycodes', and 'linux,input-type' properties defined in various binding schemas. As the properties are common, they should only have a single common schema type definition. Note that 'linux,input-value' was not included here as it is only used in 1 binding (gpio-keys).

The clean-ups are are result of the discussion on v1 of the adc-keys binding conversion[1].

Rob

[1] https://lore.kernel.org/all/[email protected]/

Quoted 6 lines

Rob Herring (5):
dt-bindings: input: Increase maximum keycode value to 0x2ff
dt-bindings: input: Centralize 'linux,code' definition
dt-bindings: input: Use common 'linux,keycodes' definition
dt-bindings: input: Centralize 'linux,input-type' definition
dt-bindings: input: Convert adc-keys to DT schema

Dmitry, Any comments on this?

Rob

maintainer Acked-by on v2 2/5
#8 lore raw

Re: [PATCH v2 2/5] dt-bindings: input: Centralize 'linux,code' definition

In reply to Rob Herring
Quoted 8 lines · Rob Herring

Multiple bindings use 'linux,code', but there is not a central definition and type. Add 'linux,code' to input.yaml and update all the users to use it.

---
 .../devicetree/bindings/input/adc-joystick.yaml   |  2 +-
 .../input/allwinner,sun4i-a10-lradc-keys.yaml     |  5 ++---

For allwinner,sun4i-a10-lradc-keys.yaml:

Quoted 8 lines
 .../devicetree/bindings/input/azoteq,iqs7222.yaml |  7 ++-----
 .../devicetree/bindings/input/gpio-keys.yaml      |  1 -
 .../devicetree/bindings/input/input.yaml          |  8 ++++++++
 .../devicetree/bindings/input/iqs269a.yaml        | 15 ++++++---------
 .../devicetree/bindings/input/iqs626a.yaml        |  5 ++---
 .../devicetree/bindings/input/iqs62x-keys.yaml    |  5 ++---
 .../devicetree/bindings/input/max77650-onkey.yaml |  8 ++++----
 9 files changed, 27 insertions(+), 29 deletions(-)
maintainer
#16 lore raw
In reply to Rob Herring
Quoted 15 lines · Rob Herring
Quoted 14 lines · Rob Herring

This series refactors the common 'linux,code', 'linux,keycodes', and 'linux,input-type' properties defined in various binding schemas. As the properties are common, they should only have a single common schema type definition. Note that 'linux,input-value' was not included here as it is only used in 1 binding (gpio-keys).

The clean-ups are are result of the discussion on v1 of the adc-keys binding conversion[1].

Rob

[1] https://lore.kernel.org/all/[email protected]/

Quoted 8 lines
Quoted 6 lines

Rob Herring (5):
dt-bindings: input: Increase maximum keycode value to 0x2ff
dt-bindings: input: Centralize 'linux,code' definition
dt-bindings: input: Use common 'linux,keycodes' definition
dt-bindings: input: Centralize 'linux,input-type' definition
dt-bindings: input: Convert adc-keys to DT schema

Dmitry, Any comments on this?

Sorry, applied the lot, thank you.

Signature · 1 line
Dmitry