All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Ben Nizette <bn@niasdigital.com>
Cc: "Daniel Glöckner" <dg@emlix.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpiolib: allow poll on gpio value
Date: Fri, 5 Jun 2009 23:01:39 -0700	[thread overview]
Message-ID: <200906052301.39877.david-b@pacbell.net> (raw)
In-Reply-To: <1244260002.22690.21.camel@linux-51e8.site>

On Friday 05 June 2009, Ben Nizette wrote:
> 
> Hey, good stuff Daniel.  There's a fair few common features missing but
> they can be added at a later date.
> 
> - Ability to honour rising and falling filters even if the hardware only
> supports both-edge (as lots of gpio interrupts do)

I suspect that's inadvisable.  Userspace code will need to know
what trigger model it's using, yes?  Lies are doubleplusungood.


> - Support for polling the gpio at some interval for gpios which don't
> support irqs at all

I had that thought.  Units ... seconds?  Milliseconds mapped to HZ?
Could come later.


> - Debounce support

Software?  Hardware capabilties vary *widely* ... three cases that
come quickly to mind:  (a) twl4030 fixed 30 msec delays, (b) at91
and avr32 "deglitch" filter, just syncs to a clock that's likely
from 30-100 MHz, (c) omap2/omap3, up to 255 cycles of 32 KiHz clock
but appplies entire GPIO banks, (d) DaVinci, no hardware support.

I can imagine a standard software filter option, but that would
need to be a separate sysfs mechanism since it wouldn't always
be desired.  (And separate patch, if needed.)

For hardware options ... do that by hardware-specific sysfs hooks
if they're really needed.


> - Reporting of number of changes since last read

Feels a more than bit overkilled by now.  ;)


> These are all things which exist in many out-of-tree or
> platform-specific implementations of this kind of thing and until
> they're there I reckon people will largely stick with what they've got.
> But that's really their problem of course, this is still valuable.
> 
> Regarding the code itself, not much but:
> 
> On Fri, 2009-06-05 at 16:36 +0200, Daniel Glöckner wrote:
> >  
> > +	"poll_edge" ... reads as either "none", "rising", "falling", or
> 
> IMO this is misleading, sounds like you're polling the gpio. 

So, just name the sysfs attribute "edge"?

 
> > +
> > +	struct sysfs_dirent	*value_sd;
> >  };
> 
> No CONFIG_ option to turn all this off?
> 
> What's the .text and .data impact of this?  Sure it's going to be small,
> but to some people (especially those likely to care about gpio) 1k
> of .data is something worth being able to turn off.

I think it's probably OK to have this covered by the current
GPIO_SYSFS flag.

 
> Using an IDR keyed to the gpio value and just allocating your useful
> data structures when poll_edge != "none" would help too.

Can do that without an IDR, I think...


  parent reply	other threads:[~2009-06-06  6:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-05 14:36 [PATCH] gpiolib: allow poll on gpio value Daniel Glöckner
2009-06-06  3:46 ` Ben Nizette
2009-06-06  3:53   ` Ben Nizette
2009-06-06  6:01   ` David Brownell [this message]
2009-06-06  6:51     ` Ben Nizette
2009-06-06  5:41 ` David Brownell
2009-06-10 12:36 ` [PATCH v2] gpiolib: allow poll(2) " Daniel Glöckner
2009-07-01 23:05   ` David Brownell
2009-07-02  0:19     ` Ben Nizette
2009-07-02 11:15     ` Jani Nikula
2009-07-02 18:57       ` David Brownell
2009-07-02 21:37         ` Jani Nikula
2009-07-02 22:16           ` David Brownell
2009-07-14 19:26   ` [PATCH v3] " Daniel Glöckner

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=200906052301.39877.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=bn@niasdigital.com \
    --cc=dg@emlix.com \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.