The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* GPIOLIB, GPIO_SYS and port-wide accesses
@ 2009-08-14  0:01 John Williams
  2009-08-14  8:11 ` Ben Nizette
  0 siblings, 1 reply; 2+ messages in thread
From: John Williams @ 2009-08-14  0:01 UTC (permalink / raw)
  To: Linux Kernel list
  Cc: John Linn, Stephen Neuendorffer, David DeBonis, Michal Simek,
	Grant Likely

Hi,

As I see it the gpiolib and sysfs export insists on single bit
accesses even on gpio pins that are located on the same physical
device/port.

A couple of years ago there was mention of port-wide accesses being a
good thing:

http://lkml.indiana.edu/hypermail/linux/kernel/0608.0/0731.html
(towards the bottom)

Did anything ever come of that?

Per-bit access is pretty inflexible if you are driving a 7-segment
display or 8-LED bar display, holding lots of file descriptors open
etc, and lots of syscall overhead.

sysfs syntax like

$ echo "240-247" > export
$ echo 255 > gpio240-247/direction  (8-bit binary mask - output)
$ echo 255 > gpio240-247/value (all ones)

would be reasonably friendly, obviously the underlying gpiolib would
have to have some notion of coupled ports.

Any thoughts?

John
-- 
John Williams,
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com  p: +61-7-30090663  f: +61-7-30090663

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

* Re: GPIOLIB, GPIO_SYS and port-wide accesses
  2009-08-14  0:01 GPIOLIB, GPIO_SYS and port-wide accesses John Williams
@ 2009-08-14  8:11 ` Ben Nizette
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Nizette @ 2009-08-14  8:11 UTC (permalink / raw)
  To: John Williams
  Cc: Linux Kernel list, John Linn, Stephen Neuendorffer, David DeBonis,
	Michal Simek, Grant Likely


On Fri, 2009-08-14 at 10:01 +1000, John Williams wrote:
> Did anything ever come of that?

Nothing ever did, though others keep half-heartedly implementing the
same thing every few months.  They seem to disappear before it's
accepted though.

> 
> Per-bit access is pretty inflexible if you are driving a 7-segment
> display or 8-LED bar display, holding lots of file descriptors open
> etc, and lots of syscall overhead.
> 
> sysfs syntax like
> 
> $ echo "240-247" > export
> $ echo 255 > gpio240-247/direction  (8-bit binary mask - output)
> $ echo 255 > gpio240-247/value (all ones)
> 

The first line, to some eyes, would violate the one-value-per-attribute
thing sysfs insists on, but sure there are ways to do this.

> would be reasonably friendly, obviously the underlying gpiolib would
> have to have some notion of coupled ports.

The main stumbling block is that implementers forget that gpiolib is
just one implementation of the gpio api - any solution should

1) define accessor functions for multiple bits in the gpio api
2) implement these in gpiolib and other gpio api implementations (I
think the other implementations at the moment are all just stubs anyway)
3) Get gpiolib to bunt requests to the gpiochip
4) Write support for each gpiochip which has this functionality

The other stumbling block is that this all depends on bitmasks of some
kind or other but there's no good reason to nail this to any particular
word size.  Sure most are 8- or 32-bit banks but we have to deal with
the weird ones too.  In particular, I've seen FPGA-implemented gpio
controllers with banks of many hundred GPIO.  Accommodating those will
take an amount of bit-fu.

Anyway, if anyone out there has the patience to stick around until a
solution is correct we'll get something useful for all I'm sure.

	--Ben.


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

end of thread, other threads:[~2009-08-14  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-14  0:01 GPIOLIB, GPIO_SYS and port-wide accesses John Williams
2009-08-14  8:11 ` Ben Nizette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox