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