summaryrefslogtreecommitdiffstats
path: root/tools/gpio/gpio-event-mon.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-06-02 11:30:15 +0200
committerLinus Walleij <linus.walleij@linaro.org>2016-06-15 09:29:17 +0200
commit61f922db72216b00386581c851db9c9095961522 (patch)
tree48bad0c179a6565b4cf5f575e78f65371e4957f7 /tools/gpio/gpio-event-mon.c
parent2a144dd09118d9ba8cb57ef65eb573af222c455c (diff)
downloadop-kernel-dev-61f922db72216b00386581c851db9c9095961522.zip
op-kernel-dev-61f922db72216b00386581c851db9c9095961522.tar.gz
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 'tools/gpio/gpio-event-mon.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud