Re: [PATCH v1 0/2] pinctrl / 8250_dw: Allow drivers to keep init pinctrl state until first open

From: Linus Walleij

Date: Tue Aug 11 2026 - 02:39:43 EST


Hi Michal,

thanks for your patches!

On Mon, Aug 10, 2026 at 3:06 PM Michał Kardaś <mkmkl@xxxxxxxxxx> wrote:

> During device probe, pinctrl_bind_pins() binds pins to their "init" state
> if specified in Device Tree. When probe finishes, pinctrl_init_done()
> automatically transitions the pins from "init" to "default" state.
(...)
> 1. Patch 1 (pinctrl core):
> Adds pinctrl_keep_init_state(dev). When called during probe,
> pinctrl_init_done() opts out of the automatic "init" -> "default"
> transition, allowing the driver to keep pins in the safe "init" state
> upon probe completion. Updates Documentation/driver-api/pin-control.rst.
> Board configurations that do not define an "init" state are completely
> unaffected.

I think this is the wrong approach to this problem.

You are changing the transition from "init" to "default" for all devices
on the entire system. What if this is not good for all devices?

I think the right approach is to create a new custom pin control
state for 8250dw, something like "active" or "online", and then
actively retrieve this state when the device goes online.
The "init" state can just be the exact same as "default",
or you can just define "default" to be what "init" is and skip
"init" altogether.

Pin control supports any kind of arbitrarily named custom
states.

In wherever the UART is actually opened:

#include <linux/pinctrl/consumer.h>

probe():
mydev->p = devm_pinctrl_get(dev);
mydev->pins_online_state = = pinctrl_lookup_state(dev->pins->p, "online");

open():
ret = pinctrl_select_state(dev->pins->p, mydev->pins_online_state);

close():
ret = pinctrl_pm_select_default_state(dev);

+ all error handling and stuff, see e.g. drivers/base/pinctrl.c for
good coding practice.

Yours,
Linus Walleij