[PATCH v2 09/12] pinctrl: allow to mark pin functions as requestable GPIOs

Heiko Stübner heiko at sntech.de
Mon Jul 14 04:29:01 PDT 2025


Am Mittwoch, 9. Juli 2025, 16:39:05 Mitteleuropäische Sommerzeit schrieb Bartosz Golaszewski:
> From: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>
> 
> 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.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>
> ---

[...]

> diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
> index d6f7b58d6ad0cce421aad80463529c9ccc65d68e..6db6c3e1ccc2249d4b4204e6fc19bf7b4397cc81 100644
> --- a/include/linux/pinctrl/pinmux.h
> +++ b/include/linux/pinctrl/pinmux.h
> @@ -66,6 +66,8 @@ struct pinmux_ops {
>  				    unsigned int selector,
>  				    const char * const **groups,
>  				    unsigned int *num_groups);
> +	bool (*function_is_gpio) (struct pinctrl_dev *pctldev,
> +				  unsigned int selector);

hmm, I think using the set_mux function arguments here might make this
usable by more drivers? Aka func_selector + group_selector ?

While the generic pinmux might not need that, when pinmuxings are
arranged in functions + pingroups in them, this would be helpful.


Heiko






More information about the Linux-mediatek mailing list