* [PATCH v2] pinctrl: sunxi: Implement function_is_gpio
@ 2026-12-05 11:46 Chen-Yu Tsai
0 siblings, 0 replies; only message in thread
From: Chen-Yu Tsai @ 2026-12-05 11:46 UTC (permalink / raw)
To: Linus Walleij
Cc: Paul Kocialkowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
linux-sunxi, linux-arm-kernel, linux-gpio, Andre Przywara
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-05 11:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 11:46 [PATCH v2] pinctrl: sunxi: Implement function_is_gpio Chen-Yu Tsai
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.