Re: [PATCH v3 1/1] gpiolib: of: add gpio-line node support

From: Bartosz Golaszewski

Date: Fri Feb 20 2026 - 06:40:45 EST


On Thu, Feb 19, 2026 at 6:44 PM Linus Walleij <linusw@xxxxxxxxxx> wrote:
>
> On Mon, Feb 16, 2026 at 10:10 PM James Hilliard
> <james.hilliard1@xxxxxxxxx> wrote:
>
> > Allow GPIO controller child nodes marked with "gpio-line" to apply
> > probe-time direction/flags without hogging the line.
> >
> > Extend OF gpiochip scanning and OF dynamic reconfiguration handling to
> > process gpio-line nodes alongside gpio-hog nodes.
> >
> > Some boards need probe-time GPIO direction/value setup while still
> > leaving lines available for later userspace or driver requests. GPIO
> > hogs can initialize lines but reserve them permanently.
> >
> > Add gpiod_apply_line_init() as a core helper for one-shot line
> > initialization and use it for gpio-line setup.
> >
> > Because gpio-line initialization does not reserve ownership, subsequent
> > consumer requests remain normal requests and may reconfigure or release
> > the line as usual.
> >
> > Support "gpio-line-name" for setting the visible line name. For
> > gpio-hog nodes, keep "line-name" semantics as the hog consumer label.
> >
> > Some boards only need to name a small subset of GPIO lines. Doing this
> > generally requires defining a full gpio-line-names array with empty
> > placeholders for unrelated lines.
> >
> > In overlays, gpio-line-names replacement is all-or-nothing. Names from
> > base DT and multiple overlays for the same gpiochip do not compose,
> > because each update replaces the full property.
> >
> > Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>
>
> I like this looks of this, there might be some minor code duplication
> with hogs, but the core idea is sane and very similar to what has been
> discussed in the past.
>
> It's minimalist, it's elegant, it does the job.
>
> If for nothing else, so for the sake of making the previous attempts
> count for something, and because I personally align with this idea,
> and because at least three (3!) attempts in the past by different
> people for the same idea:
> Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
>
> ... and if we apply the patch in the end I would have their names
> added to the commit as Co-developed-by:
>
> > Depends on:
> > - https://github.com/devicetree-org/dt-schema/pull/185
>
> That's the real trick isn't it?
> FWIW I approved it.
>

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.

And of course we need a DT binding.

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. 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.

Bartosz