From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Michał Kardaś" <mkmkl@google.com>
Cc: "Linus Walleij" <linusw@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Douglas Anderson" <dianders@chromium.org>,
"Vic Huang" <vich@google.com>,
linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] pinctrl: core: Allow drivers to keep "init" pinctrl state after probe
Date: Mon, 10 Aug 2026 21:12:36 +0300 [thread overview]
Message-ID: <anoUlD3ep6t0WkHw@ashevche-desk.local> (raw)
In-Reply-To: <20260810130635.1166626-2-mkmkl@google.com>
On Mon, Aug 10, 2026 at 01:06:34PM +0000, Michał Kardaś 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.
>
> 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" or "sleep" 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.
>
> Allow drivers to explicitly opt out of the automatic "init" -> "default"
> transition by calling pinctrl_keep_init_state(dev) during probe. When this
> helper is called, pinctrl_init_done() leaves the pins in their "init"
> state upon probe completion. The driver can then transition to the
> "default" state when the device is first opened by calling
> pinctrl_pm_select_default_state(dev).
...
> +/**
> + * pinctrl_keep_init_state() - mark pinctrl handle to stay in init state after probe
> + * @dev: device to keep init state for
> + *
> + * Return: true if the device has a valid init state and keep_init flag was set,
> + * false otherwise.
> + */
> +bool pinctrl_keep_init_state(struct device *dev)
> +{
> + if (!dev->pins || IS_ERR(dev->pins->init_state))
> + return false;
The above keeps_init in the initial state which may or may not be wrong.
I would avoid the ambiguity by rewriting this as
> + dev->pins->keep_init = true;
> + return true;
dev->pins->keep_init = dev->pins && !IS_ERR(dev->pins->init_state);
return dev->pins->keep_init;
But please, check if that is what you want.
> +}
...
> + bool keep_init:1;
What is ':1' supposed to mean (for boolean)? I understand that for say
unsigned int.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-10 18:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
2026-08-11 17:00 ` Doug Anderson
2026-08-11 18:47 ` Linus Walleij
2026-08-11 20:15 ` Doug Anderson
2026-08-12 1:26 ` Doug Anderson
2026-08-12 7:00 ` Andy Shevchenko
2026-08-12 6:51 ` Andy Shevchenko
2026-08-12 7:46 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anoUlD3ep6t0WkHw@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mkmkl@google.com \
--cc=vich@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox