From: Chen-Yu Tsai <wens@kernel.org>
To: Linus Walleij <linusw@kernel.org>
Cc: Paul Kocialkowski <paulk@sys-base.io>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej@kernel.org>,
Samuel Holland <samuel@sholland.org>,
linux-sunxi@lists.linux.dev,
linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
Andre Przywara <andre.przywara@arm.com>
Subject: [PATCH v2] pinctrl: sunxi: Implement function_is_gpio
Date: Sat, 5 Dec 2026 19:46:58 +0800 [thread overview]
Message-ID: <20261205114659.1111076-1-wens@kernel.org> (raw)
From: Paul Kocialkowski <paulk@sys-base.io>
The function_is_gpio pinmux op allows the core to find out whether a
GPIO can be safely requested from a pinctrl property and requested as a
GPIO at the same time.
This is especially useful to request a GPIO with a particular drive
strength, which would otherwise not be possible on strict sunxi pin
controllers.
Match the "gpio_in" and "gpio_out" function names explicitly.
Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
[wens@kernel.org: Match explicit function names]
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
---
Changes since v1:
- Match explicit function names
- Link to v1:
https://lore.kernel.org/r/20260517171405.3697469-1-paulk@sys-base.io
---
drivers/pinctrl/sunxi/pinctrl-sunxi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index bf4ec4665e2b..4c37769d4226 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -828,6 +828,15 @@ static int sunxi_pmx_get_func_groups(struct pinctrl_dev *pctldev,
return 0;
}
+static bool sunxi_pmx_function_is_gpio(struct pinctrl_dev *pctldev,
+ unsigned int function)
+{
+ struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
+ const char *name = pctl->functions[function].name;
+
+ return !strcmp(name, "gpio_in") || !strcmp(name, "gpio_out");
+}
+
static void sunxi_pmx_set(struct pinctrl_dev *pctldev,
unsigned pin,
u8 config)
@@ -974,6 +983,7 @@ static const struct pinmux_ops sunxi_pmx_ops = {
.get_functions_count = sunxi_pmx_get_funcs_cnt,
.get_function_name = sunxi_pmx_get_func_name,
.get_function_groups = sunxi_pmx_get_func_groups,
+ .function_is_gpio = sunxi_pmx_function_is_gpio,
.set_mux = sunxi_pmx_set_mux,
.gpio_set_direction = sunxi_pmx_gpio_set_direction,
.request = sunxi_pmx_request,
--
2.53.0
reply other threads:[~2026-12-05 11:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261205114659.1111076-1-wens@kernel.org \
--to=wens@kernel.org \
--cc=andre.przywara@arm.com \
--cc=jernej@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=paulk@sys-base.io \
--cc=samuel@sholland.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.