Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH v1 0/2] pinctrl / 8250_dw: Allow drivers to keep init pinctrl state until first open
@ 2026-08-10 13:06 Michał Kardaś
  2026-08-10 13:06 ` [PATCH v1 1/2] pinctrl: core: Allow drivers to keep "init" pinctrl state after probe Michał Kardaś
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michał Kardaś @ 2026-08-10 13:06 UTC (permalink / raw)
  To: Linus Walleij, Ilpo Järvinen, Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Shevchenko, Douglas Anderson, Vic Huang, linux-gpio,
	linux-serial, linux-kernel, Michał Kardaś

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(-)

-- 
2.55.0.654.g21b8a5bc05-goog


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-11  6:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 13:06 [PATCH v1 0/2] pinctrl / 8250_dw: Allow drivers to keep init pinctrl state until first open Michał Kardaś
2026-08-10 13:06 ` [PATCH v1 1/2] pinctrl: core: Allow drivers to keep "init" pinctrl state after probe Michał Kardaś
2026-08-10 18:12   ` Andy Shevchenko
2026-08-10 13:06 ` [PATCH v1 2/2] tty: serial: 8250_dw: Keep init pinctrl state until first open Michał Kardaś
2026-08-10 18:17   ` Andy Shevchenko
2026-08-11  6:36   ` Linus Walleij
2026-08-11  6:34 ` [PATCH v1 0/2] pinctrl / 8250_dw: Allow drivers to keep " Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox