The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ben Nizette <bn@niasdigital.com>
To: John Williams <john.williams@petalogix.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
	John Linn <John.Linn@xilinx.com>,
	Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>,
	David DeBonis <david.debonis@xilinx.com>,
	Michal Simek <michal.simek@petalogix.com>,
	Grant Likely <grant.likely@secretlab.ca>
Subject: Re: GPIOLIB, GPIO_SYS and port-wide accesses
Date: Fri, 14 Aug 2009 18:11:52 +1000	[thread overview]
Message-ID: <1250237512.4033.135.camel@ben-desktop> (raw)
In-Reply-To: <1d3f23370908131701w50f2c550r312b14b2c7f2d12c@mail.gmail.com>


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.


      reply	other threads:[~2009-08-14  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14  0:01 GPIOLIB, GPIO_SYS and port-wide accesses John Williams
2009-08-14  8:11 ` Ben Nizette [this message]

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=1250237512.4033.135.camel@ben-desktop \
    --to=bn@niasdigital.com \
    --cc=John.Linn@xilinx.com \
    --cc=david.debonis@xilinx.com \
    --cc=grant.likely@secretlab.ca \
    --cc=john.williams@petalogix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@petalogix.com \
    --cc=stephen.neuendorffer@xilinx.com \
    /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