devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document
       [not found] <20190107164249.2342-1-nazgul33@gmail.com>
@ 2019-01-07 16:42 ` Donghoon Han
  2019-01-14 20:16   ` Rob Herring
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Donghoon Han @ 2019-01-07 16:42 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, Daniel Mack, linux-kernel, devicetree

Add DT binding document for rotary-encoder, keycode options.

Signed-off-by: Donghoon Han <nazgul33@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Daniel Mack <daniel@caiaq.de>
Cc: devicetree@vger.kernel.org
To: linux-input@vger.kernel.org
---
 .../devicetree/bindings/input/rotary-encoder.txt     | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
index f99fe5cdeaec..9986ec2af2d4 100644
--- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
+++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
@@ -12,6 +12,10 @@ Optional properties:
 - rotary-encoder,relative-axis: register a relative axis rather than an
   absolute one. Relative axis will only generate +1/-1 events on the input
   device, hence no steps need to be passed.
+- rotary-encoder,relative-keys : generate pair of key events. This setting
+  behaves just like relative-axis, generating key events instead.
+  (Keycodes[2] corresponds to -1/1 events.)
+- rotary-encoder,relative-keycodes : keycodes for relative-keys
 - rotary-encoder,rollover: Automatic rollover when the rotary value becomes
   greater than the specified steps or smaller than 0. For absolute axis only.
 - rotary-encoder,steps-per-period: Number of steps (stable states) per period.
@@ -48,3 +52,11 @@ Example:
 			rotary-encoder,encoding = "binary";
 			rotary-encoder,rollover;
 		};
+
+		rotary@2 {
+			compatible = "rotary-encoder";
+			gpios = <&gpio 21 0>, <&gpio 22 0>;
+			rotary-encoder,relative-keys;
+			rotary-encoder,relative-keycode = <103>, <108>;
+			rotary-encoder,steps-per-period = <2>;
+		};
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document
  2019-01-07 16:42 ` [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document Donghoon Han
@ 2019-01-14 20:16   ` Rob Herring
  2019-01-15  3:52   ` Dmitry Torokhov
  2019-01-15  3:53   ` Dmitry Torokhov
  2 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-01-14 20:16 UTC (permalink / raw)
  To: Donghoon Han
  Cc: linux-input, Dmitry Torokhov, Daniel Mack,
	linux-kernel@vger.kernel.org, devicetree

On Mon, Jan 7, 2019 at 10:43 AM Donghoon Han <nazgul33@gmail.com> wrote:
>

The subject needs to be improved. It doesn't match the change.

> Add DT binding document for rotary-encoder, keycode options.
>
> Signed-off-by: Donghoon Han <nazgul33@gmail.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Daniel Mack <daniel@caiaq.de>
> Cc: devicetree@vger.kernel.org
> To: linux-input@vger.kernel.org
> ---
>  .../devicetree/bindings/input/rotary-encoder.txt     | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> index f99fe5cdeaec..9986ec2af2d4 100644
> --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
> +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> @@ -12,6 +12,10 @@ Optional properties:
>  - rotary-encoder,relative-axis: register a relative axis rather than an
>    absolute one. Relative axis will only generate +1/-1 events on the input
>    device, hence no steps need to be passed.
> +- rotary-encoder,relative-keys : generate pair of key events. This setting
> +  behaves just like relative-axis, generating key events instead.
> +  (Keycodes[2] corresponds to -1/1 events.)
> +- rotary-encoder,relative-keycodes : keycodes for relative-keys
>  - rotary-encoder,rollover: Automatic rollover when the rotary value becomes
>    greater than the specified steps or smaller than 0. For absolute axis only.
>  - rotary-encoder,steps-per-period: Number of steps (stable states) per period.
> @@ -48,3 +52,11 @@ Example:
>                         rotary-encoder,encoding = "binary";
>                         rotary-encoder,rollover;
>                 };
> +
> +               rotary@2 {
> +                       compatible = "rotary-encoder";
> +                       gpios = <&gpio 21 0>, <&gpio 22 0>;
> +                       rotary-encoder,relative-keys;
> +                       rotary-encoder,relative-keycode = <103>, <108>;
> +                       rotary-encoder,steps-per-period = <2>;
> +               };
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document
  2019-01-07 16:42 ` [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document Donghoon Han
  2019-01-14 20:16   ` Rob Herring
