From: Vignesh R <vigneshr@ti.com> Date: 2016-08-24 08:00:09
This series adds support for rotary-switch on AM335x-ICE that is
connected to TI PCA9536 I2C GPIO expander.
First patch adds new generic driver to read status of group of GPIO
lines and report the value as an input event. The second patch adds DT
entries for the same.
v2: https://lkml.org/lkml/2016/8/23/111
v1: https://lkml.org/lkml/2016/8/12/7
Vignesh R (2):
input: misc: Add generic input driver to read encoded GPIO lines
ARM: dts: am335x-icev2: Add nodes for gpio-decoder
.../devicetree/bindings/input/gpio-decoder.txt | 23 ++++
arch/arm/boot/dts/am335x-icev2.dts | 9 ++
drivers/input/misc/Kconfig | 12 ++
drivers/input/misc/Makefile | 1 +
drivers/input/misc/gpio_decoder.c | 134 +++++++++++++++++++++
5 files changed, 179 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/gpio-decoder.txt
create mode 100644 drivers/input/misc/gpio_decoder.c
--
2.9.2
From: Vignesh R <vigneshr@ti.com> Date: 2016-08-24 08:00:05
Add a driver to read group of GPIO lines and provide its status as a
numerical value as input event to the system. This will help in
interfacing devices, that can be connected over GPIOs, that provide
input to the system by driving GPIO lines connected to them like a
rotary dial or a switch.
For example, a rotary switch can be connected to four GPIO lines. The
status of the GPIO lines reflect the actual position of the rotary
switch dial. For example, if dial points to 9, then the four GPIO lines
connected to the switch will read HLLH(0b'1001 = 9). This value
can be reported as an ABS_* event to the input subsystem.
Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
---
v3: Fix comments by Andrew and Dmitry
Link to v2: https://lkml.org/lkml/2016/8/23/79
.../devicetree/bindings/input/gpio-decoder.txt | 23 ++++
drivers/input/misc/Kconfig | 12 ++
drivers/input/misc/Makefile | 1 +
drivers/input/misc/gpio_decoder.c | 134 +++++++++++++++++++++
4 files changed, 170 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/gpio-decoder.txt
create mode 100644 drivers/input/misc/gpio_decoder.c
@@ -0,0 +1,23 @@+* GPIO Decoder DT bindings++Required Properties:+- compatible: should be "gpio-decoder"+- gpios: a spec of gpios (at least two) to be decoded to a number with+ first entry representing the MSB.++Optional Properties:+- decoder-max-value: Maximum possible value that can be reported by+ the gpios.+- linux,axis: the input subsystem axis to map to (ABS_X/ABS_Y).+ Defaults to 0 (ABS_X).++Example:+ gpio-decoder0 {+ compatible = "gpio-decoder";+ gpios = <&pca9536 3 GPIO_ACTIVE_HIGH>,+ <&pca9536 2 GPIO_ACTIVE_HIGH>,+ <&pca9536 1 GPIO_ACTIVE_HIGH>,+ <&pca9536 0 GPIO_ACTIVE_HIGH>;+ linux,axis = <0>; /* ABS_X */+ decoder-max-value = <9>;+ };
From: Vignesh R <vigneshr@ti.com> Date: 2016-08-24 08:00:27
AM335x ICE board has a rotary-switch connected to PCA9536 I2C GPIO
expander. The position of the rotary-switch is reflected by status of
GPIO lines. Add gpio-decoder node to read these GPIO line status via
gpio-decoder driver and report it as an input event to the system.
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
v3: s/decoder,max-value/decoder-max-value
arch/arm/boot/dts/am335x-icev2.dts | 9 +++++++++
1 file changed, 9 insertions(+)
From: Daniel Mack <daniel@zonque.org> Date: 2016-08-24 09:01:48
Hi,
On 08/24/2016 09:58 AM, Vignesh R wrote:
This series adds support for rotary-switch on AM335x-ICE that is
connected to TI PCA9536 I2C GPIO expander.
First patch adds new generic driver to read status of group of GPIO
lines and report the value as an input event. The second patch adds DT
entries for the same.
v2: https://lkml.org/lkml/2016/8/23/111
v1: https://lkml.org/lkml/2016/8/12/7
Is there a reason why the rotary-encoder driver cannot handle this?
Commit 7dde4e74744 ("Input: rotary-encoder - support more than 2 gpios
as input") added support for that mode AFAIU.
I copied the author of that patch to have a look.
Thanks,
Daniel
From: Vignesh R <vigneshr@ti.com> Date: 2016-08-24 09:16:27
Hi,
On Wednesday 24 August 2016 02:05 PM, Daniel Mack wrote:
Hi,
On 08/24/2016 09:58 AM, Vignesh R wrote:
quoted
This series adds support for rotary-switch on AM335x-ICE that is
connected to TI PCA9536 I2C GPIO expander.
First patch adds new generic driver to read status of group of GPIO
lines and report the value as an input event. The second patch adds DT
entries for the same.
v2: https://lkml.org/lkml/2016/8/23/111
v1: https://lkml.org/lkml/2016/8/12/7
Is there a reason why the rotary-encoder driver cannot handle this?
Commit 7dde4e74744 ("Input: rotary-encoder - support more than 2 gpios
as input") added support for that mode AFAIU.
Rotary encoder driver handles incremental encoders only and does not
support absolute encoders. The rotary switch on am335x-ice is different
from the incremental encoders in the
sense that GPIO line status directly reflect the position(number)
pointed by the dial of the encoder. So, there is no need to count steps
or know the direction of rotation as it does not matter.
I did try to enhance rotary-encoder driver to support absolute
encoder[1] but the comment there was to write new driver that simply
translates gpio-encoded value into ABS* event. Indeed, the new driver
looks more simple and can handle more such hardwares.
[1] https://lkml.org/lkml/2016/5/19/98
--
Regards
Vignesh
From: Daniel Mack <daniel@zonque.org> Date: 2016-08-24 11:02:02
On 08/24/2016 11:15 AM, Vignesh R wrote:
On Wednesday 24 August 2016 02:05 PM, Daniel Mack wrote:
quoted
On 08/24/2016 09:58 AM, Vignesh R wrote:
quoted
This series adds support for rotary-switch on AM335x-ICE that is
connected to TI PCA9536 I2C GPIO expander.
First patch adds new generic driver to read status of group of GPIO
lines and report the value as an input event. The second patch adds DT
entries for the same.
v2: https://lkml.org/lkml/2016/8/23/111
v1: https://lkml.org/lkml/2016/8/12/7
Is there a reason why the rotary-encoder driver cannot handle this?
Commit 7dde4e74744 ("Input: rotary-encoder - support more than 2 gpios
as input") added support for that mode AFAIU.
Rotary encoder driver handles incremental encoders only and does not
support absolute encoders. The rotary switch on am335x-ice is different
from the incremental encoders in the
sense that GPIO line status directly reflect the position(number)
pointed by the dial of the encoder. So, there is no need to count steps
or know the direction of rotation as it does not matter.
I did try to enhance rotary-encoder driver to support absolute
encoder[1] but the comment there was to write new driver that simply
translates gpio-encoded value into ABS* event. Indeed, the new driver
looks more simple and can handle more such hardwares.
Okay. Yes, that makes sense. Thanks for the explanation!
Daniel
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 24, 2016 at 01:28:58PM +0530, Vignesh R wrote:
quoted hunk
Add a driver to read group of GPIO lines and provide its status as a
numerical value as input event to the system. This will help in
interfacing devices, that can be connected over GPIOs, that provide
input to the system by driving GPIO lines connected to them like a
rotary dial or a switch.
For example, a rotary switch can be connected to four GPIO lines. The
status of the GPIO lines reflect the actual position of the rotary
switch dial. For example, if dial points to 9, then the four GPIO lines
connected to the switch will read HLLH(0b'1001 = 9). This value
can be reported as an ABS_* event to the input subsystem.
Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
---
v3: Fix comments by Andrew and Dmitry
Link to v2: https://lkml.org/lkml/2016/8/23/79
.../devicetree/bindings/input/gpio-decoder.txt | 23 ++++
drivers/input/misc/Kconfig | 12 ++
drivers/input/misc/Makefile | 1 +
drivers/input/misc/gpio_decoder.c | 134 +++++++++++++++++++++
4 files changed, 170 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/gpio-decoder.txt
create mode 100644 drivers/input/misc/gpio_decoder.c
@@ -0,0 +1,23 @@+* GPIO Decoder DT bindings++Required Properties:+- compatible: should be "gpio-decoder"+- gpios: a spec of gpios (at least two) to be decoded to a number with+ first entry representing the MSB.++Optional Properties:+- decoder-max-value: Maximum possible value that can be reported by+ the gpios.+- linux,axis: the input subsystem axis to map to (ABS_X/ABS_Y).+ Defaults to 0 (ABS_X).++Example:+ gpio-decoder0 {+ compatible = "gpio-decoder";+ gpios = <&pca9536 3 GPIO_ACTIVE_HIGH>,+ <&pca9536 2 GPIO_ACTIVE_HIGH>,+ <&pca9536 1 GPIO_ACTIVE_HIGH>,+ <&pca9536 0 GPIO_ACTIVE_HIGH>;+ linux,axis = <0>; /* ABS_X */+ decoder-max-value = <9>;+ };
From: Vignesh R <vigneshr@ti.com> Date: 2016-08-29 04:21:37
On Thursday 25 August 2016 10:26 PM, Dmitry Torokhov wrote:
On Wed, Aug 24, 2016 at 01:28:58PM +0530, Vignesh R wrote:
quoted
Add a driver to read group of GPIO lines and provide its status as a
numerical value as input event to the system. This will help in
interfacing devices, that can be connected over GPIOs, that provide
input to the system by driving GPIO lines connected to them like a
rotary dial or a switch.
For example, a rotary switch can be connected to four GPIO lines. The
status of the GPIO lines reflect the actual position of the rotary
switch dial. For example, if dial points to 9, then the four GPIO lines
connected to the switch will read HLLH(0b'1001 = 9). This value
can be reported as an ABS_* event to the input subsystem.
Signed-off-by: Vignesh R <redacted>
Acked-by: Rob Herring <redacted>
---
v3: Fix comments by Andrew and Dmitry
Link to v2: https://lkml.org/lkml/2016/8/23/79
.../devicetree/bindings/input/gpio-decoder.txt | 23 ++++
drivers/input/misc/Kconfig | 12 ++
drivers/input/misc/Makefile | 1 +
drivers/input/misc/gpio_decoder.c | 134 +++++++++++++++++++++
4 files changed, 170 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/gpio-decoder.txt
create mode 100644 drivers/input/misc/gpio_decoder.c
@@ -0,0 +1,23 @@+* GPIO Decoder DT bindings++Required Properties:+- compatible: should be "gpio-decoder"+- gpios: a spec of gpios (at least two) to be decoded to a number with+ first entry representing the MSB.++Optional Properties:+- decoder-max-value: Maximum possible value that can be reported by+ the gpios.+- linux,axis: the input subsystem axis to map to (ABS_X/ABS_Y).+ Defaults to 0 (ABS_X).++Example:+ gpio-decoder0 {+ compatible = "gpio-decoder";+ gpios = <&pca9536 3 GPIO_ACTIVE_HIGH>,+ <&pca9536 2 GPIO_ACTIVE_HIGH>,+ <&pca9536 1 GPIO_ACTIVE_HIGH>,+ <&pca9536 0 GPIO_ACTIVE_HIGH>;+ linux,axis = <0>; /* ABS_X */+ decoder-max-value = <9>;+ };
Thanks a lot!
--
Regards
Vignesh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Aug 29, 2016 at 09:50:28AM +0530, Vignesh R wrote:
On Thursday 25 August 2016 10:26 PM, Dmitry Torokhov wrote:
quoted
On Wed, Aug 24, 2016 at 01:28:58PM +0530, Vignesh R wrote:
quoted
Add a driver to read group of GPIO lines and provide its status as a
numerical value as input event to the system. This will help in
interfacing devices, that can be connected over GPIOs, that provide
input to the system by driving GPIO lines connected to them like a
rotary dial or a switch.
For example, a rotary switch can be connected to four GPIO lines. The
status of the GPIO lines reflect the actual position of the rotary
switch dial. For example, if dial points to 9, then the four GPIO lines
connected to the switch will read HLLH(0b'1001 = 9). This value
can be reported as an ABS_* event to the input subsystem.
Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
---
v3: Fix comments by Andrew and Dmitry
Link to v2: https://lkml.org/lkml/2016/8/23/79
.../devicetree/bindings/input/gpio-decoder.txt | 23 ++++
drivers/input/misc/Kconfig | 12 ++
drivers/input/misc/Makefile | 1 +
drivers/input/misc/gpio_decoder.c | 134 +++++++++++++++++++++
4 files changed, 170 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/gpio-decoder.txt
create mode 100644 drivers/input/misc/gpio_decoder.c
@@ -0,0 +1,23 @@+* GPIO Decoder DT bindings++Required Properties:+- compatible: should be "gpio-decoder"+- gpios: a spec of gpios (at least two) to be decoded to a number with+ first entry representing the MSB.++Optional Properties:+- decoder-max-value: Maximum possible value that can be reported by+ the gpios.+- linux,axis: the input subsystem axis to map to (ABS_X/ABS_Y).+ Defaults to 0 (ABS_X).++Example:+ gpio-decoder0 {+ compatible = "gpio-decoder";+ gpios = <&pca9536 3 GPIO_ACTIVE_HIGH>,+ <&pca9536 2 GPIO_ACTIVE_HIGH>,+ <&pca9536 1 GPIO_ACTIVE_HIGH>,+ <&pca9536 0 GPIO_ACTIVE_HIGH>;+ linux,axis = <0>; /* ABS_X */+ decoder-max-value = <9>;+ };
From: Tony Lindgren <tony@atomide.com> Date: 2016-08-30 18:45:14
* Dmitry Torokhov [off-list ref] [160829 20:26]:
Applied, thank you.
DTS change should go through some other tree though.
Thanks I'm picking up the dts patch into omap-for-v4.9/dt.
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello,
On Wed, Aug 24, 2016 at 02:45:17PM +0530, Vignesh R wrote:
On Wednesday 24 August 2016 02:05 PM, Daniel Mack wrote:
quoted
On 08/24/2016 09:58 AM, Vignesh R wrote:
quoted
This series adds support for rotary-switch on AM335x-ICE that is
connected to TI PCA9536 I2C GPIO expander.
First patch adds new generic driver to read status of group of GPIO
lines and report the value as an input event. The second patch adds DT
entries for the same.
v2: https://lkml.org/lkml/2016/8/23/111
v1: https://lkml.org/lkml/2016/8/12/7
Is there a reason why the rotary-encoder driver cannot handle this?
Commit 7dde4e74744 ("Input: rotary-encoder - support more than 2 gpios
as input") added support for that mode AFAIU.
Rotary encoder driver handles incremental encoders only and does not
support absolute encoders. The rotary switch on am335x-ice is different
from the incremental encoders in the
sense that GPIO line status directly reflect the position(number)
pointed by the dial of the encoder. So, there is no need to count steps
or know the direction of rotation as it does not matter.
I'd still prefer to expand drivers/input/misc/rotary_encoder.c to handle
this. Yes, there is no reason to count steps or determine the direction
of a rotation in this case, but still there is much code to share and
IMHO it's ok that a driver that handles several types of similar devices
does too much for some special cases.
I did try to enhance rotary-encoder driver to support absolute
encoder[1] but the comment there was to write new driver that simply
translates gpio-encoded value into ABS* event. Indeed, the new driver
looks more simple and can handle more such hardwares.
Which type of hardware can be handled by your driver that the generic
rotary encoder cannot? I guess it's just a matter of a (simple) patch?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html