Re: [PATCH v3 1/1] gpiolib: of: add gpio-line node support
From: Linus Walleij
Date: Fri Feb 20 2026 - 15:35:56 EST
On Fri, Feb 20, 2026 at 12:40 PM Bartosz Golaszewski <brgl@xxxxxxxxxx> wrote:
> I'm noting this but I will insist on making it into "default state" -
> state to which we revert when the line is not used: be it initially or
> after a gpiod_put(). And it must not conflict with driver-specific
> behavior so the reverting to default state must happen after
> gpio_chip::free() returns.
I see the point with this, and it is more elegant.
This may be hard for boot loaders to implement, as noted by
Rob: initial states need to be simple for boot loaders.
e.g. when the bootloader gets a GPIO with some "default" state,
then grabs that and toggles it, like Linux it needs to return it
to default state before booting the kernel. That is a tall order
for a boot loader. I think we ought to make the behaviour
simply optional for boot loaders in that case, but that doesn't
feel right either.
The current "set state on init and never change" as noted in some
thread actually has a precedent with a standard binding in
Documentation/devicetree/bindings/gpio/nxp,pcf8575.yaml
line-initial-states.
(Not saying it's a good precedent though.)
> And as an unrelated mental node: there's nothing in gpio-hog binding
> that requires us to use of_ APIs. This should probably be ported to
> fwnode and put into gpiolib.c.
Agreed!
> The legacy GPIO_HOG macro is used in a
> single board file too and should be replaced with a software node once
> the former is done.
Agreed to that too!
Yours,
Linus Walleij