Thread (41 messages) 41 messages, 8 authors, 2022-07-19

Re: [PATCH 1/4] gpiolib: add support for bias pull disable

From: Linus Walleij <hidden>
Date: 2022-07-18 10:44:48
Also in: linux-acpi, linux-gpio

On Wed, Jul 13, 2022 at 7:37 PM Andy Shevchenko
[off-list ref] wrote:
On Wed, Jul 13, 2022 at 03:14:18PM +0200, Nuno Sá wrote:
quoted
This change prepares the gpio core to look at firmware flags and set
'FLAG_BIAS_DISABLE' if necessary. It works in similar way to
'GPIO_PULL_DOWN' and 'GPIO_PULL_UP'.
...
quoted
      GPIO_PULL_UP                    = (1 << 4),
      GPIO_PULL_DOWN                  = (1 << 5),
+     GPIO_PULL_DISABLE               = (1 << 6),
To me it seems superfluous. You have already two flags:
PUp
PDown
When none is set --> Pdisable
What happens in the pin control case for some drivers at least is that
the machine
comes up with some pull up/downs enabled (by power-on default or from
the boot loader), and some systems need to explicitly disable these
pulls.

In these (device tree) cases they set bias-disable; in the device tree, and
the driver will actively disable any pull up/down.

OK this is maybe not the most elegant system engineering. But some of
those users are hobbyists and cannot affect what the ASIC or firmware
is doing, because vendors are not really listening.

Another semantic reason is that pins can also be set to bias-high-impedance;
which is what "some people" would assume is the default if you disable
both pull up and pull down. (Yeah ... semantics...)

Device tree also has bias-pull-pin-default; to make things more complicated.
This should *really* leave it at power-on default. Explicitly.

I think for Nuno's usecase (using a random pin from userspace) the state
of biasing cannot be assumed, the driver will not change bias to
disabled just because neither pull up or down is specified, so the driver
needs an explicit kick saying "disable any bias".

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help