diff options
author | Jani Nikula <ext-jani.1.nikula@nokia.com> | 2009-12-15 19:46:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:01 -0500 |
commit | 0769746183caff9d4334be48c7b0e7d2ec8716c4 (patch) | |
tree | e23768be82bd84cf8331709ecc1fd36c3d468f33 /Documentation/gpio.txt | |
parent | 35570ac6039ef490b9c5abde1fee4803a39bf4e1 (diff) |
gpiolib: add support for changing value polarity in sysfs
Drivers may use gpiolib sysfs as part of their public user space
interface. The GPIO number and polarity might change from board to
board. The gpio_export_link() call can be used to hide the GPIO number
from user space. Add support for also hiding the GPIO line polarity
changes from user space.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r-- | Documentation/gpio.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index e4e7daed2ba8..1866c27eec69 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -531,6 +531,13 @@ and have the following read/write attributes: | |||
531 | This file exists only if the pin can be configured as an | 531 | This file exists only if the pin can be configured as an |
532 | interrupt generating input pin. | 532 | interrupt generating input pin. |
533 | 533 | ||
534 | "active_low" ... reads as either 0 (false) or 1 (true). Write | ||
535 | any nonzero value to invert the value attribute both | ||
536 | for reading and writing. Existing and subsequent | ||
537 | poll(2) support configuration via the edge attribute | ||
538 | for "rising" and "falling" edges will follow this | ||
539 | setting. | ||
540 | |||
534 | GPIO controllers have paths like /sys/class/gpio/gpiochip42/ (for the | 541 | GPIO controllers have paths like /sys/class/gpio/gpiochip42/ (for the |
535 | controller implementing GPIOs starting at #42) and have the following | 542 | controller implementing GPIOs starting at #42) and have the following |
536 | read-only attributes: | 543 | read-only attributes: |
@@ -566,6 +573,8 @@ requested using gpio_request(): | |||
566 | int gpio_export_link(struct device *dev, const char *name, | 573 | int gpio_export_link(struct device *dev, const char *name, |
567 | unsigned gpio) | 574 | unsigned gpio) |
568 | 575 | ||
576 | /* change the polarity of a GPIO node in sysfs */ | ||
577 | int gpio_sysfs_set_active_low(unsigned gpio, int value); | ||
569 | 578 | ||
570 | After a kernel driver requests a GPIO, it may only be made available in | 579 | After a kernel driver requests a GPIO, it may only be made available in |
571 | the sysfs interface by gpio_export(). The driver can control whether the | 580 | the sysfs interface by gpio_export(). The driver can control whether the |
@@ -580,3 +589,9 @@ After the GPIO has been exported, gpio_export_link() allows creating | |||
580 | symlinks from elsewhere in sysfs to the GPIO sysfs node. Drivers can | 589 | symlinks from elsewhere in sysfs to the GPIO sysfs node. Drivers can |
581 | use this to provide the interface under their own device in sysfs with | 590 | use this to provide the interface under their own device in sysfs with |
582 | a descriptive name. | 591 | a descriptive name. |
592 | |||
593 | Drivers can use gpio_sysfs_set_active_low() to hide GPIO line polarity | ||
594 | differences between boards from user space. This only affects the | ||
595 | sysfs interface. Polarity change can be done both before and after | ||
596 | gpio_export(), and previously enabled poll(2) support for either | ||
597 | rising or falling edge will be reconfigured to follow this setting. | ||