Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0-only
0002 %YAML 1.2
0003 ---
0004 $id: http://devicetree.org/schemas/input/gpio-keys.yaml#
0005 $schema: http://devicetree.org/meta-schemas/core.yaml#
0006 
0007 title: Device-Tree bindings for GPIO attached keys
0008 
0009 maintainers:
0010   - Rob Herring <robh@kernel.org>
0011 
0012 properties:
0013   compatible:
0014     enum:
0015       - gpio-keys
0016       - gpio-keys-polled
0017 
0018   autorepeat: true
0019 
0020   label:
0021     description: Name of entire device
0022 
0023   poll-interval: true
0024 
0025 patternProperties:
0026   "^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$":
0027     $ref: input.yaml#
0028 
0029     properties:
0030       gpios:
0031         maxItems: 1
0032 
0033       interrupts:
0034         maxItems: 1
0035 
0036       label:
0037         description: Descriptive name of the key.
0038 
0039       linux,code:
0040         description: Key / Axis code to emit.
0041 
0042       linux,input-type:
0043         default: 1  # EV_KEY
0044 
0045       linux,input-value:
0046         description: |
0047           If linux,input-type is EV_ABS or EV_REL then this
0048           value is sent for events this button generates when pressed.
0049           EV_ABS/EV_REL axis will generate an event with a value of 0
0050           when all buttons with linux,input-type == type and
0051           linux,code == axis are released. This value is interpreted
0052           as a signed 32 bit value, e.g. to make a button generate a
0053           value of -1 use:
0054 
0055           linux,input-value = <0xffffffff>; /* -1 */
0056 
0057         $ref: /schemas/types.yaml#/definitions/uint32
0058 
0059       debounce-interval:
0060         description:
0061           Debouncing interval time in milliseconds. If not specified defaults to 5.
0062         $ref: /schemas/types.yaml#/definitions/uint32
0063 
0064         default: 5
0065 
0066       wakeup-source:
0067         description: Button can wake-up the system.
0068 
0069       wakeup-event-action:
0070         description: |
0071           Specifies whether the key should wake the system when asserted, when
0072           deasserted, or both. This property is only valid for keys that wake up the
0073           system (e.g., when the "wakeup-source" property is also provided).
0074 
0075           Supported values are defined in linux-event-codes.h:
0076 
0077             EV_ACT_ANY        - both asserted and deasserted
0078             EV_ACT_ASSERTED   - asserted
0079             EV_ACT_DEASSERTED - deasserted
0080         $ref: /schemas/types.yaml#/definitions/uint32
0081         enum: [0, 1, 2]
0082 
0083       linux,can-disable:
0084         description:
0085           Indicates that button is connected to dedicated (not shared) interrupt
0086           which can be disabled to suppress events from the button.
0087         type: boolean
0088 
0089     required:
0090       - linux,code
0091 
0092     anyOf:
0093       - required:
0094           - interrupts
0095       - required:
0096           - interrupts-extended
0097       - required:
0098           - gpios
0099 
0100     dependencies:
0101       wakeup-event-action: [ wakeup-source ]
0102       linux,input-value: [ gpios ]
0103 
0104     unevaluatedProperties: false
0105 
0106 allOf:
0107   - $ref: input.yaml#
0108   - if:
0109       properties:
0110         compatible:
0111           const: gpio-keys-polled
0112     then:
0113       required:
0114         - poll-interval
0115     else:
0116       properties:
0117         poll-interval: false
0118 
0119 additionalProperties: false
0120 
0121 examples:
0122   - |
0123     #include <dt-bindings/interrupt-controller/irq.h>
0124 
0125     gpio-keys {
0126         compatible = "gpio-keys";
0127         autorepeat;
0128 
0129         key-up {
0130             label = "GPIO Key UP";
0131             linux,code = <103>;
0132             gpios = <&gpio1 0 1>;
0133         };
0134 
0135         key-down {
0136             label = "GPIO Key DOWN";
0137             linux,code = <108>;
0138             interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
0139         };
0140     };
0141 
0142 ...