From: Linus Walleij <linusw@kernel.org>
To: Sven Peter <sven@kernel.org>, Janne Grunau <j@jannau.net>,
Neal Gompa <neal@gompa.dev>,
Bartosz Golaszewski <brgl@kernel.org>
Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-gpio@vger.kernel.org, Linus Walleij <linusw@kernel.org>
Subject: [PATCH 2/2] RFC: pinctrl: apple: Implement GPIO func check callback
Date: Sun, 11 Jan 2026 21:29:22 +0100 [thread overview]
Message-ID: <20260111-apple-req-gpio-func-v1-2-6deb1b695371@kernel.org> (raw)
In-Reply-To: <20260111-apple-req-gpio-func-v1-0-6deb1b695371@kernel.org>
This function will check if the indicated function enumerator
i.e. the value set into bits 5 and 6 of the pin configuration
register, is zero and thus corresponds to the GPIO mode of the
pin.
This may be necessary to know since the pin controller is
flagged as "strict": once you set a pin *explicitly* to GPIO
mode using function 0, the core is unaware that this is
actually the GPIO mode, and clients may be denied to
retrieve the pin as a GPIO.
Currently none of the in-kernel device trees sets any pin to
GPIO mode, but this may happen any day.
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
drivers/pinctrl/pinctrl-apple-gpio.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c
index a4161d59ab9f..fd20d0e49f48 100644
--- a/drivers/pinctrl/pinctrl-apple-gpio.c
+++ b/drivers/pinctrl/pinctrl-apple-gpio.c
@@ -170,6 +170,13 @@ static const struct pinctrl_ops apple_gpio_pinctrl_ops = {
/* Pin multiplexer functions */
+static int apple_gpio_pinmux_func_is_gpio(struct pinctrl_dev *pctldev,
+ unsigned int selector)
+{
+ /* Function selector 0 is always the GPIO mode */
+ return (selector == 0);
+}
+
static int apple_gpio_pinmux_set(struct pinctrl_dev *pctldev, unsigned int func,
unsigned int group)
{
@@ -186,6 +193,7 @@ static const struct pinmux_ops apple_gpio_pinmux_ops = {
.get_functions_count = pinmux_generic_get_function_count,
.get_function_name = pinmux_generic_get_function_name,
.get_function_groups = pinmux_generic_get_function_groups,
+ .function_is_gpio = apple_gpio_pinmux_func_is_gpio,
.set_mux = apple_gpio_pinmux_set,
.strict = true,
};
--
2.52.0
next prev parent reply other threads:[~2026-01-11 20:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-11 20:29 [PATCH 0/2] pinctrl: apple: Fixup and RFC GPIO mode patch Linus Walleij
2026-01-11 20:29 ` [PATCH 1/2] pinctrl: apple: Use unsigned int instead of unsigned Linus Walleij
2026-01-11 22:17 ` Sven Peter
2026-01-11 20:29 ` Linus Walleij [this message]
2026-01-11 22:25 ` [PATCH 2/2] RFC: pinctrl: apple: Implement GPIO func check callback Sven Peter
2026-01-12 9:42 ` [PATCH 0/2] pinctrl: apple: Fixup and RFC GPIO mode patch Bartosz Golaszewski
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=20260111-apple-req-gpio-func-v1-2-6deb1b695371@kernel.org \
--to=linusw@kernel.org \
--cc=asahi@lists.linux.dev \
--cc=brgl@kernel.org \
--cc=j@jannau.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=neal@gompa.dev \
--cc=sven@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