GPIO attached keys
Schema identifier ($id): "http://devicetree.org/schemas/input/gpio-keys.yaml#"
Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"
Maintainers (maintainers): "Rob Herring <robh@kernel.org>"
Properties and child nodes (properties) #
compatible — not listed as required here #
Allowed values (enum): "gpio-keys", "gpio-keys-polled"
autorepeat — not listed as required here #
true — No constraints added by this property rule.
label — not listed as required here #
Name of entire device
poll-interval — not listed as required here #
true — No constraints added by this property rule.
Properties matching a name pattern (patternProperties) #
^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$ — name matches this regular expression #
Shared schema rule ($ref): input.yaml#
Properties and child nodes (properties) #
gpios — not listed as required here
Maximum number of items (maxItems): 1
interrupts — not listed as required here
Exactly one of these rules must match (oneOf)
Rule 1
Array item rules (
items)Item 1
Optional key interrupt or wakeup interrupt
Rule 2
Array item rules (
items)Item 1
Key interrupt
Item 2
Wakeup interrupt
interrupt-names — not listed as required here
Optional interrupt names, can be used to specify a separate dedicated wake-up interrupt in addition to the gpio irq
Exactly one of these rules must match (oneOf)
Rule 1
Array item rules (
items)Item 1
Rule 2
Array item rules (
items)Item 1
Exact value (
const):"irq"Item 2
Exact value (
const):"wakeup"
label — not listed as required here
Descriptive name of the key.
linux,code — required here
Key / Axis code to emit.
linux,input-type — not listed as required here
Default value (default): 1
linux,input-value — not listed as required here
If linux,input-type is EV_ABS or EV_REL then this value is sent for events this button generates when pressed. EV_ABS/EV_REL axis will generate an event with a value of 0 when all buttons with linux,input-type == type and linux,code == axis are released. This value is interpreted as a signed 32 bit value, e.g. to make a button generate a value of -1 use:
linux,input-value = <0xffffffff>; /* -1 */
Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32
debounce-interval — not listed as required here
Debouncing interval time in milliseconds. If not specified defaults to 5.
Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32
Default value (default): 5
wakeup-source — not listed as required here
Button can wake-up the system.
wakeup-event-action — not listed as required here
Specifies whether the key should wake the system when asserted, when deasserted, or both. This property is only valid for keys that wake up the system (e.g., when the "wakeup-source" property is also provided).
Supported values are defined in linux-event-codes.h:
EV_ACT_ANY - both asserted and deasserted
EV_ACT_ASSERTED - asserted
EV_ACT_DEASSERTED - deasserted
Shared schema rule ($ref): /schemas/types.yaml#/definitions/uint32
Allowed values (enum): 0, 1, 2
linux,can-disable — not listed as required here
Indicates that button is connected to dedicated (not shared) interrupt which can be disabled to suppress events from the button.
Value type (type): "boolean"
Required in this object (required): "linux,code"
At least one of these rules must match (anyOf) #
Rule 1
Rule 2
Rule 3
All of these rules must match (allOf) #
Rule 1
Condition (
if)Properties and child nodes (
properties)
interrupts— required hereMinimum number of items (
minItems):2When the condition matches (
then)Properties and child nodes (
properties)
interrupt-names— required hereMinimum number of items (
minItems):2
Property dependencies (dependencies) #
wakeup-event-action — applies when this property is present
Also requires: "wakeup-source"
linux,input-value — applies when this property is present
Also requires: "gpios"
Properties not evaluated by applicable rules (unevaluatedProperties) #
false
Not allowed by this rule.
All of these rules must match (allOf) #
Rule 1 #
Shared schema rule (
$ref):input.yaml#
Rule 2 #
Condition (
if) #Properties and child nodes (
properties)
compatible— not listed as required hereExact value (
const):"gpio-keys-polled"When the condition matches (
then) #When the condition does not match (
else) #Properties and child nodes (
properties)
poll-interval— not listed as required here
false— Not permitted by this property rule.
Properties not matched by properties or patternProperties in this schema (additionalProperties) #
false
Not allowed by this rule.
Examples (examples) #
#include <dt-bindings/interrupt-controller/irq.h>
gpio-keys {
compatible = "gpio-keys";
autorepeat;
key-up {
label = "GPIO Key UP";
linux,code = <103>;
gpios = <&gpio1 0 1>;
};
key-down {
label = "GPIO Key DOWN";
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;
};
};
Source notes #
Annotations retained from the schema source
Line 1: SPDX-License-Identifier: GPL-2.0-only
Line 59: EV_KEY