From: Christian Bruel <christian.bruel@foss.st.com>
To: <linus.walleij@linaro.org>, <corbet@lwn.net>,
<bhelgaas@google.com>, <mani@kernel.org>
Cc: <linux-gpio@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Christian Bruel <christian.bruel@foss.st.com>
Subject: [PATCH v1 2/2] pinctrl: Add pinctrl_pm_select_init_state helper function
Date: Wed, 13 Aug 2025 10:11:39 +0200 [thread overview]
Message-ID: <20250813081139.93201-3-christian.bruel@foss.st.com> (raw)
In-Reply-To: <20250813081139.93201-1-christian.bruel@foss.st.com>
If a platformm requires an initial pinctrl state during probing, this
helper function provides the client with access to the same initial
state.
eg:
xxx_suspend_noirq
...
pinctrl_pm_select_sleep_state
xxx resume_noirq
pinctrl_pm_select_init_state
...
pinctrl_pm_select_default_state
Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
---
drivers/pinctrl/core.c | 13 +++++++++++++
include/linux/pinctrl/consumer.h | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 73b78d6eac67..c5dbf4e9db84 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1655,6 +1655,19 @@ int pinctrl_pm_select_default_state(struct device *dev)
}
EXPORT_SYMBOL_GPL(pinctrl_pm_select_default_state);
+/**
+ * pinctrl_pm_select_init_state() - select init pinctrl state for PM
+ * @dev: device to select init state for
+ */
+int pinctrl_pm_select_init_state(struct device *dev)
+{
+ if (!dev->pins)
+ return 0;
+
+ return pinctrl_select_bound_state(dev, dev->pins->init_state);
+}
+EXPORT_SYMBOL_GPL(pinctrl_pm_select_init_state);
+
/**
* pinctrl_pm_select_sleep_state() - select sleep pinctrl state for PM
* @dev: device to select sleep state for
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 73de70362b98..63ce16191eb9 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -48,6 +48,7 @@ int pinctrl_select_default_state(struct device *dev);
#ifdef CONFIG_PM
int pinctrl_pm_select_default_state(struct device *dev);
+int pinctrl_pm_select_init_state(struct device *dev);
int pinctrl_pm_select_sleep_state(struct device *dev);
int pinctrl_pm_select_idle_state(struct device *dev);
#else
@@ -55,6 +56,10 @@ static inline int pinctrl_pm_select_default_state(struct device *dev)
{
return 0;
}
+static inline int pinctrl_pm_select_init_state(struct device *dev)
+{
+ return 0;
+}
static inline int pinctrl_pm_select_sleep_state(struct device *dev)
{
return 0;
@@ -143,6 +148,11 @@ static inline int pinctrl_pm_select_default_state(struct device *dev)
return 0;
}
+static inline int pinctrl_pm_select_init_state(struct device *dev)
+{
+ return 0;
+}
+
static inline int pinctrl_pm_select_sleep_state(struct device *dev)
{
return 0;
--
2.34.1
next prev parent reply other threads:[~2025-08-13 8:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 8:11 [PATCH v1 0/2] Add pinctrl_pm_select_init_state helper function Christian Bruel
2025-08-13 8:11 ` [PATCH v1 1/2] Documentation: pinctrl: Describe PM helper functions for standard states Christian Bruel
2025-08-18 15:31 ` Linus Walleij
2025-08-13 8:11 ` Christian Bruel [this message]
2025-08-18 15:31 ` [PATCH v1 2/2] pinctrl: Add pinctrl_pm_select_init_state helper function Linus Walleij
2025-08-18 15:32 ` [PATCH v1 0/2] " Linus Walleij
2025-08-18 23:06 ` Bjorn Helgaas
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=20250813081139.93201-3-christian.bruel@foss.st.com \
--to=christian.bruel@foss.st.com \
--cc=bhelgaas@google.com \
--cc=corbet@lwn.net \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mani@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).