diff options
author | Stephen Warren <swarren@nvidia.com> | 2011-10-21 14:25:53 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-01-03 03:09:59 -0500 |
commit | 3712a3c488987849613a4ad74129e67e40b12b38 (patch) | |
tree | c3b155ed171bb0542d6ea4b18dcfc3d279ee610f /include/linux/pinctrl/pinmux.h | |
parent | d2f6a1c6fb0e510a24ccac066eefbcfd0c932858 (diff) |
pinctrl: add explicit gpio_disable_free pinmux_op
Some pinctrl drivers (Tegra at least) program a pin to be a GPIO in a
completely different manner than they select which function to mux out of
that pin. In order to support a single "free" pinmux_op, the driver would
need to maintain a per-pin state of requested-for-gpio vs. requested-for-
function. However, that's a lot of work when the core already has explicit
separate paths for gpio request/free and function request/free.
So, add a gpio_disable_free op to struct pinmux_ops, and make pin_free()
call it when appropriate.
When doing this, I noticed that when calling pin_request():
!!gpio == (gpio_range != NULL)
... and so I collapsed those two parameters in both pin_request(), and
when adding writing the new code in pin_free().
Also, for pin_free():
!!free_func == (gpio_range != NULL)
However, I didn't want pin_free() to know about the GPIO function naming
special case, so instead, I reworked pin_free() to always return the pin's
previously requested function, and now pinmux_free_gpio() calls
kfree(function). This is much more balanced with the allocation having
been performed in pinmux_request_gpio().
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/pinctrl/pinmux.h')
-rw-r--r-- | include/linux/pinctrl/pinmux.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index 3c430e797efc..350e32a98c6a 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
@@ -73,6 +73,9 @@ struct pinmux_ops { | |||
73 | int (*gpio_request_enable) (struct pinctrl_dev *pctldev, | 73 | int (*gpio_request_enable) (struct pinctrl_dev *pctldev, |
74 | struct pinctrl_gpio_range *range, | 74 | struct pinctrl_gpio_range *range, |
75 | unsigned offset); | 75 | unsigned offset); |
76 | void (*gpio_disable_free) (struct pinctrl_dev *pctldev, | ||
77 | struct pinctrl_gpio_range *range, | ||
78 | unsigned offset); | ||
76 | }; | 79 | }; |
77 | 80 | ||
78 | /* External interface to pinmux */ | 81 | /* External interface to pinmux */ |