1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only 2c66ec88fSEmmanuel Vadot%YAML 1.2 3c66ec88fSEmmanuel Vadot--- 4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/input/gpio-keys.yaml# 5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 6c66ec88fSEmmanuel Vadot 78bab661aSEmmanuel Vadottitle: GPIO attached keys 8c66ec88fSEmmanuel Vadot 9c66ec88fSEmmanuel Vadotmaintainers: 10c66ec88fSEmmanuel Vadot - Rob Herring <robh@kernel.org> 11c66ec88fSEmmanuel Vadot 12c66ec88fSEmmanuel Vadotproperties: 13c66ec88fSEmmanuel Vadot compatible: 14c66ec88fSEmmanuel Vadot enum: 15c66ec88fSEmmanuel Vadot - gpio-keys 16c66ec88fSEmmanuel Vadot - gpio-keys-polled 17c66ec88fSEmmanuel Vadot 18b97ee269SEmmanuel Vadot autorepeat: true 19b97ee269SEmmanuel Vadot 20b97ee269SEmmanuel Vadot label: 21b97ee269SEmmanuel Vadot description: Name of entire device 22b97ee269SEmmanuel Vadot 23b97ee269SEmmanuel Vadot poll-interval: true 24b97ee269SEmmanuel Vadot 25c66ec88fSEmmanuel VadotpatternProperties: 26b97ee269SEmmanuel Vadot "^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$": 27c66ec88fSEmmanuel Vadot $ref: input.yaml# 28c66ec88fSEmmanuel Vadot 29c66ec88fSEmmanuel Vadot properties: 30c66ec88fSEmmanuel Vadot gpios: 31c66ec88fSEmmanuel Vadot maxItems: 1 32c66ec88fSEmmanuel Vadot 33c66ec88fSEmmanuel Vadot interrupts: 34*8d13bc63SEmmanuel Vadot oneOf: 35*8d13bc63SEmmanuel Vadot - items: 36*8d13bc63SEmmanuel Vadot - description: Optional key interrupt or wakeup interrupt 37*8d13bc63SEmmanuel Vadot - items: 38*8d13bc63SEmmanuel Vadot - description: Key interrupt 39*8d13bc63SEmmanuel Vadot - description: Wakeup interrupt 40*8d13bc63SEmmanuel Vadot 41*8d13bc63SEmmanuel Vadot interrupt-names: 42*8d13bc63SEmmanuel Vadot description: 43*8d13bc63SEmmanuel Vadot Optional interrupt names, can be used to specify a separate dedicated 44*8d13bc63SEmmanuel Vadot wake-up interrupt in addition to the gpio irq 45*8d13bc63SEmmanuel Vadot oneOf: 46*8d13bc63SEmmanuel Vadot - items: 47*8d13bc63SEmmanuel Vadot - enum: [ irq, wakeup ] 48*8d13bc63SEmmanuel Vadot - items: 49*8d13bc63SEmmanuel Vadot - const: irq 50*8d13bc63SEmmanuel Vadot - const: wakeup 51c66ec88fSEmmanuel Vadot 52c66ec88fSEmmanuel Vadot label: 53c66ec88fSEmmanuel Vadot description: Descriptive name of the key. 54c66ec88fSEmmanuel Vadot 55c66ec88fSEmmanuel Vadot linux,code: 56c66ec88fSEmmanuel Vadot description: Key / Axis code to emit. 57c66ec88fSEmmanuel Vadot 58c66ec88fSEmmanuel Vadot linux,input-type: 59b97ee269SEmmanuel Vadot default: 1 # EV_KEY 60c66ec88fSEmmanuel Vadot 61c66ec88fSEmmanuel Vadot linux,input-value: 62c66ec88fSEmmanuel Vadot description: | 63c66ec88fSEmmanuel Vadot If linux,input-type is EV_ABS or EV_REL then this 64c66ec88fSEmmanuel Vadot value is sent for events this button generates when pressed. 65c66ec88fSEmmanuel Vadot EV_ABS/EV_REL axis will generate an event with a value of 0 66c66ec88fSEmmanuel Vadot when all buttons with linux,input-type == type and 67c66ec88fSEmmanuel Vadot linux,code == axis are released. This value is interpreted 68c66ec88fSEmmanuel Vadot as a signed 32 bit value, e.g. to make a button generate a 69c66ec88fSEmmanuel Vadot value of -1 use: 70c66ec88fSEmmanuel Vadot 71c66ec88fSEmmanuel Vadot linux,input-value = <0xffffffff>; /* -1 */ 72c66ec88fSEmmanuel Vadot 735def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 74c66ec88fSEmmanuel Vadot 75c66ec88fSEmmanuel Vadot debounce-interval: 76c66ec88fSEmmanuel Vadot description: 77c66ec88fSEmmanuel Vadot Debouncing interval time in milliseconds. If not specified defaults to 5. 785def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 79c66ec88fSEmmanuel Vadot 80c66ec88fSEmmanuel Vadot default: 5 81c66ec88fSEmmanuel Vadot 82c66ec88fSEmmanuel Vadot wakeup-source: 83c66ec88fSEmmanuel Vadot description: Button can wake-up the system. 84c66ec88fSEmmanuel Vadot 85c66ec88fSEmmanuel Vadot wakeup-event-action: 86c66ec88fSEmmanuel Vadot description: | 87c66ec88fSEmmanuel Vadot Specifies whether the key should wake the system when asserted, when 88c66ec88fSEmmanuel Vadot deasserted, or both. This property is only valid for keys that wake up the 89c66ec88fSEmmanuel Vadot system (e.g., when the "wakeup-source" property is also provided). 90c66ec88fSEmmanuel Vadot 91c66ec88fSEmmanuel Vadot Supported values are defined in linux-event-codes.h: 92c66ec88fSEmmanuel Vadot 93c66ec88fSEmmanuel Vadot EV_ACT_ANY - both asserted and deasserted 94c66ec88fSEmmanuel Vadot EV_ACT_ASSERTED - asserted 95c66ec88fSEmmanuel Vadot EV_ACT_DEASSERTED - deasserted 965def4c47SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 97c66ec88fSEmmanuel Vadot enum: [0, 1, 2] 98c66ec88fSEmmanuel Vadot 99c66ec88fSEmmanuel Vadot linux,can-disable: 100c66ec88fSEmmanuel Vadot description: 101c66ec88fSEmmanuel Vadot Indicates that button is connected to dedicated (not shared) interrupt 102c66ec88fSEmmanuel Vadot which can be disabled to suppress events from the button. 103c66ec88fSEmmanuel Vadot type: boolean 104c66ec88fSEmmanuel Vadot 105c66ec88fSEmmanuel Vadot required: 106c66ec88fSEmmanuel Vadot - linux,code 107c66ec88fSEmmanuel Vadot 108c66ec88fSEmmanuel Vadot anyOf: 109c66ec88fSEmmanuel Vadot - required: 110c66ec88fSEmmanuel Vadot - interrupts 111c66ec88fSEmmanuel Vadot - required: 112b97ee269SEmmanuel Vadot - interrupts-extended 113b97ee269SEmmanuel Vadot - required: 114c66ec88fSEmmanuel Vadot - gpios 115c66ec88fSEmmanuel Vadot 116*8d13bc63SEmmanuel Vadot allOf: 117*8d13bc63SEmmanuel Vadot - if: 118*8d13bc63SEmmanuel Vadot properties: 119*8d13bc63SEmmanuel Vadot interrupts: 120*8d13bc63SEmmanuel Vadot minItems: 2 121*8d13bc63SEmmanuel Vadot required: 122*8d13bc63SEmmanuel Vadot - interrupts 123*8d13bc63SEmmanuel Vadot then: 124*8d13bc63SEmmanuel Vadot properties: 125*8d13bc63SEmmanuel Vadot interrupt-names: 126*8d13bc63SEmmanuel Vadot minItems: 2 127*8d13bc63SEmmanuel Vadot required: 128*8d13bc63SEmmanuel Vadot - interrupt-names 129*8d13bc63SEmmanuel Vadot 130c66ec88fSEmmanuel Vadot dependencies: 131c66ec88fSEmmanuel Vadot wakeup-event-action: [ wakeup-source ] 132c66ec88fSEmmanuel Vadot linux,input-value: [ gpios ] 133c66ec88fSEmmanuel Vadot 134c66ec88fSEmmanuel Vadot unevaluatedProperties: false 135c66ec88fSEmmanuel Vadot 136b97ee269SEmmanuel VadotallOf: 137b97ee269SEmmanuel Vadot - $ref: input.yaml# 138b97ee269SEmmanuel Vadot - if: 139c66ec88fSEmmanuel Vadot properties: 140c66ec88fSEmmanuel Vadot compatible: 141c66ec88fSEmmanuel Vadot const: gpio-keys-polled 142c66ec88fSEmmanuel Vadot then: 143c66ec88fSEmmanuel Vadot required: 144c66ec88fSEmmanuel Vadot - poll-interval 145b97ee269SEmmanuel Vadot else: 146b97ee269SEmmanuel Vadot properties: 147b97ee269SEmmanuel Vadot poll-interval: false 148c66ec88fSEmmanuel Vadot 149c66ec88fSEmmanuel VadotadditionalProperties: false 150c66ec88fSEmmanuel Vadot 151c66ec88fSEmmanuel Vadotexamples: 152c66ec88fSEmmanuel Vadot - | 153c66ec88fSEmmanuel Vadot #include <dt-bindings/interrupt-controller/irq.h> 154c66ec88fSEmmanuel Vadot 155c66ec88fSEmmanuel Vadot gpio-keys { 156c66ec88fSEmmanuel Vadot compatible = "gpio-keys"; 157c66ec88fSEmmanuel Vadot autorepeat; 158c66ec88fSEmmanuel Vadot 159b97ee269SEmmanuel Vadot key-up { 160c66ec88fSEmmanuel Vadot label = "GPIO Key UP"; 161c66ec88fSEmmanuel Vadot linux,code = <103>; 162c66ec88fSEmmanuel Vadot gpios = <&gpio1 0 1>; 163c66ec88fSEmmanuel Vadot }; 164c66ec88fSEmmanuel Vadot 165b97ee269SEmmanuel Vadot key-down { 166c66ec88fSEmmanuel Vadot label = "GPIO Key DOWN"; 167c66ec88fSEmmanuel Vadot linux,code = <108>; 1688cc087a1SEmmanuel Vadot interrupts = <1 IRQ_TYPE_EDGE_FALLING>; 169c66ec88fSEmmanuel Vadot }; 170*8d13bc63SEmmanuel Vadot 171*8d13bc63SEmmanuel Vadot key-wakeup { 172*8d13bc63SEmmanuel Vadot label = "GPIO Key WAKEUP"; 173*8d13bc63SEmmanuel Vadot linux,code = <143>; 174*8d13bc63SEmmanuel Vadot interrupts-extended = <&intc 2 IRQ_TYPE_EDGE_FALLING>, 175*8d13bc63SEmmanuel Vadot <&intc_wakeup 0 IRQ_TYPE_LEVEL_HIGH>; 176*8d13bc63SEmmanuel Vadot interrupt-names = "irq", "wakeup"; 177*8d13bc63SEmmanuel Vadot wakeup-source; 178*8d13bc63SEmmanuel Vadot }; 179c66ec88fSEmmanuel Vadot }; 180c66ec88fSEmmanuel Vadot 181c66ec88fSEmmanuel Vadot... 182