1 # SPDX-License-Identifier: GPL-2.0-only 2 %YAML 1.2 3 --- 4 $id: http://devicetree.org/schemas/input/gpio-keys.yaml# 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 7 title: GPIO attached keys 8 9 maintainers: 10 - Rob Herring <robh@kernel.org> 11 12 properties: 13 compatible: 14 enum: 15 - gpio-keys 16 - gpio-keys-polled 17 18 autorepeat: true 19 20 label: 21 description: Name of entire device 22 23 poll-interval: true 24 25 patternProperties: 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: 1 32 33 interrupts: 34 oneOf: 35 - items: 36 - description: Optional key interrupt or wakeup interrupt 37 - items: 38 - description: Key interrupt 39 - description: Wakeup interrupt 40 41 interrupt-names: 42 description: 43 Optional interrupt names, can be used to specify a separate dedicated 44 wake-up interrupt in addition to the gpio irq 45 oneOf: 46 - items: 47 - enum: [ irq, wakeup ] 48 - items: 49 - const: irq 50 - const: wakeup 51 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_KEY 60 61 linux,input-value: 62 description: | 63 If linux,input-type is EV_ABS or EV_REL then this 64 value is sent for events this button generates when pressed. 65 EV_ABS/EV_REL axis will generate an event with a value of 0 66 when all buttons with linux,input-type == type and 67 linux,code == axis are released. This value is interpreted 68 as a signed 32 bit value, e.g. to make a button generate a 69 value of -1 use: 70 71 linux,input-value = <0xffffffff>; /* -1 */ 72 73 $ref: /schemas/types.yaml#/definitions/uint32 74 75 debounce-interval: 76 description: 77 Debouncing interval time in milliseconds. If not specified defaults to 5. 78 $ref: /schemas/types.yaml#/definitions/uint32 79 80 default: 5 81 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, when 88 deasserted, or both. This property is only valid for keys that wake up the 89 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 deasserted 94 EV_ACT_ASSERTED - asserted 95 EV_ACT_DEASSERTED - deasserted 96 $ref: /schemas/types.yaml#/definitions/uint32 97 enum: [0, 1, 2] 98 99 linux,can-disable: 100 description: 101 Indicates that button is connected to dedicated (not shared) interrupt 102 which can be disabled to suppress events from the button. 103 type: boolean 104 105 required: 106 - linux,code 107 108 anyOf: 109 - required: 110 - interrupts 111 - required: 112 - interrupts-extended 113 - required: 114 - gpios 115 116 allOf: 117 - if: 118 properties: 119 interrupts: 120 minItems: 2 121 required: 122 - interrupts 123 then: 124 properties: 125 interrupt-names: 126 minItems: 2 127 required: 128 - interrupt-names 129 130 dependencies: 131 wakeup-event-action: [ wakeup-source ] 132 linux,input-value: [ gpios ] 133 134 unevaluatedProperties: false 135 136 allOf: 137 - $ref: input.yaml# 138 - if: 139 properties: 140 compatible: 141 const: gpio-keys-polled 142 then: 143 required: 144 - poll-interval 145 else: 146 properties: 147 poll-interval: false 148 149 additionalProperties: false 150 151 examples: 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 ...
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.