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

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: apple: Implement GPIO func check callback

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.

Reviewed-by: Sven Peter <sven@kernel.org>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>

+8
+8
drivers/pinctrl/pinctrl-apple-gpio.c
··· 170 170 171 171 /* Pin multiplexer functions */ 172 172 173 + static bool apple_gpio_pinmux_func_is_gpio(struct pinctrl_dev *pctldev, 174 + unsigned int selector) 175 + { 176 + /* Function selector 0 is always the GPIO mode */ 177 + return (selector == 0); 178 + } 179 + 173 180 static int apple_gpio_pinmux_set(struct pinctrl_dev *pctldev, unsigned int func, 174 181 unsigned int group) 175 182 { ··· 193 186 .get_functions_count = pinmux_generic_get_function_count, 194 187 .get_function_name = pinmux_generic_get_function_name, 195 188 .get_function_groups = pinmux_generic_get_function_groups, 189 + .function_is_gpio = apple_gpio_pinmux_func_is_gpio, 196 190 .set_mux = apple_gpio_pinmux_set, 197 191 .strict = true, 198 192 };