1. 03 4月, 2009 1 次提交
  2. 30 1月, 2009 1 次提交
  3. 07 1月, 2009 1 次提交
  4. 20 11月, 2008 1 次提交
  5. 20 10月, 2008 2 次提交
  6. 17 10月, 2008 3 次提交
  7. 16 10月, 2008 1 次提交
  8. 26 7月, 2008 1 次提交
    • D
      gpio: sysfs interface · d8f388d8
      David Brownell 提交于
      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: NDavid 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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d8f388d8
  9. 25 5月, 2008 1 次提交
  10. 30 4月, 2008 1 次提交
  11. 28 4月, 2008 4 次提交
  12. 06 2月, 2008 1 次提交
    • D
      gpiolib: add gpio provider infrastructure · d2876d08
      David Brownell 提交于
      Provide new implementation infrastructure that platforms may choose to use
      when implementing the GPIO programming interface.  Platforms can update their
      GPIO support to use this.  In many cases the incremental cost to access a
      non-inlined GPIO should be less than a dozen instructions, with the memory
      cost being about a page (total) of extra data and code.  The upside is:
      
        * Providing two features which were "want to have (but OK to defer)" when
          GPIO interfaces were first discussed in November 2006:
      
          -	A "struct gpio_chip" to plug in GPIOs that aren't directly supported
      	by SOC platforms, but come from FPGAs or other multifunction devices
      	using conventional device registers (like UCB-1x00 or SM501 GPIOs,
      	and southbridges in PCs with more open specs than usual).
      
          -	Full support for message-based GPIO expanders, where registers are
      	accessed through sleeping I/O calls.  Previous support for these
      	"cansleep" calls was just stubs.  (One example: the widely used
      	pcf8574 I2C chips, with 8 GPIOs each.)
      
        * Including a non-stub implementation of the gpio_{request,free}() calls,
          making those calls much more useful.  The diagnostic labels are also
          recorded given DEBUG_FS, so /sys/kernel/debug/gpio can show a snapshot
          of all GPIOs known to this infrastructure.
      
      The driver programming interfaces introduced in 2.6.21 do not change at all;
      this infrastructure is entirely below those covers.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Eric Miao <eric.miao@marvell.com>
      Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
      Cc: Philipp Zabel <philipp.zabel@gmail.com>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Ben Gardner <bgardner@wabtec.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d2876d08