diff mbox series

[RFC,1/2] dt-bindings: adc-joystick: add valid-range

Message ID 20221031190159.1341027-2-lis8215@gmail.com (mailing list archive)
State New, archived
Headers show
Series Input: adc-joystick: add detachable devices support | expand

Commit Message

Siarhei Volkau Oct. 31, 2022, 7:01 p.m. UTC
The valid-range property aims to cover detachable/lock-able
joysticks where measured value goes outside valid-range.

Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
---
 .../bindings/input/adc-joystick.yaml          | 62 +++++++++++++++++++
 1 file changed, 62 insertions(+)

Comments

Rob Herring (Arm) Oct. 31, 2022, 10:05 p.m. UTC | #1
On Mon, 31 Oct 2022 22:01:58 +0300, Siarhei Volkau wrote:
> The valid-range property aims to cover detachable/lock-able
> joysticks where measured value goes outside valid-range.
> 
> Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
> ---
>  .../bindings/input/adc-joystick.yaml          | 62 +++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/input/adc-joystick.example.dts:82.28-104.11: ERROR (duplicate_label): /example-1/joystick: Duplicate label 'joystick' on /example-1/joystick and /example-0/adc-joystick
ERROR: Input tree has errors, aborting (use -f to force output)
make[1]: *** [scripts/Makefile.lib:406: Documentation/devicetree/bindings/input/adc-joystick.example.dtb] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1492: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Rob Herring (Arm) Nov. 1, 2022, 1:08 a.m. UTC | #2
On Mon, Oct 31, 2022 at 05:05:54PM -0500, Rob Herring wrote:
> 
> On Mon, 31 Oct 2022 22:01:58 +0300, Siarhei Volkau wrote:
> > The valid-range property aims to cover detachable/lock-able
> > joysticks where measured value goes outside valid-range.
> > 
> > Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
> > ---
> >  .../bindings/input/adc-joystick.yaml          | 62 +++++++++++++++++++
> >  1 file changed, 62 insertions(+)
> > 
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Documentation/devicetree/bindings/input/adc-joystick.example.dts:82.28-104.11: ERROR (duplicate_label): /example-1/joystick: Duplicate label 'joystick' on /example-1/joystick and /example-0/adc-joystick
> ERROR: Input tree has errors, aborting (use -f to force output)
> make[1]: *** [scripts/Makefile.lib:406: Documentation/devicetree/bindings/input/adc-joystick.example.dtb] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:1492: dt_binding_check] Error 2

The examples aren't completely independent, so you can't use the same 
labels.

Rob
Siarhei Volkau Nov. 1, 2022, 8:07 a.m. UTC | #3
вт, 1 нояб. 2022 г. в 04:08, Rob Herring <robh@kernel.org>:
>
> On Mon, Oct 31, 2022 at 05:05:54PM -0500, Rob Herring wrote:
> >
> > On Mon, 31 Oct 2022 22:01:58 +0300, Siarhei Volkau wrote:
> > > The valid-range property aims to cover detachable/lock-able
> > > joysticks where measured value goes outside valid-range.
> > >
> > > Signed-off-by: Siarhei Volkau <lis8215@gmail.com>
> > > ---
> > >  .../bindings/input/adc-joystick.yaml          | 62 +++++++++++++++++++
> > >  1 file changed, 62 insertions(+)
> > >
> >
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> >
> > yamllint warnings/errors:
> >
> > dtschema/dtc warnings/errors:
> > Documentation/devicetree/bindings/input/adc-joystick.example.dts:82.28-104.11: ERROR (duplicate_label): /example-1/joystick: Duplicate label 'joystick' on /example-1/joystick and /example-0/adc-joystick
> > ERROR: Input tree has errors, aborting (use -f to force output)
> > make[1]: *** [scripts/Makefile.lib:406: Documentation/devicetree/bindings/input/adc-joystick.example.dtb] Error 2
> > make[1]: *** Waiting for unfinished jobs....
> > make: *** [Makefile:1492: dt_binding_check] Error 2
>
> The examples aren't completely independent, so you can't use the same
> labels.

Good explanation, thank you.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/adc-joystick.yaml b/Documentation/devicetree/bindings/input/adc-joystick.yaml
index da0f8dfca..0483f0afe 100644
--- a/Documentation/devicetree/bindings/input/adc-joystick.yaml
+++ b/Documentation/devicetree/bindings/input/adc-joystick.yaml
@@ -91,6 +91,20 @@  patternProperties:
           Omitting this property indicates the axis always returns to exactly
           the center position.
 
+      valid-range:
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+        items:
+          - description: minimum value
+          - description: maximum value
+        description: >
+          Minimum and maximum values which are still valid for the axis.
+          If the value is outside the range an event won't emitted.
+          Shall fully cover the abs-range with some space added,
+          to take into account imprecise analog nature of the joystick.
+          When value goes out of valid range - corresponding axis is
+          centered. The center point calculated on abs-range basis.
+          This property is interpreted as two signed 32 bit values.
+
     required:
       - reg
       - linux,code
@@ -125,3 +139,51 @@  examples:
               abs-flat = <200>;
       };
     };
+  # A rather complex joystick hardware definition
+  # with two axes muxed into one ADC channel.
+  - |
+    #include <dt-bindings/iio/adc/ingenic,adc.h>
+    #include <dt-bindings/input/input.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    gpio_mux: mux-controller {
+      compatible = "gpio-mux";
+      #mux-control-cells = <0>;
+
+      mux-gpios = <&gpe 2 GPIO_ACTIVE_HIGH>;
+    };
+
+    adcmux: adc-mux {
+      compatible = "io-channel-mux";
+      io-channels = <&adc INGENIC_ADC_AUX>;
+      io-channel-names = "parent";
+      #io-channel-cells = <1>;
+
+      mux-controls = <&gpio_mux>;
+
+      channels = "joystick-axis-x", "joystick-axis-y";
+    };
+
+    joystick: joystick {
+      compatible = "adc-joystick";
+      io-channels = <&adcmux 0>, <&adcmux 1>;
+      io-channel-names = "joystick-axis-x", "joystick-axis-y";
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      poll-interval = <16>;
+
+      axis@0 {
+        reg = <0>;
+        linux,code = <ABS_X>;
+        abs-range = <3400 670>;
+        valid-range = <300 3700>;
+      };
+
+      axis@1 {
+        reg = <1>;
+        linux,code = <ABS_Y>;
+        abs-range = <670 3400>;
+        valid-range = <300 3700>;
+      };
+    };