We are currently experiencing downtime impacting viewing & cloning the Mesa repo, and some GitLab pages returning 503. Please see #freedesktop on IRC for more updates.

  • Linus Walleij's avatar
    gpio: userspace ABI for reading GPIO line events · 61f922db
    Linus Walleij authored
    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
    - 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
      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's avatarLinus Walleij <linus.walleij@linaro.org>
gpiolib.c 94.3 KB