pinctrl: allow to mark pin functions as requestable GPIOs
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 2 Sep 2025 11:59:22 +0000 (13:59 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 8 Sep 2025 12:22:58 +0000 (14:22 +0200)
commit11aa02d6a9c222260490f952d041dec6d7f16a92
treec7d4dec9bab2ae6951c548660899e816ea1d29ff
parent6f6835beab99c770f1cc6de99b3e3b73c333dec7
pinctrl: allow to mark pin functions as requestable GPIOs

The name of the pin function has no real meaning to pinctrl core and is
there only for human readability of device properties. Some pins are
muxed as GPIOs but for "strict" pinmuxers it's impossible to request
them as GPIOs if they're bound to a devide - even if their function name
explicitly says "gpio". Add a new field to struct pinfunction that
allows to pass additional flags to pinctrl core. While we could go with
a boolean "is_gpio" field, a flags field is more future-proof.

If the PINFUNCTION_FLAG_GPIO is set for a given function, the pin muxed
to it can be requested as GPIO even on strict pin controllers. Add a new
callback to struct pinmux_ops - function_is_gpio() - that allows pinmux
core to inspect a function and see if it's a GPIO one. Provide a generic
implementation of this callback.

Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinmux.c
drivers/pinctrl/pinmux.h
include/linux/pinctrl/pinctrl.h
include/linux/pinctrl/pinmux.h