android_kernel_motorola_sm6225/arch/avr32/mach-at32ap
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
..
at32ap700x.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx 2008-07-23 12:03:18 -07:00
clock.c [AVR32] /sys/kernel/debug/at32ap_clk 2007-10-11 11:38:41 +02:00
clock.h [ARM] 4124/1: Rename mach-at91rm9200 and arch-at91rm9200 directories 2007-02-08 14:50:56 +00:00
cpufreq.c avr32: Fix cpufreq oops when ondemand governor is default 2008-05-27 09:37:42 +02:00
extint.c [AVR32] extint: Set initial irq type to low level 2008-01-25 08:31:44 +01:00
hmatrix.h [AVR32] Add basic HMATRIX support 2007-04-27 12:58:50 +02:00
hsmc.c [AVR32] Turn off debugging in SMC driver 2007-11-15 13:47:19 +01:00
hsmc.h [PATCH] AVR32: Use __raw MMIO access for internal peripherals 2006-10-25 20:26:33 -07:00
intc.c avr32: Power Management support ("standby" and "mem" modes) 2008-07-02 11:05:01 +02:00
intc.h [PATCH] AVR32: Use __raw MMIO access for internal peripherals 2006-10-25 20:26:33 -07:00
Kconfig [AVR32] Add support for AT32AP7001 and AT32AP7002 2008-01-25 08:31:41 +01:00
Makefile avr32: Power Management support ("standby" and "mem" modes) 2008-07-02 11:05:01 +02:00
pdc.c avr32: Rename at32ap.c -> pdc.c 2008-06-28 15:08:48 +02:00
pio.c gpio: sysfs interface 2008-07-25 10:53:30 -07:00
pio.h avr32: Fix typo of IFSR in a comment in the PIO header file 2008-07-04 09:48:05 +02:00
pm-at32ap700x.S avr32: Power Management support ("standby" and "mem" modes) 2008-07-02 11:05:01 +02:00
pm.c avr32: Power Management support ("standby" and "mem" modes) 2008-07-02 11:05:01 +02:00
pm.h [AVR32] Fix a couple of sparse warnings 2007-10-23 11:19:24 +02:00
sdramc.h avr32: Power Management support ("standby" and "mem" modes) 2008-07-02 11:05:01 +02:00