lkml.org 
[lkml]   [2008]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch/rfc 2.6.25-git v2] gpio: sysfs interface
Date
On Wednesday 30 April 2008, Ben Nizette wrote:
>
> On Wed, 2008-04-30 at 14:34 -0700, David Brownell wrote:
> > Simple sysfs interface for GPIOs.
> >
> > /sys/class/gpio
> > /control ... to request a GPIO be imported or returned
> > /gpioN ... for each exported GPIO #N
> > /value ... always readable, writes fail for input GPIOs
> > /direction ... r/w as: in, out (default low); write high, low
> > /gpiochipN ... for each gpiochip; #N is its first GPIO
> > /base ... (r/o) same as N
> > /label ... (r/o) descriptive, not necessarily unique
> > /ngpio ... (r/o) number of GPIOs; numbered N .. N+(ngpio - 1)
>
> You dropped the 'device' symlink? Sure it won't always be available but
> I did quite like the idea of being able to walk back through sysfs and
> discover, for example, the SPI chip select to which it's attached.

Just didn't describe it in that summary ... like several other
standard attributes, like "uevent" and "subsystem". The only
thing different about "device" is that when the gpio_chip doesn't
say what device it uses, that will (necessarily) be missing.
And again, that's just like all other class device nodes.


> > +/*
> > + * /sys/class/gpio/control ... write-only
> > + * integer N: non-negative == export; negative == unexport
> > + */
> > +static ssize_t control_store(struct class *class, const char *buf, size_t len)
>
> Unexport gpio 0?

Yeah, gotta fix that. Unfortunately "-0" == "0" ... I'll have to
handle any leading "-" by hand. Trivial fix, in all.

- Dave



\
 
 \ /
  Last update: 2008-05-01 23:43    [W:0.100 / U:8.268 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site