linux-kernel-test/include/asm-generic
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
..
bitops bitops: use __fls for fls64 on 64-bit archs 2008-04-26 19:21:16 +02:00
4level-fixup.h add mm argument to pte/pmd/pud/pgd_free 2008-02-05 09:44:18 -08:00
atomic.h Christoph has moved 2008-07-04 10:40:04 -07:00
audit_change_attr.h [PATCH] fix missing ifdefs in syscall classes hookup for generic targets 2006-09-22 17:48:56 -07:00
audit_dir_write.h [PATCH] fix missing ifdefs in syscall classes hookup for generic targets 2006-09-22 17:48:56 -07:00
audit_read.h [PATCH] audit: more syscall classes added 2006-09-11 13:32:27 -04:00
audit_signal.h [PATCH] add SIGNAL syscall class (v3) 2007-05-11 05:38:25 -04:00
audit_write.h [PATCH] audit: more syscall classes added 2006-09-11 13:32:27 -04:00
bitops.h remove __KERNEL__ tests of unexported headers under asm-generic/ 2008-04-30 08:29:54 -07:00
bug.h printk ratelimiting rewrite 2008-07-25 10:53:29 -07:00
cmpxchg-local.h Add cmpxchg_local to asm-generic for per cpu atomic operations 2008-02-07 08:42:30 -08:00
cmpxchg.h Add cmpxchg_local to asm-generic for per cpu atomic operations 2008-02-07 08:42:30 -08:00
cputime.h taskstats scaled time cleanup 2008-02-06 10:41:00 -08:00
device.h Driver core: add dev_archdata to struct device 2006-12-01 14:52:01 -08:00
div64.h rename div64_64 to div64_u64 2008-05-01 08:03:58 -07:00
dma-mapping-broken.h dma-mapping: prevent dma dependent code from linking on !HAS_DMA archs 2007-07-16 09:05:45 -07:00
dma-mapping.h [PATCH] Pass struct dev pointer to dma_cache_sync() 2006-12-07 08:39:41 -08:00
emergency-restart.h
errno-base.h
errno.h
fcntl.h Introduce O_CLOEXEC 2007-07-16 09:05:45 -07:00
futex.h remove __KERNEL__ tests of unexported headers under asm-generic/ 2008-04-30 08:29:54 -07:00
gpio.h gpio: sysfs interface 2008-07-25 10:53:30 -07:00
ide_iops.h
int-l64.h types: add C99-style constructors to <asm-generic/int-*.h> 2008-05-02 16:18:42 -07:00
int-ll64.h asm-generic/int-ll64.h: always provide __{s,u}64 2008-07-25 10:53:27 -07:00
ioctl.h generalize asm-generic/ioctl.h to allow overriding values 2008-04-29 08:06:24 -07:00
iomap.h generic: add ioremap_wc() interface wrapper 2008-04-24 23:40:47 +02:00
irq_regs.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
Kbuild types: create <asm-generic/int-*.h> 2008-05-02 16:18:19 -07:00
Kbuild.asm kbuild: fix a.out.h export to userspace with O= build. 2008-06-27 23:13:54 +02:00
kdebug.h move die notifier handling to common code 2007-05-08 11:15:04 -07:00
libata-portmap.h libata-portmap: Remove unused definitions 2007-10-12 14:55:37 -04:00
local.h local_t: architecture independent extension 2007-05-08 11:15:20 -07:00
memory_model.h remove __KERNEL__ tests of unexported headers under asm-generic/ 2008-04-30 08:29:54 -07:00
mm_hooks.h [PATCH] x86: PARAVIRT: add hooks to intercept mm creation and destruction 2007-05-02 19:27:14 +02:00
mman.h [PATCH] Remove final references to deprecated "MAP_ANON" page protection flag 2007-02-11 10:51:17 -08:00
mutex-dec.h asm-generic: remove fastcall 2008-02-08 09:22:31 -08:00
mutex-null.h fix file specification in comments 2006-10-03 23:01:26 +02:00
mutex-xchg.h asm-generic: remove fastcall 2008-02-08 09:22:31 -08:00
page.h remove __KERNEL__ tests of unexported headers under asm-generic/ 2008-04-30 08:29:54 -07:00
pci-dma-compat.h
pci.h [PATCH] Make sparc64 use setup-res.c 2005-09-08 14:57:25 -07:00
percpu.h percpu: fix DEBUG_PREEMPT per_cpu checking 2008-02-23 12:09:28 -08:00
pgtable-nopmd.h add mm argument to pte/pmd/pud/pgd_free 2008-02-05 09:44:18 -08:00
pgtable-nopud.h add mm argument to pte/pmd/pud/pgd_free 2008-02-05 09:44:18 -08:00
pgtable.h mm: fix build on non-mmu machines 2008-07-15 13:58:40 -07:00
poll.h Consolidate asm/poll.h 2007-05-11 08:29:34 -07:00
resource.h sched: SCHED_FIFO/SCHED_RR watchdog timer 2008-01-25 21:08:27 +01:00
rtc.h remove __KERNEL__ tests of unexported headers under asm-generic/ 2008-04-30 08:29:54 -07:00
sections.h remove support for un-needed _extratext section 2008-02-06 10:41:01 -08:00
siginfo.h
signal.h Add standard include guard to asm-generic/signal and use compiler.h 2006-04-27 06:57:23 +01:00
statfs.h
termios.h tty: let architectures override the user/kernel macros. 2008-02-08 09:22:24 -08:00
tlb.h asm-generic/tlb.h: remove <linux/quicklist.h> 2008-02-04 16:48:00 +01:00
topology.h x86: change _node_to_cpumask_ptr to return const ptr 2008-07-13 19:11:58 +02:00
uaccess.h
vmlinux.lds.h Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2008-07-16 17:25:46 -07:00
xor.h