kernel-ark/arch/arm
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
..
boot inflate: refactor inflate malloc code 2008-07-25 10:53:28 -07:00
common Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-07-23 18:24:08 -07:00
configs [ARM] Merge most of the PXA work for initial merge 2008-07-14 23:34:46 +01:00
kernel kprobes: improve kretprobe scalability with hashed locking 2008-07-25 10:53:30 -07:00
lib [ARM] cache align memset and memzero 2008-06-22 22:44:39 +02:00
mach-aaec2000
mach-at91 Merge branches 'at91', 'dyntick', 'ep93xx', 'iop', 'ixp', 'misc', 'orion', 'omap-reviewed', 'rpc', 'rtc' and 's3c' into devel 2008-07-10 16:38:50 +01:00
mach-clps711x
mach-clps7500
mach-davinci arm: use non-racy method for /proc/davinci_clocks creation 2008-04-29 08:06:21 -07:00
mach-ebsa110
mach-ep93xx [ARM] 5171/1: ep93xx: fix compilation of modules using clocks 2008-07-10 14:50:21 +01:00
mach-footbridge [ARM] 5015/1: arm: remove ARCH_CO285 2008-05-02 23:44:57 +01:00
mach-h720x
mach-imx Merge branch 'imx' into devel 2008-07-10 16:41:50 +01:00
mach-integrator arm: bus_id -> dev_name() and dev_set_name() conversions 2008-07-21 21:55:03 -07:00
mach-iop13xx
mach-iop32x leds: Add pca9532 platform data for Thecus N2100 2008-07-23 09:49:56 +01:00
mach-iop33x
mach-ixp4xx [ARM] Merge most of the PXA work for initial merge 2008-07-14 23:34:46 +01:00
mach-ixp23xx
mach-ixp2000
mach-kirkwood [ARM] Kirkwood: use chip_delay 2008-06-30 16:04:46 -04:00
mach-ks8695
mach-l7200
mach-lh7a40x
mach-loki [ARM] add Marvell Loki (88RC8480) SoC support 2008-06-22 22:45:02 +02:00
mach-msm
mach-mv78xx0 [ARM] add Marvell 78xx0 ARM SoC support 2008-06-22 22:45:10 +02:00
mach-mx2 i.MX27 family: Add the Phytec PCM970 evaluation board 2008-07-05 10:03:01 +02:00
mach-mx3 MX3: Adapt mx31lite to new timer init style 2008-07-05 10:02:53 +02:00
mach-netx
mach-ns9xxx Remove use of asm/semaphore.h 2008-07-24 08:31:00 -04:00
mach-omap1 Merge branches 'at91', 'dyntick', 'ep93xx', 'iop', 'ixp', 'misc', 'orion', 'omap-reviewed', 'rpc', 'rtc' and 's3c' into devel 2008-07-10 16:38:50 +01:00
mach-omap2 Merge branches 'at91', 'dyntick', 'ep93xx', 'iop', 'ixp', 'misc', 'orion', 'omap-reviewed', 'rpc', 'rtc' and 's3c' into devel 2008-07-10 16:38:50 +01:00
mach-orion5x [ARM] Orion: LED support for HP mv2120 2008-07-07 18:38:24 -04:00
mach-pnx4008
mach-pxa [ARM] Merge most of the PXA work for initial merge 2008-07-14 23:34:46 +01:00
mach-realview [ARM] 5121/1: Annotate platform_secondary_init with trace_hardirqs_off 2008-07-03 16:39:56 +01:00
mach-rpc
mach-s3c2400
mach-s3c2410 [ARM] Acer n30: Minor style and indentation fixes. 2008-07-07 18:13:05 +01:00
mach-s3c2412 [ARM] S3C2412: Correct parents for EREFCLK and UREFCLK 2008-07-03 16:51:30 +01:00
mach-s3c2440 [ARM] AT2440EVB: Add DM9000A network controller support. 2008-07-07 18:13:01 +01:00
mach-s3c2442
mach-s3c2443 [ARM] S3C2443: Add prediv clk and fix setting of h and p clocks 2008-07-07 18:13:02 +01:00
mach-sa1100 Merge branches 'pxa-ian' and 'pxa-xm270' into pxa 2008-07-12 21:42:04 +01:00
mach-shark
mach-versatile
mm mm: drop unneeded pgdat argument from free_area_init_node() 2008-07-24 10:47:16 -07:00
nwfpe
oprofile smp_call_function: get rid of the unused nonatomic/retry argument 2008-06-26 11:24:35 +02:00
plat-iop [ARM] 5160/1: IOP3XX: gpio/gpiolib support 2008-07-09 23:31:42 +01:00
plat-mxc i.MX2 family: Add basic mach support 2008-07-05 10:03:02 +02:00
plat-omap gpio: sysfs interface 2008-07-25 10:53:30 -07:00
plat-orion [ARM] Orion: PCIe x4/x1 detection support 2008-06-22 22:45:09 +02:00
plat-s3c
plat-s3c24xx [ARM] S3C24XX: PWM API support. 2008-07-03 16:51:30 +01:00
tools [ARM] Update mach-types 2008-07-13 12:05:21 +01:00
vfp smp_call_function: get rid of the unused nonatomic/retry argument 2008-06-26 11:24:35 +02:00
Kconfig add HAVE_CLK to Kconfig, for driver dependencies 2008-07-24 10:47:13 -07:00
Kconfig-nommu
Kconfig.debug
Makefile Merge branch 'imx' into devel 2008-07-10 16:41:50 +01:00