STRUCT PINMUX_OPS(9)
๐ struct pinmux_ops(9) ๐
okay bestie, this page is from the Kernel API Manual, and it's all about struct pinmux_ops โ the pinmux operations struct, to be implemented by pin controller drivers that support pinmuxing โจ no cap.
๐ NAME ๐
struct pinmux_ops โ pinmux operations, to be implemented by pin controller drivers that support pinmuxing ๐
โจ SYNOPSIS โจ
struct pinmux_ops {
int (*request) (struct pinctrl_dev *pctldev, unsigned int offset);
int (*free) (struct pinctrl_dev *pctldev, unsigned int offset);
int (*get_functions_count) (struct pinctrl_dev *pctldev);
const char *(*get_function_name) (struct pinctrl_dev *pctldev,
unsigned int selector);
int (*get_function_groups) (struct pinctrl_dev *pctldev,
unsigned int selector,
const char * const **groups,
unsigned int *num_groups);
bool (*function_is_gpio) (struct pinctrl_dev *pctldev,
unsigned int selector);
int (*set_mux) (struct pinctrl_dev *pctldev,
unsigned int func_selector,
unsigned int group_selector);
void (*release_mux) (struct pinctrl_dev *pctldev,
unsigned int func_selector,
unsigned int group_selector);
int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned int offset);
void (*gpio_disable_free) (struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned int offset);
int (*gpio_set_direction) (struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned int offset,
bool input);
bool strict;
};
๐ Members ๐
requestโ the core calls this to see if a certain pin can be made available for muxing. It's how the core acquires the pins before selecting any actual mux setting across a function. The driver is allowed to answer"no"by returning a negative error code ๐ โโ๏ธfreeโ the reverse function of therequestcallback; it frees a pin after being requested ๐ซถget_functions_countโ returns the number of selectable named functions available in this pinmux driver ๐ขget_function_nameโ returns the function name of the muxing selector. The core calls it to figure out which mux setting it shall map a certain device to ๐ฏget_function_groupsโ returns an array of groups names (in turn referencing pins) connected to a certain function selector. The group name can be used with the genericpinctrl_opsto retrieve the actual pins affected. The applicable groups will be returned ingroups, and the number of groups innum_groups๐งfunction_is_gpioโ determines if the indicated function selector passed corresponds to the GPIO function which is used by the accelerated GPIO functionsgpio_request_enable,gpio_disable_freeandgpio_set_direction. When the pin control core can properly determine if a function is a GPIO function, it is easier to use the strict mode on the pin controller. Since a single function is passed, this is only useful on pin controllers that use a specific function for GPIO, and that usually presupposes that a one-group-per-pin approach is used, so that a single function can be set on a single pin to turn it to GPIO mode ๐set_muxโ enables a certain muxing function with a certain pin group. The driver does not need to figure out whether enabling this function conflicts some other use of the pins in that group; such collisions are handled by the pinmux subsystem. Thefunc_selectorselects a certain function whereasgroup_selectorselects a certain set of pins to be used. On simple controllers the latter argument may be ignored ๐ฅrelease_muxโ releases software resources acquired byset_mux.
๐จ bestie warning: this callback must not change hardware state to avoid glitches when switching mux ๐
gpio_request_enableโ requests and enables GPIO on a certain pin. Implement this only if you can mux every pin individually as GPIO. The affected GPIO range is passed along with anoffset(pin number) into that specific GPIO range โ function selectors and pin groups are orthogonal to this, the core will however make sure the pins do not collide ๐ซถgpio_disable_freeโ free up GPIO muxing on a certain pin; the reverse ofgpio_request_enable๐ธgpio_set_directionโ since controllers may need different configurations depending on whether the GPIO is configured as input or output, a direction selector function may be implemented as a backing to the GPIO controllers that need pin muxing ๐ฎstrictโ do not allow simultaneous use of the same pin for GPIO and another function. Check bothgpio_ownerandmux_ownerstrictly before approving the pin request ๐
๐ SEE ALSO ๐
- Kernel file
./include/linux/pinctrl/pinmux.h๐
that's the whole page, bestie! it comes from ./include/linux/pinctrl, dated October 2026, for struct pinmux_ops(9) โ mwah, slay, periodt ๐
๐
๐ฆ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms