Skip to content

pinctrl / 8250_dw: Allow drivers to keep init pinctrl state until first open

Michał Kardaś linux-gpio linux-serial lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2pinctrl: core: Allow drivers to keep "init" pinctrl state after probeDocumentation/driver-api/pin-control.rst drivers/pinctrl/core.c include/linux/pinctrl/consumer.h +1 more+34 -41 reply
2/2tty: serial: 8250_dw: Keep init pinctrl state until first opendrivers/tty/serial/8250/8250_dw.c+12 -12 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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.

While this auto-transition works well for devices that are immediately active upon driver binding, certain peripherals (such as power-sequenced devices connected over UART, SPI, or other buses) remain unpowered until userspace explicitly opens the device node or attaches a protocol driver.

On board designs where the connected peripheral is kept unpowered during boot, auto-selecting "default" pin states (where signals such as TXD or RTS may be driven high or pulled up) can cause parasitic back-powering into the unpowered peripheral through its ESD protection diodes.

To address this without requiring new Device Tree binding names, this series extends the existing "init" pinctrl state mechanism (introduced in commit ef0eebc05130 ("drivers/pinctrl: Add the concept of an "init" 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.

2. Patch 2 (8250_dw serial driver):
Updates 8250_dw so that when an "init" state is defined for the port, the driver calls pinctrl_keep_init_state() and preserves the "init" state until the port is first opened via dw8250_do_pm(), at which point it transitions to "default" state and resumes normal operation.

Testing:
- Built and verified with CONFIG_PINCTRL=y and CONFIG_PINCTRL=n on upstream tree.
- Verified zero checkpatch warnings (checkpatch.pl --strict).
- Note: Functional hardware testing was performed on a downstream kernel tree where the physical back-powering issue was reproduced and verified fixed. The underlying UART pinctrl lifecycle issue and core logic apply identically to upstream.

Michał Kardaś (2):
pinctrl: core: Allow drivers to keep "init" pinctrl state after probe
tty: serial: 8250_dw: Keep init pinctrl state until first open

 Documentation/driver-api/pin-control.rst | 10 ++++++----
 drivers/pinctrl/core.c                   | 20 ++++++++++++++++++++
 drivers/tty/serial/8250/8250_dw.c        | 13 ++++++++++++-
 include/linux/pinctrl/consumer.h         |  6 ++++++
 include/linux/pinctrl/devinfo.h          |  2 ++
 5 files changed, 46 insertions(+), 5 deletions(-)
Signature · 1 line
2.55.0.654.g21b8a5bc05-goog