@ 2019-01-15  3:52   ` Dmitry Torokhov
  2019-01-15 20:29     ` Rob Herring
  2019-01-15  3:53   ` Dmitry Torokhov
  2 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2019-01-15  3:52 UTC (permalink / raw)
  To: Donghoon Han; +Cc: linux-input, Daniel Mack, linux-kernel, devicetree

On Tue, Jan 08, 2019 at 01:42:49AM +0900, Donghoon Han wrote:
> Add DT binding document for rotary-encoder, keycode options.
> 
> Signed-off-by: Donghoon Han <nazgul33@gmail.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Daniel Mack <daniel@caiaq.de>
> Cc: devicetree@vger.kernel.org
> To: linux-input@vger.kernel.org
> ---
>  .../devicetree/bindings/input/rotary-encoder.txt     | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> index f99fe5cdeaec..9986ec2af2d4 100644
> --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
> +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> @@ -12,6 +12,10 @@ Optional properties:
>  - rotary-encoder,relative-axis: register a relative axis rather than an
>    absolute one. Relative axis will only generate +1/-1 events on the input
>    device, hence no steps need to be passed.
> +- rotary-encoder,relative-keys : generate pair of key events. This setting
> +  behaves just like relative-axis, generating key events instead.
> +  (Keycodes[2] corresponds to -1/1 events.)
> +- rotary-encoder,relative-keycodes : keycodes for relative-keys

Given that keycodes are linux-specific, I think the property should be
linux,keycodes. Also, I am not sure we need separate
rotary-encoder,relative-keys property as we can infer that we want to
generate keys from presence of linux,keycodes property.

Rob, any comments?

>  - rotary-encoder,rollover: Automatic rollover when the rotary value becomes
>    greater than the specified steps or smaller than 0. For absolute axis only.
>  - rotary-encoder,steps-per-period: Number of steps (stable states) per period.
> @@ -48,3 +52,11 @@ Example:
>  			rotary-encoder,encoding = "binary";
>  			rotary-encoder,rollover;
>  		};
> +
> +		rotary@2 {
> +			compatible = "rotary-encoder";
> +			gpios = <&gpio 21 0>, <&gpio 22 0>;
> +			rotary-encoder,relative-keys;
> +			rotary-encoder,relative-keycode = <103>, <108>;
> +			rotary-encoder,steps-per-period = <2>;
> +		};
> -- 
> 2.17.1
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document
  2019-01-07 16:42 ` [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document Donghoon Han
  2019-01-14 20:16   ` Rob Herring
  2019-01-15  3:52   ` Dmitry Torokhov
@ 2019-01-15  3:53   ` Dmitry Torokhov
  2 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2019-01-15  3:53 UTC (permalink / raw)
  To: Donghoon Han, Rob Herring
  Cc: linux-input, Daniel Mack, linux-kernel, devicetree

[ resending to Rob... ]
On Tue, Jan 08, 2019 at 01:42:49AM +0900, Donghoon Han wrote:
> Add DT binding document for rotary-encoder, keycode options.
> 
> Signed-off-by: Donghoon Han <nazgul33@gmail.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Daniel Mack <daniel@caiaq.de>
> Cc: devicetree@vger.kernel.org
> To: linux-input@vger.kernel.org
> ---
>  .../devicetree/bindings/input/rotary-encoder.txt     | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> index f99fe5cdeaec..9986ec2af2d4 100644
> --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
> +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> @@ -12,6 +12,10 @@ Optional properties:
>  - rotary-encoder,relative-axis: register a relative axis rather than an
>    absolute one. Relative axis will only generate +1/-1 events on the input
>    device, hence no steps need to be passed.
> +- rotary-encoder,relative-keys : generate pair of key events. This setting
> +  behaves just like relative-axis, generating key events instead.
> +  (Keycodes[2] corresponds to -1/1 events.)
> +- rotary-encoder,relative-keycodes : keycodes for relative-keys

Given that keycodes are linux-specific, I think the property should be
linux,keycodes. Also, I am not sure we need separate
rotary-encoder,relative-keys property as we can infer that we want to
generate keys from presence of linux,keycodes property.

Rob, any comments?

>  - rotary-encoder,rollover: Automatic rollover when the rotary value becomes
>    greater than the specified steps or smaller than 0. For absolute axis only.
>  - rotary-encoder,steps-per-period: Number of steps (stable states) per period.
> @@ -48,3 +52,11 @@ Example:
>  			rotary-encoder,encoding = "binary";
>  			rotary-encoder,rollover;
>  		};
> +
> +		rotary@2 {
> +			compatible = "rotary-encoder";
> +			gpios = <&gpio 21 0>, <&gpio 22 0>;
> +			rotary-encoder,relative-keys;
> +			rotary-encoder,relative-keycode = <103>, <108>;
> +			rotary-encoder,steps-per-period = <2>;
> +		};
> -- 
> 2.17.1
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document
  2019-01-15  3:52   ` Dmitry Torokhov
@ 2019-01-15 20:29     ` Rob Herring
  2019-03-22  1:04       ` Alexey Slepov
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2019-01-15 20:29 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Donghoon Han, linux-input, Daniel Mack, linux-kernel, devicetree

On Mon, Jan 14, 2019 at 07:52:21PM -0800, Dmitry Torokhov wrote:
> On Tue, Jan 08, 2019 at 01:42:49AM +0900, Donghoon Han wrote:
> > Add DT binding document for rotary-encoder, keycode options.
> > 
> > Signed-off-by: Donghoon Han <nazgul33@gmail.com>
> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: Daniel Mack <daniel@caiaq.de>
> > Cc: devicetree@vger.kernel.org
> > To: linux-input@vger.kernel.org
> > ---
> >  .../devicetree/bindings/input/rotary-encoder.txt     | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> > index f99fe5cdeaec..9986ec2af2d4 100644
> > --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
> > +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> > @@ -12,6 +12,10 @@ Optional properties:
> >  - rotary-encoder,relative-axis: register a relative axis rather than an
> >    absolute one. Relative axis will only generate +1/-1 events on the input
> >    device, hence no steps need to be passed.
> > +- rotary-encoder,relative-keys : generate pair of key events. This setting
> > +  behaves just like relative-axis, generating key events instead.
> > +  (Keycodes[2] corresponds to -1/1 events.)
> > +- rotary-encoder,relative-keycodes : keycodes for relative-keys
> 
> Given that keycodes are linux-specific, I think the property should be
> linux,keycodes. Also, I am not sure we need separate
> rotary-encoder,relative-keys property as we can infer that we want to
> generate keys from presence of linux,keycodes property.
> 
> Rob, any comments?

Yes, I had similar thoughts.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document
  2019-01-15 20:29     ` Rob Herring
@ 2019-03-22  1:04       ` Alexey Slepov
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Slepov @ 2019-03-22  1:04 UTC (permalink / raw)
  To: Rob Herring, Dmitry Torokhov
  Cc: Donghoon Han, linux-input, Daniel Mack, linux-kernel, devicetree

Hello,

i used this rotary-encoder patch in my embedded project and found two 
errors:


First, in drivers/input/misc/rotary_encoder.c,
at @@ -237,6 +244,16 @@:
instead of

+        if (err)
+            dev_err(dev, "unable to get keycodes: %d\n", err);
+        return err;

it must be

+        if (err) {
+            dev_err(dev, "unable to get keycodes: %d\n", err);
+            return err;
+        }

otherwise successful creation of device is not possible.


Second, a typo in 
Documentation/devicetree/bindings/input/rotary-encoder.txt,
at @@ -48,3 +52,11 @@:
instead of

+            rotary-encoder,relative-keycode = <103>, <108>;

it should be

+            rotary-encoder,relative-keycodes = <103>, <108>;

otherwise keycodes are not found.


I am sorry, I know that E-Mail style is not good.
I have no time right now, but I'll be back in two weeks.
Someone, maybe Mr. Han, could submit a new version of the patch.
If not, I'll try to do it on my return. (it could take some time, since 
I am new to patchwork)

Best Regards and thanks
Alexey Slepov

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-22  1:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190107164249.2342-1-nazgul33@gmail.com>
2019-01-07 16:42 ` [PATCH V2 2/2] Input: rotaty-encoder - Add DT binding document Donghoon Han
2019-01-14 20:16   ` Rob Herring
2019-01-15  3:52   ` Dmitry Torokhov
2019-01-15 20:29     ` Rob Herring
2019-03-22  1:04       ` Alexey Slepov
2019-01-15  3:53   ` Dmitry Torokhov

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).