From: Siarhei Volkau <lis8215@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Paul Cercueil <paul@crapouillou.net>,
Siarhei Volkau <lis8215@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Artur Rojek <contact@artur-rojek.eu>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/2] dt-bindings: adc-joystick: add valid-range
Date: Mon, 31 Oct 2022 22:01:58 +0300 [thread overview]
Message-ID: <20221031190159.1341027-2-lis8215@gmail.com> (raw)
In-Reply-To: <20221031190159.1341027-1-lis8215@gmail.com>
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(+)
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>;
+ };
+ };
--
2.36.1
next prev parent reply other threads:[~2022-10-31 19:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 19:01 [RFC PATCH 0/2] Input: adc-joystick: add detachable devices support Siarhei Volkau
2022-10-31 19:01 ` Siarhei Volkau [this message]
2022-10-31 22:05 ` [RFC PATCH 1/2] dt-bindings: adc-joystick: add valid-range Rob Herring
2022-11-01 1:08 ` Rob Herring
2022-11-01 8:07 ` Siarhei Volkau
2022-10-31 19:01 ` [RFC PATCH 2/2] Input: adc-joystick - add detachable devices support Siarhei Volkau
2022-11-05 23:39 ` [RFC PATCH 0/2] Input: adc-joystick: " Paul Cercueil
2022-11-06 8:47 ` Siarhei Volkau
2022-11-06 15:22 ` Siarhei Volkau
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=20221031190159.1341027-2-lis8215@gmail.com \
--to=lis8215@gmail.com \
--cc=contact@artur-rojek.eu \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).