Skip to content

Commit 5eb5652

Browse files
krzkdtor
authored andcommitted
dt-bindings: input: gpio-keys: enforce node names to match all properties
The gpio-keys DT schema matches all properties with a wide pattern and applies specific schema to children. This has drawback - all regular properties are also matched and are silently ignored, even if they are not described in schema. Basically this allows any non-object property to be present. Enforce specific naming pattern for children (keys) to narrow the pattern thus do not match other properties. This will require all children to be properly prefixed or suffixed (button, event, switch or key). Removal of "if:" within patternProperties causes drop of one indentation level, but there are no other changes in the affected block. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 538c640 commit 5eb5652

File tree

1 file changed

+77
-80
lines changed

1 file changed

+77
-80
lines changed

Documentation/devicetree/bindings/input/gpio-keys.yaml

Lines changed: 77 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -16,86 +16,83 @@ properties:
1616
- gpio-keys-polled
1717

1818
patternProperties:
19-
".*":
20-
if:
21-
type: object
22-
then:
23-
$ref: input.yaml#
24-
25-
properties:
26-
gpios:
27-
maxItems: 1
28-
29-
interrupts:
30-
maxItems: 1
31-
32-
label:
33-
description: Descriptive name of the key.
34-
35-
linux,code:
36-
description: Key / Axis code to emit.
37-
38-
linux,input-type:
39-
default: 1 # EV_KEY
40-
41-
linux,input-value:
42-
description: |
43-
If linux,input-type is EV_ABS or EV_REL then this
44-
value is sent for events this button generates when pressed.
45-
EV_ABS/EV_REL axis will generate an event with a value of 0
46-
when all buttons with linux,input-type == type and
47-
linux,code == axis are released. This value is interpreted
48-
as a signed 32 bit value, e.g. to make a button generate a
49-
value of -1 use:
50-
51-
linux,input-value = <0xffffffff>; /* -1 */
52-
53-
$ref: /schemas/types.yaml#/definitions/uint32
54-
55-
debounce-interval:
56-
description:
57-
Debouncing interval time in milliseconds. If not specified defaults to 5.
58-
$ref: /schemas/types.yaml#/definitions/uint32
59-
60-
default: 5
61-
62-
wakeup-source:
63-
description: Button can wake-up the system.
64-
65-
wakeup-event-action:
66-
description: |
67-
Specifies whether the key should wake the system when asserted, when
68-
deasserted, or both. This property is only valid for keys that wake up the
69-
system (e.g., when the "wakeup-source" property is also provided).
70-
71-
Supported values are defined in linux-event-codes.h:
72-
73-
EV_ACT_ANY - both asserted and deasserted
74-
EV_ACT_ASSERTED - asserted
75-
EV_ACT_DEASSERTED - deasserted
76-
$ref: /schemas/types.yaml#/definitions/uint32
77-
enum: [0, 1, 2]
78-
79-
linux,can-disable:
80-
description:
81-
Indicates that button is connected to dedicated (not shared) interrupt
82-
which can be disabled to suppress events from the button.
83-
type: boolean
84-
85-
required:
86-
- linux,code
87-
88-
anyOf:
89-
- required:
90-
- interrupts
91-
- required:
92-
- gpios
93-
94-
dependencies:
95-
wakeup-event-action: [ wakeup-source ]
96-
linux,input-value: [ gpios ]
97-
98-
unevaluatedProperties: false
19+
"^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$":
20+
$ref: input.yaml#
21+
22+
properties:
23+
gpios:
24+
maxItems: 1
25+
26+
interrupts:
27+
maxItems: 1
28+
29+
label:
30+
description: Descriptive name of the key.
31+
32+
linux,code:
33+
description: Key / Axis code to emit.
34+
35+
linux,input-type:
36+
default: 1 # EV_KEY
37+
38+
linux,input-value:
39+
description: |
40+
If linux,input-type is EV_ABS or EV_REL then this
41+
value is sent for events this button generates when pressed.
42+
EV_ABS/EV_REL axis will generate an event with a value of 0
43+
when all buttons with linux,input-type == type and
44+
linux,code == axis are released. This value is interpreted
45+
as a signed 32 bit value, e.g. to make a button generate a
46+
value of -1 use:
47+
48+
linux,input-value = <0xffffffff>; /* -1 */
49+
50+
$ref: /schemas/types.yaml#/definitions/uint32
51+
52+
debounce-interval:
53+
description:
54+
Debouncing interval time in milliseconds. If not specified defaults to 5.
55+
$ref: /schemas/types.yaml#/definitions/uint32
56+
57+
default: 5
58+
59+
wakeup-source:
60+
description: Button can wake-up the system.
61+
62+
wakeup-event-action:
63+
description: |
64+
Specifies whether the key should wake the system when asserted, when
65+
deasserted, or both. This property is only valid for keys that wake up the
66+
system (e.g., when the "wakeup-source" property is also provided).
67+
68+
Supported values are defined in linux-event-codes.h:
69+
70+
EV_ACT_ANY - both asserted and deasserted
71+
EV_ACT_ASSERTED - asserted
72+
EV_ACT_DEASSERTED - deasserted
73+
$ref: /schemas/types.yaml#/definitions/uint32
74+
enum: [0, 1, 2]
75+
76+
linux,can-disable:
77+
description:
78+
Indicates that button is connected to dedicated (not shared) interrupt
79+
which can be disabled to suppress events from the button.
80+
type: boolean
81+
82+
required:
83+
- linux,code
84+
85+
anyOf:
86+
- required:
87+
- interrupts
88+
- required:
89+
- gpios
90+
91+
dependencies:
92+
wakeup-event-action: [ wakeup-source ]
93+
linux,input-value: [ gpios ]
94+
95+
unevaluatedProperties: false
9996

10097
if:
10198
properties:

0 commit comments

Comments
 (0)