Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: move strict option to pinmux_ops

While the pinmux_ops are ideally just a vtable for pin mux
calls, the "strict" setting belongs so intuitively with the
pin multiplexing that we should move it here anyway. Putting
it in the top pinctrl_desc makes no sense.

Cc: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+8 -7
+1 -1
Documentation/pinctrl.txt
··· 73 73 .pins = foo_pins, 74 74 .npins = ARRAY_SIZE(foo_pins), 75 75 .owner = THIS_MODULE, 76 - .strict = true, 77 76 }; 78 77 79 78 int __init foo_probe(void) ··· 714 715 .get_function_name = foo_get_fname, 715 716 .get_function_groups = foo_get_groups, 716 717 .set_mux = foo_set_mux, 718 + .strict = true, 717 719 }; 718 720 719 721 /* Pinmux operations are handled by some pin controller */
+1 -1
drivers/pinctrl/pinctrl-adi2.c
··· 703 703 .get_function_name = adi_pinmux_get_func_name, 704 704 .get_function_groups = adi_pinmux_get_groups, 705 705 .gpio_request_enable = adi_pinmux_request_gpio, 706 + .strict = true, 706 707 }; 707 708 708 709 ··· 711 710 .name = DRIVER_NAME, 712 711 .pctlops = &adi_pctrl_ops, 713 712 .pmxops = &adi_pinmux_ops, 714 - .strict = true, 715 713 .owner = THIS_MODULE, 716 714 }; 717 715
+2 -2
drivers/pinctrl/pinmux.c
··· 107 107 desc->name, desc->gpio_owner, owner); 108 108 goto out; 109 109 } 110 - if (pctldev->desc->strict && desc->mux_usecount && 110 + if (ops->strict && desc->mux_usecount && 111 111 strcmp(desc->mux_owner, owner)) { 112 112 dev_err(pctldev->dev, 113 113 "pin %s already requested by %s; cannot claim for %s\n", ··· 123 123 desc->name, desc->mux_owner, owner); 124 124 goto out; 125 125 } 126 - if (pctldev->desc->strict && desc->gpio_owner) { 126 + if (ops->strict && desc->gpio_owner) { 127 127 dev_err(pctldev->dev, 128 128 "pin %s already requested by %s; cannot claim for %s\n", 129 129 desc->name, desc->gpio_owner, owner);
-3
include/linux/pinctrl/pinctrl.h
··· 114 114 * of the pins field above 115 115 * @pctlops: pin control operation vtable, to support global concepts like 116 116 * grouping of pins, this is optional. 117 - * @strict: check both gpio_owner and mux_owner strictly before approving 118 - the pin request 119 117 * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver 120 118 * @confops: pin config operations vtable, if you support pin configuration in 121 119 * your driver ··· 132 134 const struct pinctrl_ops *pctlops; 133 135 const struct pinmux_ops *pmxops; 134 136 const struct pinconf_ops *confops; 135 - bool strict; 136 137 struct module *owner; 137 138 #ifdef CONFIG_GENERIC_PINCONF 138 139 unsigned int num_custom_params;
+4
include/linux/pinctrl/pinmux.h
··· 56 56 * depending on whether the GPIO is configured as input or output, 57 57 * a direction selector function may be implemented as a backing 58 58 * to the GPIO controllers that need pin muxing. 59 + * @strict: do not allow simultaneous use of the same pin for GPIO and another 60 + * function. Check both gpio_owner and mux_owner strictly before approving 61 + * the pin request. 59 62 */ 60 63 struct pinmux_ops { 61 64 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); ··· 82 79 struct pinctrl_gpio_range *range, 83 80 unsigned offset, 84 81 bool input); 82 + bool strict; 85 83 }; 86 84 87 85 #endif /* CONFIG_PINMUX */