Files
kernel-tenderloin-3.0/include/linux
David Brownell d8f388d8dc gpio: sysfs interface
This adds a simple sysfs interface for GPIOs.

    /sys/class/gpio
    	/export ... asks the kernel to export a GPIO to userspace
    	/unexport ... to return a GPIO to the kernel
        /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)

GPIOs claimed by kernel code may be exported by its owner using a new
gpio_export() call, which should be most useful for driver debugging.
Such exports may optionally be done without a "direction" attribute.

Userspace may ask to take over a GPIO by writing to a sysfs control file,
helping to cope with incomplete board support or other "one-off"
requirements that don't merit full kernel support:

  echo 23 > /sys/class/gpio/export
	... will gpio_request(23, "sysfs") and gpio_export(23);
	use /sys/class/gpio/gpio-23/direction to (re)configure it,
	when that GPIO can be used as both input and output.
  echo 23 > /sys/class/gpio/unexport
	... will gpio_free(23), when it was exported as above

The extra D-space footprint is a few hundred bytes, except for the sysfs
resources associated with each exported GPIO.  The additional I-space
footprint is about two thirds of the current size of gpiolib (!).  Since
no /dev node creation is involved, no "udev" support is needed.

Related changes:

  * This adds a device pointer to "struct gpio_chip".  When GPIO
    providers initialize that, sysfs gpio class devices become children of
    that device instead of being "virtual" devices.

  * The (few) gpio_chip providers which have such a device node have
    been updated.

  * Some gpio_chip drivers also needed to update their module "owner"
    field ...  for which missing kerneldoc was added.

  * Some gpio_chips don't support input GPIOs.  Those GPIOs are now
    flagged appropriately when the chip is registered.

Based on previous patches, and discussion both on and off LKML.

A Documentation/ABI/testing/sysfs-gpio update is ready to submit once this
merges to mainline.

[akpm@linux-foundation.org: a few maintenance build fixes]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Cc: Greg KH <greg@kroah.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-25 10:53:30 -07:00
..
2008-07-21 21:55:03 -07:00
2008-06-23 13:02:50 -04:00
2008-07-24 10:47:33 -07:00
2008-07-14 14:52:56 -04:00
2008-07-01 11:28:06 +10:00
2008-06-19 10:42:17 +10:00
2008-06-19 10:42:17 +10:00
2008-07-24 10:47:24 -07:00
2008-07-24 10:47:33 -07:00
2008-07-24 10:47:33 -07:00
2008-07-03 13:21:14 +02:00
2008-04-29 08:11:16 -07:00
2008-06-06 11:29:10 -07:00
2008-05-29 01:38:46 -07:00
2008-07-04 10:40:05 -07:00
2008-05-01 08:03:59 -07:00
2008-07-20 17:12:38 -07:00
2008-07-22 17:30:57 -07:00
2008-07-11 10:46:50 +02:00
2008-07-21 12:00:37 +01:00
2008-07-21 12:00:37 +01:00
2008-07-24 10:47:29 -07:00
2008-05-07 09:48:23 +02:00
2008-07-24 10:47:41 -07:00
2008-05-16 17:22:26 -04:00
2008-05-01 13:08:16 -04:00
2008-07-08 17:55:41 +02:00
2008-07-16 23:27:03 +02:00
2008-07-24 10:47:29 -07:00
2008-07-11 15:49:21 +02:00
2008-05-13 08:02:26 -07:00
2008-07-20 17:12:36 -07:00
2008-07-25 10:53:30 -07:00
2008-07-20 17:12:36 -07:00
2008-07-23 15:25:21 +02:00
2008-05-20 16:44:43 +02:00
2008-04-29 08:06:25 -07:00
2008-06-11 21:00:38 -07:00
2008-07-18 18:05:19 -07:00
2008-06-11 21:00:38 -07:00
2008-07-14 22:49:06 -07:00
2008-07-03 17:51:57 +09:00
2008-07-16 18:02:33 -07:00
2008-07-25 10:53:28 -07:00
2008-05-05 16:47:14 +10:00
2008-07-16 23:27:07 +02:00
2008-06-11 21:00:38 -07:00
2008-07-20 17:12:37 -07:00
2008-05-01 08:03:58 -07:00
2008-05-20 12:17:39 -04:00
2008-07-25 10:53:29 -07:00
2008-07-25 10:53:29 -07:00
2008-07-24 10:47:17 -07:00
2008-07-04 10:40:05 -07:00
2008-07-20 12:42:32 +03:00
2008-07-23 09:49:56 +01:00
2008-07-24 10:47:41 -07:00
2008-05-23 22:26:03 +02:00
2008-07-24 10:47:24 -07:00
2008-06-06 11:29:12 -07:00
2008-07-25 10:53:29 -07:00
2008-07-24 10:47:15 -07:00
2008-07-24 11:50:15 -07:00
2008-06-10 14:37:03 -07:00
2008-07-07 16:26:50 -07:00
2008-05-06 12:01:41 -04:00
2008-06-11 21:00:38 -07:00
2008-06-11 21:00:38 -07:00
2008-07-22 14:19:19 -07:00
2008-05-19 16:25:39 +01:00
2008-07-25 10:53:29 -07:00
2008-05-19 10:01:36 +02:00
2008-07-04 10:40:07 -07:00
2008-07-25 10:53:29 -07:00
2008-04-30 08:29:51 -07:00
2008-05-25 07:09:47 +02:00
2008-07-24 10:47:33 -07:00
2008-07-24 10:47:22 -07:00
2008-07-24 08:31:21 -04:00
2008-07-24 10:47:24 -07:00
2008-07-14 22:49:06 -07:00
2008-07-24 10:47:21 -07:00
2008-07-04 10:40:04 -07:00
2008-07-25 10:53:30 -07:00
2008-06-20 14:05:53 -06:00
2008-07-04 11:26:40 +02:00
2008-07-20 17:12:37 -07:00
2008-06-12 14:25:09 -07:00
2008-06-12 10:48:00 +02:00
2008-05-01 08:03:59 -07:00
2008-07-22 13:03:28 -07:00
2008-07-20 17:12:34 -07:00
2008-07-22 13:03:27 -07:00
2008-07-21 15:15:55 -07:00
2008-05-09 07:45:18 -07:00
2008-07-24 10:47:14 -07:00