From 472a61e777fe78cdcb6cb6f25efee0ae9f629aca Mon Sep 17 00:00:00 2001 From: Stefan Wahren Date: Wed, 14 Aug 2019 14:00:35 +0300 Subject: pinctrl/gpio: Take MUX usage into account The user space like gpioinfo only see the GPIO usage but not the MUX usage (e.g. I2C or SPI usage) of a pin. As a user we want to know which pin is free/safe to use. So take the MUX usage of strict pinmux controllers into account to get a more realistic view for ioctl GPIO_GET_LINEINFO_IOCTL. Signed-off-by: Stefan Wahren Tested-by: Ramon Fried Signed-off-by: Ramon Fried Link: https://lore.kernel.org/r/20190814110035.13451-1-ramon.fried@linux.intel.com Acked-by: Stefan Wahren Signed-off-by: Linus Walleij --- drivers/pinctrl/pinmux.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/pinctrl/pinmux.h') diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h index 794cb3a003ff..78c3a31be882 100644 --- a/drivers/pinctrl/pinmux.h +++ b/drivers/pinctrl/pinmux.h @@ -15,6 +15,8 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev); int pinmux_validate_map(const struct pinctrl_map *map, int i); +bool pinmux_can_be_used_for_gpio(struct pinctrl_dev *pctldev, unsigned pin); + int pinmux_request_gpio(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned pin, unsigned gpio); @@ -42,6 +44,12 @@ static inline int pinmux_validate_map(const struct pinctrl_map *map, int i) return 0; } +static inline bool pinmux_can_be_used_for_gpio(struct pinctrl_dev *pctldev, + unsigned pin) +{ + return true; +} + static inline int pinmux_request_gpio(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned pin, unsigned gpio) -- cgit v1.2.3