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