[v2,0/6] gpio: expose pull-up/pull-down line flags to userspace
mbox series

Message ID 20191012015628.9604-1-warthog618@gmail.com
Headers show
Series
  • gpio: expose pull-up/pull-down line flags to userspace
Related show

Message

Kent Gibson Oct. 12, 2019, 1:56 a.m. UTC
This series adds gross control of pull-up/pull-down to the GPIO uAPI.
Gross control means enabling and disabling of bias functionality,
not finer grained control such as setting biasing impedances.

The support allows both input and output lines to have any one of the
following biases applied as part of the line handle or event request:
 0. As Is - bias is left alone.  This is the default for ABI compatibility.
 1. Pull Up - pull-up bias is enabled.
 2. Pull Down - pull-down bias is enabled.
 3. Pull None - bias is explicitly disabled.

The biases are encoded in two flags, PULL_UP and PULL_DOWN, where
setting both is interpreted as Pull None. So the flags effectively form
a two bit field encoding the values above.

The setting of biases on output lines may seem odd, but is to allow for
utilisation of internal pull-up/pull-down on open drain and open source
outputs, where supported in hardware.

Patches are against v5.4-rc2.

Patch 1 adds support to line handle requests.
Patch 2 adds support to line event requests.
Patch 3 adds pull-up/down support to the gpio-mockup for uAPI testing.
Patch 4 rejects biasing changes to lines requested as-is.
Patch 5 adds support for disabling bias (pull none).
Patch 6 adds support for setting bias on output lines.

Drew Fustini (1):
  gpio: expose pull-up/pull-down line flags to userspace

Kent Gibson (5):
  gpiolib: add support for pull up/down to lineevent_create
  gpio: mockup: add set_config to support pull up/down
  gpiolib: pull requires explicit input mode
  gpiolib: disable bias on inputs when pull up/down are both set
  gpiolib: allow pull up/down on outputs

 drivers/gpio/gpio-mockup.c |  94 +++++++++++++++++++++-------------
 drivers/gpio/gpiolib.c     | 100 +++++++++++++++++++++++++------------
 include/uapi/linux/gpio.h  |   4 ++
 3 files changed, 133 insertions(+), 65 deletions(-)