182 lines · yaml
1# SPDX-License-Identifier: GPL-2.0-only2%YAML 1.23---4$id: http://devicetree.org/schemas/input/gpio-keys.yaml#5$schema: http://devicetree.org/meta-schemas/core.yaml#6 7title: GPIO attached keys8 9maintainers:10 - Rob Herring <robh@kernel.org>11 12properties:13 compatible:14 enum:15 - gpio-keys16 - gpio-keys-polled17 18 autorepeat: true19 20 label:21 description: Name of entire device22 23 poll-interval: true24 25patternProperties:26 "^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$":27 $ref: input.yaml#28 29 properties:30 gpios:31 maxItems: 132 33 interrupts:34 oneOf:35 - items:36 - description: Optional key interrupt or wakeup interrupt37 - items:38 - description: Key interrupt39 - description: Wakeup interrupt40 41 interrupt-names:42 description:43 Optional interrupt names, can be used to specify a separate dedicated44 wake-up interrupt in addition to the gpio irq45 oneOf:46 - items:47 - enum: [ irq, wakeup ]48 - items:49 - const: irq50 - const: wakeup51 52 label:53 description: Descriptive name of the key.54 55 linux,code:56 description: Key / Axis code to emit.57 58 linux,input-type:59 default: 1 # EV_KEY60 61 linux,input-value:62 description: |63 If linux,input-type is EV_ABS or EV_REL then this64 value is sent for events this button generates when pressed.65 EV_ABS/EV_REL axis will generate an event with a value of 066 when all buttons with linux,input-type == type and67 linux,code == axis are released. This value is interpreted68 as a signed 32 bit value, e.g. to make a button generate a69 value of -1 use:70 71 linux,input-value = <0xffffffff>; /* -1 */72 73 $ref: /schemas/types.yaml#/definitions/uint3274 75 debounce-interval:76 description:77 Debouncing interval time in milliseconds. If not specified defaults to 5.78 $ref: /schemas/types.yaml#/definitions/uint3279 80 default: 581 82 wakeup-source:83 description: Button can wake-up the system.84 85 wakeup-event-action:86 description: |87 Specifies whether the key should wake the system when asserted, when88 deasserted, or both. This property is only valid for keys that wake up the89 system (e.g., when the "wakeup-source" property is also provided).90 91 Supported values are defined in linux-event-codes.h:92 93 EV_ACT_ANY - both asserted and deasserted94 EV_ACT_ASSERTED - asserted95 EV_ACT_DEASSERTED - deasserted96 $ref: /schemas/types.yaml#/definitions/uint3297 enum: [0, 1, 2]98 99 linux,can-disable:100 description:101 Indicates that button is connected to dedicated (not shared) interrupt102 which can be disabled to suppress events from the button.103 type: boolean104 105 required:106 - linux,code107 108 anyOf:109 - required:110 - interrupts111 - required:112 - interrupts-extended113 - required:114 - gpios115 116 allOf:117 - if:118 properties:119 interrupts:120 minItems: 2121 required:122 - interrupts123 then:124 properties:125 interrupt-names:126 minItems: 2127 required:128 - interrupt-names129 130 dependencies:131 wakeup-event-action: [ wakeup-source ]132 linux,input-value: [ gpios ]133 134 unevaluatedProperties: false135 136allOf:137 - $ref: input.yaml#138 - if:139 properties:140 compatible:141 const: gpio-keys-polled142 then:143 required:144 - poll-interval145 else:146 properties:147 poll-interval: false148 149additionalProperties: false150 151examples:152 - |153 #include <dt-bindings/interrupt-controller/irq.h>154 155 gpio-keys {156 compatible = "gpio-keys";157 autorepeat;158 159 key-up {160 label = "GPIO Key UP";161 linux,code = <103>;162 gpios = <&gpio1 0 1>;163 };164 165 key-down {166 label = "GPIO Key DOWN";167 linux,code = <108>;168 interrupts = <1 IRQ_TYPE_EDGE_FALLING>;169 };170 171 key-wakeup {172 label = "GPIO Key WAKEUP";173 linux,code = <143>;174 interrupts-extended = <&intc 2 IRQ_TYPE_EDGE_FALLING>,175 <&intc_wakeup 0 IRQ_TYPE_LEVEL_HIGH>;176 interrupt-names = "irq", "wakeup";177 wakeup-source;178 };179 };180 181...182