diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2016-06-02 11:30:15 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-06-15 09:29:17 +0200 |
commit | 61f922db72216b00386581c851db9c9095961522 (patch) | |
tree | 48bad0c179a6565b4cf5f575e78f65371e4957f7 /drivers/gpio/gpiolib-legacy.c | |
parent | tools/gpio: add the gpio-hammer tool (diff) | |
download | linux-61f922db72216b00386581c851db9c9095961522.tar.xz linux-61f922db72216b00386581c851db9c9095961522.zip |
gpio: userspace ABI for reading GPIO line events
This adds an ABI for listening to events on GPIO lines.
The mechanism returns an anonymous file handle to a request
to listen to a specific offset on a specific gpiochip.
To fetch the stream of events from the file handle, userspace
simply reads an event.
- Events can be requested with the same flags as ordinary
handles, i.e. open drain or open source. An ioctl() call
GPIO_GET_LINEEVENT_IOCTL is issued indicating the desired
line.
- Events can be requested for falling edge events, rising
edge events, or both.
- All events are timestamped using the kernel real time
nanosecond timestamp (the same as is used by IIO).
- The supplied consumer label will appear in "lsgpio"
listings of the lines, and in /proc/interrupts as the
mechanism will request an interrupt from the gpio chip.
- Events are not supported on gpiochips that do not serve
interrupts (no legal .to_irq() call). The event interrupt
is threaded to avoid any realtime problems.
- It is possible to also directly read the current value
of the registered GPIO line by issuing the same
GPIOHANDLE_GET_LINE_VALUES_IOCTL as used by the
line handles. Setting the value is not supported: we
do not listen to events on output lines.
This ABI is strongly influenced by Industrial I/O and surpasses
the old sysfs ABI by providing proper precision timestamps,
making it possible to set flags like open drain, and put
consumer names on the GPIO lines.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-legacy.c')
0 files changed, 0 insertions, 0 deletions