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