^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) %YAML 1.2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ---
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) $id: http://devicetree.org/schemas/input/gpio-keys.yaml#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) $schema: http://devicetree.org/meta-schemas/core.yaml#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) title: Device-Tree bindings for GPIO attached keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) maintainers:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) - Rob Herring <robh@kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) compatible:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) enum:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) - gpio-keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) - gpio-keys-polled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) patternProperties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ".*":
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) if:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) type: object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) then:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) $ref: input.yaml#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) gpios:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) maxItems: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) interrupts:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) maxItems: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) label:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) description: Descriptive name of the key.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) linux,code:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) description: Key / Axis code to emit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) $ref: /schemas/types.yaml#definitions/uint32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) linux,input-type:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) Specify event type this button/key generates. If not specified defaults to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) <1> == EV_KEY.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) $ref: /schemas/types.yaml#definitions/uint32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) default: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) linux,input-value:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) description: |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) If linux,input-type is EV_ABS or EV_REL then this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) value is sent for events this button generates when pressed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) EV_ABS/EV_REL axis will generate an event with a value of 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) when all buttons with linux,input-type == type and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) linux,code == axis are released. This value is interpreted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) as a signed 32 bit value, e.g. to make a button generate a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) value of -1 use:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) linux,input-value = <0xffffffff>; /* -1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) $ref: /schemas/types.yaml#definitions/uint32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) debounce-interval:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Debouncing interval time in milliseconds. If not specified defaults to 5.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) $ref: /schemas/types.yaml#definitions/uint32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) default: 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) wakeup-source:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) description: Button can wake-up the system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) wakeup-event-action:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) description: |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) Specifies whether the key should wake the system when asserted, when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) deasserted, or both. This property is only valid for keys that wake up the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) system (e.g., when the "wakeup-source" property is also provided).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) Supported values are defined in linux-event-codes.h:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) EV_ACT_ANY - both asserted and deasserted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) EV_ACT_ASSERTED - asserted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) EV_ACT_DEASSERTED - deasserted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) $ref: /schemas/types.yaml#definitions/uint32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) enum: [0, 1, 2]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) linux,can-disable:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) Indicates that button is connected to dedicated (not shared) interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) which can be disabled to suppress events from the button.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) type: boolean
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) pinctrl-0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) maxItems: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) pinctrl-names:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) maxItems: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) required:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) - linux,code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) anyOf:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) - required:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) - interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) - required:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) - gpios
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) dependencies:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) wakeup-event-action: [ wakeup-source ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) linux,input-value: [ gpios ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) unevaluatedProperties: false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) if:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) compatible:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) const: gpio-keys-polled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) then:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) poll-interval:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) Poll interval time in milliseconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) $ref: /schemas/types.yaml#definitions/uint32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) required:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) - poll-interval
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) additionalProperties: false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) examples:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) - |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #include <dt-bindings/interrupt-controller/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) gpio-keys {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) compatible = "gpio-keys";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) autorepeat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) up {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) label = "GPIO Key UP";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) linux,code = <103>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) gpios = <&gpio1 0 1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) down {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) label = "GPIO Key DOWN";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) linux,code = <108>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) ...