ADC attached resistor ladder buttons

Schema identifier ($id): "http://devicetree.org/schemas/input/adc-keys.yaml#"

Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"

Maintainers (maintainers): "Alexandre Belloni <alexandre.belloni@bootlin.com>"

All of these rules must match (allOf) #

Rule 1 #

Shared schema rule ($ref): input.yaml#

Properties and child nodes (properties) #

compatible — required here #

Exact value (const): "adc-keys"

io-channels — required here #

Maximum number of items (maxItems): 1

io-channel-names — required here #

Exact value (const): "buttons"

keyup-threshold-microvolt — required here #

Voltage above or equal to which all the keys are considered up.

poll-interval — not listed as required here #

true — No constraints added by this property rule.

autorepeat — not listed as required here #

true — No constraints added by this property rule.

Properties matching a name pattern (patternProperties) #

^button- — name matches this regular expression #

Value type (type): "object"

Shared schema rule ($ref): input.yaml#

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

false

Not allowed by this rule.

Each button (key) is represented as a sub-node.

Properties and child nodes (properties) #

label — not listed as required here

true — No constraints added by this property rule.

linux,code — required here

true — No constraints added by this property rule.

press-threshold-microvolt — required here

Voltage above or equal to which this key is considered pressed. No two values of press-threshold-microvolt may be the same. All values of press-threshold-microvolt must be less than keyup-threshold-microvolt.

Required in this object (required): "linux,code", "press-threshold-microvolt"

Required in this object (required): "compatible", "io-channels", "io-channel-names", "keyup-threshold-microvolt"

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

false

Not allowed by this rule.

Examples (examples) #

#include <dt-bindings/input/input.h>
// +--------------------------------+------------------------+
// | 2.000.000 <= value             | no key pressed         |
// +--------------------------------+------------------------+
// | 1.500.000 <= value < 2.000.000 | KEY_VOLUMEUP pressed   |
// +--------------------------------+------------------------+
// | 1.000.000 <= value < 1.500.000 | KEY_VOLUMEDOWN pressed |
// +--------------------------------+------------------------+
// |   500.000 <= value < 1.000.000 | KEY_ENTER pressed      |
// +--------------------------------+------------------------+
// |              value <   500.000 | no key pressed         |
// +--------------------------------+------------------------+

adc-keys {
    compatible = "adc-keys";
    io-channels = <&lradc 0>;
    io-channel-names = "buttons";
    keyup-threshold-microvolt = <2000000>;

    button-up {
        label = "Volume Up";
        linux,code = <KEY_VOLUMEUP>;
        press-threshold-microvolt = <1500000>;
    };

    button-down {
        label = "Volume Down";
        linux,code = <KEY_VOLUMEDOWN>;
        press-threshold-microvolt = <1000000>;
    };

    button-enter {
        label = "Enter";
        linux,code = <KEY_ENTER>;
        press-threshold-microvolt = <500000>;
    };
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: GPL-2.0

Edit this page