mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Rob Herring <robh@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>, Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Artur Rojek <contact@artur-rojek.eu>,
	Maxime Ripard <mripard@kernel.org>,
	Jeff LaBundy <jeff@labundy.com>,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH v2 5/5] dt-bindings: input: Convert adc-keys to DT schema
Date: Thu, 9 Jun 2022 07:49:49 +0200	[thread overview]
Message-ID: <21f59c3b-1d54-6980-8e25-af7532a1cbae@gmx.de> (raw)
In-Reply-To: <20220608211207.2058487-6-robh@kernel.org>

On 6/8/22 23:12, Rob Herring wrote:
> Convert the adc-keys binding to DT schema format.
>
> The old binding has 'label' as required, but it should never be
> required given it's just a human readable description.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> v2:
>   - Drop Heinrich as a maintainer
>   - Use common linux,code definition
>   - Drop label as required
> ---
>   .../devicetree/bindings/input/adc-keys.txt    |  67 ------------
>   .../devicetree/bindings/input/adc-keys.yaml   | 103 ++++++++++++++++++
>   2 files changed, 103 insertions(+), 67 deletions(-)
>   delete mode 100644 Documentation/devicetree/bindings/input/adc-keys.txt
>   create mode 100644 Documentation/devicetree/bindings/input/adc-keys.yaml
>
> diff --git a/Documentation/devicetree/bindings/input/adc-keys.txt b/Documentation/devicetree/bindings/input/adc-keys.txt
> deleted file mode 100644
> index 6c8be6a9ace2..000000000000
> --- a/Documentation/devicetree/bindings/input/adc-keys.txt
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -ADC attached resistor ladder buttons
> -------------------------------------
> -
> -Required properties:
> - - compatible: "adc-keys"
> - - io-channels: Phandle to an ADC channel
> - - io-channel-names = "buttons";
> - - keyup-threshold-microvolt: Voltage above or equal to which all the keys are
> -			      considered up.
> -
> -Optional properties:
> -	- poll-interval: Poll interval time in milliseconds
> -	- autorepeat: Boolean, Enable auto repeat feature of Linux input
> -	  subsystem.
> -
> -Each button (key) is represented as a sub-node of "adc-keys":
> -
> -Required subnode-properties:
> -	- label: Descriptive name of the key.
> -	- linux,code: Keycode to emit.
> -	- press-threshold-microvolt: 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.
> -
> -Example:
> -
> -#include <dt-bindings/input/input.h>
> -
> -	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>;
> -		};
> -	};
> -
> -+--------------------------------+------------------------+
> -| 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         |
> -+--------------------------------+------------------------+
> diff --git a/Documentation/devicetree/bindings/input/adc-keys.yaml b/Documentation/devicetree/bindings/input/adc-keys.yaml
> new file mode 100644
> index 000000000000..7aa078dead37
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/adc-keys.yaml
> @@ -0,0 +1,103 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/adc-keys.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ADC attached resistor ladder buttons
> +
> +maintainers:
> +  - Alexandre Belloni <alexandre.belloni@bootlin.com>
> +
> +allOf:
> +  - $ref: input.yaml#
> +
> +properties:
> +  compatible:
> +    const: adc-keys
> +
> +  io-channels:
> +    maxItems: 1
> +
> +  io-channel-names:
> +    const: buttons
> +
> +  keyup-threshold-microvolt:
> +    description:
> +      Voltage above or equal to which all the keys are considered up.
> +
> +  poll-interval: true
> +  autorepeat: true
> +
> +patternProperties:
> +  '^button-':
> +    type: object
> +    $ref: input.yaml#
> +    additionalProperties: false
> +    description:
> +      Each button (key) is represented as a sub-node.
> +
> +    properties:
> +      label: true
> +
> +      linux,code: true

Can we provide a reference to a new type in
Documentation/devicetree/bindings/input/input.yaml limiting the range to
0 - 0x2ff?

Best regards

Heinrich

> +
> +      press-threshold-microvolt:
> +        description:
> +          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:
> +      - linux,code
> +      - press-threshold-microvolt
> +
> +required:
> +  - compatible
> +  - io-channels
> +  - io-channel-names
> +  - keyup-threshold-microvolt
> +
> +additionalProperties: false
> +
> +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>;
> +        };
> +    };
> +...


  reply	other threads:[~2022-06-09  5:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 21:12 [PATCH v2 0/5] dt-bindings: input: Common property clean-ups and adc-keys conversion Rob Herring
2022-06-08 21:12 ` [PATCH v2 1/5] dt-bindings: input: Increase maximum keycode value to 0x2ff Rob Herring
2022-06-09  1:29   ` Jeff LaBundy
2022-06-09  5:46   ` Heinrich Schuchardt
2022-06-10 13:23     ` Rob Herring
2022-06-08 21:12 ` [PATCH v2 2/5] dt-bindings: input: Centralize 'linux,code' definition Rob Herring
2022-06-09  1:32   ` Jeff LaBundy
2022-06-12 16:17   ` Artur Rojek
2022-07-03  5:29   ` Samuel Holland
2022-06-08 21:12 ` [PATCH v2 3/5] dt-bindings: input: Use common 'linux,keycodes' definition Rob Herring
2022-06-09  1:34   ` Jeff LaBundy
2022-06-08 21:12 ` [PATCH v2 4/5] dt-bindings: input: Centralize 'linux,input-type' definition Rob Herring
2022-06-09  1:38   ` Jeff LaBundy
2022-06-08 21:12 ` [PATCH v2 5/5] dt-bindings: input: Convert adc-keys to DT schema Rob Herring
2022-06-09  5:49   ` Heinrich Schuchardt [this message]
2022-06-28 17:51 ` [PATCH v2 0/5] dt-bindings: input: Common property clean-ups and adc-keys conversion Rob Herring
2022-07-08 22:20   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21f59c3b-1d54-6980-8e25-af7532a1cbae@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=brgl@bgdev.pl \
    --cc=contact@artur-rojek.eu \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jeff@labundy.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®