From: Kent Gibson <warthog618@gmail.com>
To: linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com,
linus.walleij@linaro.org, bamv2005@gmail.com
Cc: drew@pdp7.com, Kent Gibson <warthog618@gmail.com>
Subject: [PATCH v4 0/5] gpio: expose line bias flags to userspace
Date: Mon, 28 Oct 2019 15:37:08 +0800 [thread overview]
Message-ID: <20191028073713.25664-1-warthog618@gmail.com> (raw)
The major changes from v3 is the renaming of flags in patch 1, rather
than in later patches, and the addition of sanity checking on bias flag
combinations - only allowing one bias flag to be set at a time.
There are still some deficiencies that I'm uncertain on how to best
resolve:
The setting of bias is performed by gpio_set_bias, which is hooked into
gpiod_direction_input and gpiod_direction_output. It extends the setting
of bias that was already present in gpiod_direction_input.
In keeping with the existing behaviour, the bias is set on a best-effort
basis - no error is returned to the user if an error is returned by the
pinctrl driver. Returning an error makes sense to me, particularly for
the uAPI, but that conflicts with the existing gpiod_direction_input
behaviour. So leave as best-effort, change gpiod_direction_input
behaviour, or restructure to support both behaviours?
Also, the gpio_set_bias is hooked into gpiod_direction_output, which is
fine for the uAPI, but perhaps it should be hooked into
gpiod_direction_output_raw_commit? Or the setting of direction
and bias should be decoupled?
And now the actual blurb...
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. Bias Disable - bias is explicitly disabled.
2. Pull Down - pull-down bias is enabled.
3. Pull Up - pull-up bias is enabled.
The biases are set via three flags, BIAS_DISABLE, BIAS_PULL_DOWN
and BIAS_PULL_UP. These map directly to the similarly named
pinctrl pin_config_param flags.
As Is corresponds to none of the flags being set.
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 Bart's gpio/for-next branch[1].
The patch has been successfully tested against gpio-mockup, and
on a Raspberry Pi, in both cases using the feature/pud branch of my Go
gpiod library[2], as well as with my feature/pud development branch
of libgpiod[3].
Patch 1 adds support to line handle requests.
Patch 2 adds support to line event requests and restricts bias settings
to lines explicitly requested as inputs.
Patch 3 adds pull-up/down support to the gpio-mockup for uAPI testing.
Patch 4 adds support for disabling bias.
Patch 5 adds support for setting bias on output lines.
Drew Fustini (1):
gpio: expose pull-up/pull-down line flags to userspace
Kent Gibson (4):
gpiolib: add support for pull up/down to lineevent_create
gpio: mockup: add set_config to support pull up/down
gpiolib: add support for disabling line bias
gpiolib: add support for biasing output lines
drivers/gpio/gpio-mockup.c | 94 ++++++++++++++++++++++++--------------
drivers/gpio/gpiolib.c | 81 +++++++++++++++++++++++++++++---
drivers/gpio/gpiolib.h | 1 +
include/uapi/linux/gpio.h | 6 +++
4 files changed, 142 insertions(+), 40 deletions(-)
--
2.23.0
[1] git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
[2] https://github.com/warthog618/gpiod.git
[3] https://github.com/warthog618/libgpiod.git
next reply other threads:[~2019-10-28 7:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 7:37 Kent Gibson [this message]
2019-10-28 7:37 ` [PATCH v4 1/5] gpio: expose pull-up/pull-down line flags to userspace Kent Gibson
2019-10-28 7:37 ` [PATCH v4 2/5] gpiolib: add support for pull up/down to lineevent_create Kent Gibson
2019-10-31 7:11 ` Bartosz Golaszewski
2019-10-31 7:24 ` Kent Gibson
2019-10-28 7:37 ` [PATCH v4 3/5] gpio: mockup: add set_config to support pull up/down Kent Gibson
2019-10-28 7:37 ` [PATCH v4 4/5] gpiolib: add support for disabling line bias Kent Gibson
2019-10-28 7:37 ` [PATCH v4 5/5] gpiolib: add support for biasing output lines Kent Gibson
2019-10-31 7:10 ` [PATCH v4 0/5] gpio: expose line bias flags to userspace Bartosz Golaszewski
2019-11-04 0:26 ` Linus Walleij
2019-11-04 1:07 ` Kent Gibson
2019-11-04 10:14 ` Bartosz Golaszewski
2019-11-04 11:11 ` Kent Gibson
2019-11-04 11:48 ` Bartosz Golaszewski
2019-11-04 14:22 ` Kent Gibson
2019-11-04 15:20 ` Bartosz Golaszewski
2019-11-04 15:35 ` Kent Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191028073713.25664-1-warthog618@gmail.com \
--to=warthog618@gmail.com \
--cc=bamv2005@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=drew@pdp7.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).