1*538c6406SRob Herring# SPDX-License-Identifier: GPL-2.0
2*538c6406SRob Herring%YAML 1.2
3*538c6406SRob Herring---
4*538c6406SRob Herring$id: http://devicetree.org/schemas/input/adc-keys.yaml#
5*538c6406SRob Herring$schema: http://devicetree.org/meta-schemas/core.yaml#
6*538c6406SRob Herring
7*538c6406SRob Herringtitle: ADC attached resistor ladder buttons
8*538c6406SRob Herring
9*538c6406SRob Herringmaintainers:
10*538c6406SRob Herring  - Alexandre Belloni <alexandre.belloni@bootlin.com>
11*538c6406SRob Herring
12*538c6406SRob HerringallOf:
13*538c6406SRob Herring  - $ref: input.yaml#
14*538c6406SRob Herring
15*538c6406SRob Herringproperties:
16*538c6406SRob Herring  compatible:
17*538c6406SRob Herring    const: adc-keys
18*538c6406SRob Herring
19*538c6406SRob Herring  io-channels:
20*538c6406SRob Herring    maxItems: 1
21*538c6406SRob Herring
22*538c6406SRob Herring  io-channel-names:
23*538c6406SRob Herring    const: buttons
24*538c6406SRob Herring
25*538c6406SRob Herring  keyup-threshold-microvolt:
26*538c6406SRob Herring    description:
27*538c6406SRob Herring      Voltage above or equal to which all the keys are considered up.
28*538c6406SRob Herring
29*538c6406SRob Herring  poll-interval: true
30*538c6406SRob Herring  autorepeat: true
31*538c6406SRob Herring
32*538c6406SRob HerringpatternProperties:
33*538c6406SRob Herring  '^button-':
34*538c6406SRob Herring    type: object
35*538c6406SRob Herring    $ref: input.yaml#
36*538c6406SRob Herring    additionalProperties: false
37*538c6406SRob Herring    description:
38*538c6406SRob Herring      Each button (key) is represented as a sub-node.
39*538c6406SRob Herring
40*538c6406SRob Herring    properties:
41*538c6406SRob Herring      label: true
42*538c6406SRob Herring
43*538c6406SRob Herring      linux,code: true
44*538c6406SRob Herring
45*538c6406SRob Herring      press-threshold-microvolt:
46*538c6406SRob Herring        description:
47*538c6406SRob Herring          Voltage above or equal to which this key is considered pressed. No
48*538c6406SRob Herring          two values of press-threshold-microvolt may be the same. All values
49*538c6406SRob Herring          of press-threshold-microvolt must be less than
50*538c6406SRob Herring          keyup-threshold-microvolt.
51*538c6406SRob Herring
52*538c6406SRob Herring    required:
53*538c6406SRob Herring      - linux,code
54*538c6406SRob Herring      - press-threshold-microvolt
55*538c6406SRob Herring
56*538c6406SRob Herringrequired:
57*538c6406SRob Herring  - compatible
58*538c6406SRob Herring  - io-channels
59*538c6406SRob Herring  - io-channel-names
60*538c6406SRob Herring  - keyup-threshold-microvolt
61*538c6406SRob Herring
62*538c6406SRob HerringadditionalProperties: false
63*538c6406SRob Herring
64*538c6406SRob Herringexamples:
65*538c6406SRob Herring  - |
66*538c6406SRob Herring    #include <dt-bindings/input/input.h>
67*538c6406SRob Herring    // +--------------------------------+------------------------+
68*538c6406SRob Herring    // | 2.000.000 <= value             | no key pressed         |
69*538c6406SRob Herring    // +--------------------------------+------------------------+
70*538c6406SRob Herring    // | 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed   |
71*538c6406SRob Herring    // +--------------------------------+------------------------+
72*538c6406SRob Herring    // | 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
73*538c6406SRob Herring    // +--------------------------------+------------------------+
74*538c6406SRob Herring    // |   500.000 <= value < 1.000.000 | KEY_ENTER pressed      |
75*538c6406SRob Herring    // +--------------------------------+------------------------+
76*538c6406SRob Herring    // |              value <   500.000 | no key pressed         |
77*538c6406SRob Herring    // +--------------------------------+------------------------+
78*538c6406SRob Herring
79*538c6406SRob Herring    adc-keys {
80*538c6406SRob Herring        compatible = "adc-keys";
81*538c6406SRob Herring        io-channels = <&lradc 0>;
82*538c6406SRob Herring        io-channel-names = "buttons";
83*538c6406SRob Herring        keyup-threshold-microvolt = <2000000>;
84*538c6406SRob Herring
85*538c6406SRob Herring        button-up {
86*538c6406SRob Herring            label = "Volume Up";
87*538c6406SRob Herring            linux,code = <KEY_VOLUMEUP>;
88*538c6406SRob Herring            press-threshold-microvolt = <1500000>;
89*538c6406SRob Herring        };
90*538c6406SRob Herring
91*538c6406SRob Herring        button-down {
92*538c6406SRob Herring            label = "Volume Down";
93*538c6406SRob Herring            linux,code = <KEY_VOLUMEDOWN>;
94*538c6406SRob Herring            press-threshold-microvolt = <1000000>;
95*538c6406SRob Herring        };
96*538c6406SRob Herring
97*538c6406SRob Herring        button-enter {
98*538c6406SRob Herring            label = "Enter";
99*538c6406SRob Herring            linux,code = <KEY_ENTER>;
100*538c6406SRob Herring            press-threshold-microvolt = <500000>;
101*538c6406SRob Herring        };
102*538c6406SRob Herring    };
103*538c6406SRob Herring...
104