linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: hartleys <hartleys@visionengravers.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Subject: Re: [PATCH] generic driver for rotary encoders on GPIOs
Date: Wed, 4 Mar 2009 18:20:54 +0100	[thread overview]
Message-ID: <20090304172054.GD12183@buzzloop.caiaq.de> (raw)
In-Reply-To: <BD79186B4FD85F4B8E60E381CAEE190901349B98@mi8nycmail19.Mi8.com>

Hi Hartleys,

On Wed, Mar 04, 2009 at 12:02:47PM -0500, hartleys wrote:
> >> take a look and if you are still OK with it I will apply to 'next'.
> 
> Couple of comments, none should hold up committing this driver.
> 
> 1) For an absolute encoder shouldn't the position clamp to the
> minimum/maximum values?  Currently the driver is setup to report the
> events going from 0 to 'steps' then the count rolls over (in both
> directions).  Maybe this should be a platform optional flag?  Also,
> maybe the minimum/maximum of the axis should be platform configurable
> instead of just having the 'steps' of the encoder?

Depends on the user level software, I'd say - getting the absolute
position in degrees (which is what is reported, basically) should be
enough as hardware input, anything else is context related, right?

> 2) I have a patch to the driver that allows the axis to be a REL_* type.
> I will post this patch for review after the driver is committed.

Cool, that might be a good alternative for users.

> 3) Are both 'inverted_*' flags really needed?  It appears that the end
> effect of these just reverses the logical direction of the encoder.
> 
> 	inverted_a	inverted_b	result
> 	0		0		normal encoder
> 	0		1		backwards encoder
> 	1		0		backwards encoder
> 	1		1		normal encoder

Probably not. We just had the lines inverted due to some fancy other
logic on the board and hence I made it configurable.

> The same effect should be attainable with one flag to reverse the
> direction, or just reverse the wires on the encoder.

True. The other approache just seemed more straight-forward.

> 3) It might be possible to reconstruct the interrupt handler so that
> only one gpio needs to be interrupt capable.
> 
> Looking at the phase diagram you could consider one of the channel
> inputs as a 'step' interrupt and the other as the 'direction' of the
> step.  On the positive edge of any 'step' if the 'direction' is low it's
> going one way, high it's going the other way.

Hmm - what about the case you're not turning the encoder a full step
ahead but stop in the middle and let it flip back? Will it still detect
that correctly?

> This would double the effective number of encoders that could be
> connected.  And it removes the added overhead of the extra interrupt
> handler and needing to keep track of the 'armed' and 'dir' states.
> Actually with both interrupts sharing the same handler the 'armed' and
> 'dir' variables seem a little bit racy.
> 
> Once the driver is committed I will mess with the interrupt code and see
> if this is possible.

Ok, I'll happily take a look at that. If you flush the idea behind the
state machine, please remember to remove my colleague's name from the
header.

Best regards,
Daniel


  reply	other threads:[~2009-03-04 17:21 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26 18:00 [PATCH] generic driver for rotary encoders on GPIOs Daniel Mack
2009-02-26 18:42 ` Daniel Mack
2009-02-27  3:18   ` hartleys
2009-02-27  6:43     ` Daniel Mack
2009-02-27  8:48       ` Daniel Mack
2009-02-27 17:13       ` hartleys
2009-02-27 17:17         ` Daniel Mack
2009-02-27 18:00       ` Daniel Mack
2009-02-27 18:30         ` hartleys
2009-02-27 18:34           ` Daniel Mack
2009-02-27 20:15             ` hartleys
2009-03-02 14:43               ` Daniel Mack
2009-03-03  8:52                 ` Dmitry Torokhov
2009-03-03  9:03                   ` Dmitry Torokhov
2009-03-03  9:59                     ` Daniel Mack
2009-03-04  8:48                       ` Dmitry Torokhov
2009-03-04  9:50                         ` Daniel Mack
2009-03-04 17:02                           ` hartleys
2009-03-04 17:20                             ` Daniel Mack [this message]
2009-03-07 17:06                               ` Daniel Mack
2009-04-13 23:06                                 ` [PATCH] add REL_* axes support to the rotary encoder driver H Hartley Sweeten
2009-04-14  5:50                                   ` Daniel Mack
2009-04-14 15:33                                     ` H Hartley Sweeten
2009-04-16  2:08                                   ` Dmitry Torokhov
2009-04-16  2:24                                     ` H Hartley Sweeten
2009-04-16  2:33                                       ` Dmitry Torokhov
2009-04-16  3:11                                         ` H Hartley Sweeten
2009-04-16  6:35                                           ` Daniel Mack
2009-04-16  8:05                                           ` Daniel Mack
2009-04-16 16:48                                             ` H Hartley Sweeten
2009-04-16  8:39                                           ` Daniel Mack
2009-04-16 17:09                                             ` H Hartley Sweeten

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=20090304172054.GD12183@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hartleys@visionengravers.com \
    --cc=linux-input@vger.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).