Re: [patch/rfc 2.6.25-git] gpio: sysfs interface

From: Pavel Machek
Date: Fri May 02 2008 - 16:37:41 EST


Hi!

> > Simple sysfs interface for GPIOs.
> >
> > /sys/class/gpio
> > /gpio-N ... for each exported GPIO #N
> > /value ... always readable, writes fail except for output GPIOs
> > /direction ... writable as: in, out (default low), high, low
> > /control ... to request a GPIO be exported or unexported
> >
> > GPIOs may be exported by kernel code using gpio_export(), which should
> > be most useful for driver debugging. Userspace may also ask that they
> > be exported by writing to the sysfs control file, helping to cope with
> > incomplete board support:
> >
> > echo "export 23" > /sys/class/gpio/control
> > ... will gpio_request(23, "sysfs") and gpio_export(23); use
> > /sys/class/gpio/gpio-23/direction to configure it.
> > echo "unexport 23" > /sys/class/gpio/control
> > ... will gpio_free(23)
>
> hm, does ths sysfs one-value-per-file rule apply to writes?

Having seen ibm acpi interface... yes, that rule should be aplied for
writes, too.

What about mkdir gpio-N to export it?

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/