0001 # SPDX-License-Identifier: GPL-2.0
0002 %YAML 1.2
0003 ---
0004 $id: http://devicetree.org/schemas/input/adc-keys.yaml#
0005 $schema: http://devicetree.org/meta-schemas/core.yaml#
0006
0007 title: ADC attached resistor ladder buttons
0008
0009 maintainers:
0010 - Alexandre Belloni <alexandre.belloni@bootlin.com>
0011
0012 allOf:
0013 - $ref: input.yaml#
0014
0015 properties:
0016 compatible:
0017 const: adc-keys
0018
0019 io-channels:
0020 maxItems: 1
0021
0022 io-channel-names:
0023 const: buttons
0024
0025 keyup-threshold-microvolt:
0026 description:
0027 Voltage above or equal to which all the keys are considered up.
0028
0029 poll-interval: true
0030 autorepeat: true
0031
0032 patternProperties:
0033 '^button-':
0034 type: object
0035 $ref: input.yaml#
0036 additionalProperties: false
0037 description:
0038 Each button (key) is represented as a sub-node.
0039
0040 properties:
0041 label: true
0042
0043 linux,code: true
0044
0045 press-threshold-microvolt:
0046 description:
0047 Voltage above or equal to which this key is considered pressed. No
0048 two values of press-threshold-microvolt may be the same. All values
0049 of press-threshold-microvolt must be less than
0050 keyup-threshold-microvolt.
0051
0052 required:
0053 - linux,code
0054 - press-threshold-microvolt
0055
0056 required:
0057 - compatible
0058 - io-channels
0059 - io-channel-names
0060 - keyup-threshold-microvolt
0061
0062 additionalProperties: false
0063
0064 examples:
0065 - |
0066 #include <dt-bindings/input/input.h>
0067 // +--------------------------------+------------------------+
0068 // | 2.000.000 <= value | no key pressed |
0069 // +--------------------------------+------------------------+
0070 // | 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed |
0071 // +--------------------------------+------------------------+
0072 // | 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
0073 // +--------------------------------+------------------------+
0074 // | 500.000 <= value < 1.000.000 | KEY_ENTER pressed |
0075 // +--------------------------------+------------------------+
0076 // | value < 500.000 | no key pressed |
0077 // +--------------------------------+------------------------+
0078
0079 adc-keys {
0080 compatible = "adc-keys";
0081 io-channels = <&lradc 0>;
0082 io-channel-names = "buttons";
0083 keyup-threshold-microvolt = <2000000>;
0084
0085 button-up {
0086 label = "Volume Up";
0087 linux,code = <KEY_VOLUMEUP>;
0088 press-threshold-microvolt = <1500000>;
0089 };
0090
0091 button-down {
0092 label = "Volume Down";
0093 linux,code = <KEY_VOLUMEDOWN>;
0094 press-threshold-microvolt = <1000000>;
0095 };
0096
0097 button-enter {
0098 label = "Enter";
0099 linux,code = <KEY_ENTER>;
0100 press-threshold-microvolt = <500000>;
0101 };
0102 };
0103 ...