From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/2] Input: rotary-encoder- Add support for absolute encoder
Date: Tue, 24 May 2016 10:20:40 +0200 [thread overview]
Message-ID: <20160524082040.GR23704@pengutronix.de> (raw)
In-Reply-To: <5743E206.2050602@ti.com>
Hello,
On Tue, May 24, 2016 at 10:39:26AM +0530, Vignesh R wrote:
> On 05/23/2016 06:48 PM, Uwe Kleine-K?nig wrote:
> > On Mon, May 23, 2016 at 04:48:40PM +0530, R, Vignesh wrote:
> >> On 5/22/2016 3:56 PM, Uwe Kleine-K?nig wrote:
> >>> On Thu, May 19, 2016 at 02:34:00PM +0530, Vignesh R wrote:
> >>>> +- rotary-encoder,absolute-encoder: support encoders where GPIO lines
> >>>> + reflect the actual position of the rotary encoder dial. For example,
> >>>> + if dial points to 9, then four GPIO lines read HLLH(1001b = 9).
> >>>> + In this case, rotary-encoder,steps-per-period needed not be defined.
> >>>
> >>> IMHO this is wrong, I'd formalize this device as:
> >>>
> >>> {
> >>> compatible = "rotary-encoder";
> >>> gpios = <&gpio 19 1>, <&gpio 20 0>, <...>, <...>;
> >>> rotary-encoder,encoding = "binary";
> >>> rotary-encoder,steps = <16>;
> >>> rotary-encoder,steps-per-period = <16>;
> >>
> >> The above bindings essential means quarter_period device. I would not
> >> like to bother with all the logic in rotary_encoder_quarter_period_irq()
> >> when we can know encoder->pos by directly reading state of gpio lines.
> >
> > OK, we have code that is more complex than it needs to be for your
> > device. But your device is a special case of the supported devices, so
> > I'd say don't bother that there is more logic in the driver than you
> > need and be lucky.
>
> More complexity is just a overhead. Since, encoder can be turned at a
> rate faster than handling of IRQs (rotary_encoder_quarter_period_irq()
> is threaded IRQ hence, priority is not close to real time), some states
This problem isn't unique to your hardware. An "ordinary" encoder with
just two GPIOs and more than one period can be rotated faster than
1/irq_latency, too. There are two things that can be done:
- undo the conversion to threaded irqs; or
- read out the gpios in the fast handler and only delay decoding and
reporting of the event
Both approaches have their disadvantages.
> can be missed. rotary_encoder_quarter_period_irq() is not robust in this
> case, reading gpios directly is more suitable option. I see similar
> views expressed in previously[1]
>
> [1]http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/391196.html
IMHO the right thing to do is to improve
rotary_encoder_quarter_period_irq (and also the other handlers for full
and half period mode) to make use of additional GPIOs. This way all
types of devices benefit and more code is shared.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2016-05-24 8:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 9:03 [RFC PATCH 0/2] AM335x-ICE: Add support for rotary-encoder Vignesh R
2016-05-19 9:04 ` [RFC PATCH 1/2] Input: rotary-encoder- Add support for absolute encoder Vignesh R
2016-05-19 11:25 ` Krzysztof Kozlowski
2016-05-19 11:44 ` Vignesh R
2016-05-20 16:34 ` Dmitry Torokhov
2016-05-23 9:18 ` R, Vignesh
2016-05-25 8:44 ` Vignesh R
2016-06-16 10:47 ` Vignesh R
2016-07-19 13:04 ` R, Vignesh
2016-05-20 21:49 ` Rob Herring
2016-05-22 10:26 ` Uwe Kleine-König
2016-05-23 11:18 ` R, Vignesh
2016-05-23 13:18 ` Uwe Kleine-König
2016-05-24 5:09 ` Vignesh R
2016-05-24 8:20 ` Uwe Kleine-König [this message]
2016-05-25 8:44 ` Vignesh R
2016-05-19 9:04 ` [RFC PATCH 2/2] ARM: dts: am335x-icev2: Add rotary-encoder node Vignesh R
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=20160524082040.GR23704@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).