linux/arch/arm/plat-omap
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
..
clock.c ARM: OMAP: CLKFW: Initial debugfs support for omap clock framework 2008-07-03 12:24:41 +03:00
common.c ARM: OMAP: Introduce omap_globals and prcm access functions for multi-omap 2008-07-03 12:24:44 +03:00
cpu-omap.c ARM: OMAP: Fix sleep under spinlock for cpufreq 2008-03-05 10:23:19 +02:00
debug-devices.c [NET] smc91x: Make smc91x use IRQ resource trigger flags 2008-01-28 13:13:19 +00:00
debug-leds.c ARM: OMAP: partial LED fixes 2007-05-09 10:39:42 +01:00
devices.c ARM: OMAP: McBSP: Prepare for splitting into omap1 and omap2 code 2008-07-03 12:24:39 +03:00
dma.c ARM: OMAP: DMA: Clean-up code 2008-07-03 12:24:37 +03:00
dmtimer.c ARM: OMAP: DMTimer: Optimize by adding load and start 2008-07-03 12:24:30 +03:00
fb.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
gpio.c gpio: sysfs interface 2008-07-25 10:53:30 -07:00
i2c.c ARM: OMAP: Add helper module for board specific I2C bus registration 2008-02-08 10:38:00 -08:00
Kconfig ARM: OMAP: Fix clockevent support for hrtimers 2008-03-20 16:56:09 +02:00
mailbox.c arm: bus_id -> dev_name() and dev_set_name() conversions 2008-07-21 21:55:03 -07:00
mailbox.h ARM: OMAP: Add mailbox support for IVA 2007-05-09 10:37:10 +01:00
Makefile ARM: OMAP: SRAM: Move sram-fn.S from plat-omap to mach-omap1 2008-07-03 12:24:38 +03:00
mcbsp.c ARM: OMAP: McBSP: Prepare for splitting into omap1 and omap2 code 2008-07-03 12:24:39 +03:00
mux.c ARM: OMAP2: Clean-up mux code 2008-04-14 09:57:13 -07:00
ocpi.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sram.c ARM: OMAP: SRAM: Split sram24xx.S into sram242x.S and sram243x.S 2008-07-03 12:24:38 +03:00
usb.c ARM: OMAP: USB: Change omap USB code to use omap_read/write instead of __REG 2008-07-03 12:24:43 +03:00