summaryrefslogtreecommitdiffstats
path: root/Documentation/gpio.txt
diff options
context:
space:
mode:
authorBernhard Walle <walle@corscience.de>2010-11-18 12:27:33 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2010-11-18 15:00:46 -0800
commitebde7b062cd9e2ea968c93f23f73dd28c0a192d1 (patch)
tree143d247e7d9c3e505961d769494bd267c14c5078 /Documentation/gpio.txt
parent09c9feb94672bdb3ca6d424a292ffc26eff8ca0b (diff)
downloadlinux-ebde7b062cd9e2ea968c93f23f73dd28c0a192d1.tar.gz
linux-ebde7b062cd9e2ea968c93f23f73dd28c0a192d1.tar.bz2
linux-ebde7b062cd9e2ea968c93f23f73dd28c0a192d1.zip
Documentation/gpio.txt: explain poll/select usage
Add a bit more information how to use poll(2) on GPIO value files correctly. For me it was not clear that I need to poll(2) for POLLPRI|POLLERR or select(2) for exceptfds. Signed-off-by: Bernhard Walle <walle@corscience.de> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/gpio.txt')
-rw-r--r--Documentation/gpio.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index 9633da01ff46..792faa3c06cf 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -617,6 +617,16 @@ and have the following read/write attributes:
is configured as an output, this value may be written;
any nonzero value is treated as high.
+ If the pin can be configured as interrupt-generating interrupt
+ and if it has been configured to generate interrupts (see the
+ description of "edge"), you can poll(2) on that file and
+ poll(2) will return whenever the interrupt was triggered. If
+ you use poll(2), set the events POLLPRI and POLLERR. If you
+ use select(2), set the file descriptor in exceptfds. After
+ poll(2) returns, either lseek(2) to the beginning of the sysfs
+ file and read the new value or close the file and re-open it
+ to read the value.
+
"edge" ... reads as either "none", "rising", "falling", or
"both". Write these strings to select the signal edge(s)
that will make poll(2) on the "value" file return.