1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/input/allwinner,sun4i-a10-lradc-keys.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Allwinner A10 LRADC Device Tree Bindings
8
9maintainers:
10  - Chen-Yu Tsai <wens@csie.org>
11  - Maxime Ripard <mripard@kernel.org>
12
13properties:
14  compatible:
15    oneOf:
16      - const: allwinner,sun4i-a10-lradc-keys
17      - const: allwinner,sun8i-a83t-r-lradc
18      - items:
19          - const: allwinner,sun50i-a64-lradc
20          - const: allwinner,sun8i-a83t-r-lradc
21      - const: allwinner,sun50i-r329-lradc
22      - items:
23          - const: allwinner,sun20i-d1-lradc
24          - const: allwinner,sun50i-r329-lradc
25
26  reg:
27    maxItems: 1
28
29  clocks:
30    maxItems: 1
31
32  resets:
33    maxItems: 1
34
35  interrupts:
36    maxItems: 1
37
38  vref-supply:
39    description:
40      Regulator for the LRADC reference voltage
41
42  wakeup-source: true
43
44patternProperties:
45  "^button-[0-9]+$":
46    type: object
47    properties:
48      label:
49        $ref: /schemas/types.yaml#/definitions/string
50        description: Descriptive name of the key
51
52      linux,code:
53        $ref: /schemas/types.yaml#/definitions/uint32
54        description: Keycode to emit
55
56      channel:
57        $ref: /schemas/types.yaml#/definitions/uint32
58        enum: [0, 1]
59        description: ADC Channel this key is attached to
60
61      voltage:
62        $ref: /schemas/types.yaml#/definitions/uint32
63        description:
64          Voltage in microvolts at LRADC input when this key is
65          pressed
66
67    required:
68      - label
69      - linux,code
70      - channel
71      - voltage
72
73    additionalProperties: false
74
75required:
76  - compatible
77  - reg
78  - interrupts
79  - vref-supply
80
81if:
82  properties:
83    compatible:
84      contains:
85        enum:
86          - allwinner,sun50i-r329-lradc
87
88then:
89  required:
90    - clocks
91    - resets
92
93additionalProperties: false
94
95examples:
96  - |
97    lradc: lradc@1c22800 {
98        compatible = "allwinner,sun4i-a10-lradc-keys";
99        reg = <0x01c22800 0x100>;
100        interrupts = <31>;
101        vref-supply = <&reg_vcc3v0>;
102
103        button-191 {
104            label = "Volume Up";
105            linux,code = <115>;
106            channel = <0>;
107            voltage = <191274>;
108        };
109
110        button-392 {
111            label = "Volume Down";
112            linux,code = <114>;
113            channel = <0>;
114            voltage = <392644>;
115        };
116    };
117
118...
119