summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinmux.h
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2019-08-14 13:00:35 +0200
committerLinus Walleij <linus.walleij@linaro.org>2019-08-23 11:09:41 +0200
commit472a61e777fe78cdcb6cb6f25efee0ae9f629aca (patch)
treef3ee044b2383fa012881daf257e6b4ca90ceefd4 /drivers/pinctrl/pinmux.h
parentdt-bindings: pinctrl: qcom-pmic-gpio: Add pm8150l support (diff)
downloadlinux-472a61e777fe78cdcb6cb6f25efee0ae9f629aca.tar.xz
linux-472a61e777fe78cdcb6cb6f25efee0ae9f629aca.zip
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 <stefan.wahren@i2se.com> Tested-by: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Ramon Fried <rfried.dev@gmail.com> Link: https://lore.kernel.org/r/20190814110035.13451-1-ramon.fried@linux.intel.com Acked-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinmux.h')
-rw-r--r--drivers/pinctrl/pinmux.h8
1 files changed, 8 insertions, 0 deletions
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)