aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pinctrl/pinmux.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pinctrl/pinmux.h')
-rw-r--r--include/linux/pinctrl/pinmux.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 3c430e797efc..937b3e2fa36f 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -52,9 +52,15 @@ struct pinctrl_dev;
52 * @disable: disable a certain muxing selector with a certain pin group 52 * @disable: disable a certain muxing selector with a certain pin group
53 * @gpio_request_enable: requests and enables GPIO on a certain pin. 53 * @gpio_request_enable: requests and enables GPIO on a certain pin.
54 * Implement this only if you can mux every pin individually as GPIO. The 54 * Implement this only if you can mux every pin individually as GPIO. The
55 * affected GPIO range is passed along with an offset into that 55 * affected GPIO range is passed along with an offset(pin number) into that
56 * specific GPIO range - function selectors and pin groups are orthogonal 56 * specific GPIO range - function selectors and pin groups are orthogonal
57 * to this, the core will however make sure the pins do not collide 57 * to this, the core will however make sure the pins do not collide.
58 * @gpio_disable_free: free up GPIO muxing on a certain pin, the reverse of
59 * @gpio_request_enable
60 * @gpio_set_direction: Since controllers may need different configurations
61 * depending on whether the GPIO is configured as input or output,
62 * a direction selector function may be implemented as a backing
63 * to the GPIO controllers that need pin muxing.
58 */ 64 */
59struct pinmux_ops { 65struct pinmux_ops {
60 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 66 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
@@ -73,11 +79,20 @@ struct pinmux_ops {
73 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 79 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
74 struct pinctrl_gpio_range *range, 80 struct pinctrl_gpio_range *range,
75 unsigned offset); 81 unsigned offset);
82 void (*gpio_disable_free) (struct pinctrl_dev *pctldev,
83 struct pinctrl_gpio_range *range,
84 unsigned offset);
85 int (*gpio_set_direction) (struct pinctrl_dev *pctldev,
86 struct pinctrl_gpio_range *range,
87 unsigned offset,
88 bool input);
76}; 89};
77 90
78/* External interface to pinmux */ 91/* External interface to pinmux */
79extern int pinmux_request_gpio(unsigned gpio); 92extern int pinmux_request_gpio(unsigned gpio);
80extern void pinmux_free_gpio(unsigned gpio); 93extern void pinmux_free_gpio(unsigned gpio);
94extern int pinmux_gpio_direction_input(unsigned gpio);
95extern int pinmux_gpio_direction_output(unsigned gpio);
81extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); 96extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
82extern void pinmux_put(struct pinmux *pmx); 97extern void pinmux_put(struct pinmux *pmx);
83extern int pinmux_enable(struct pinmux *pmx); 98extern int pinmux_enable(struct pinmux *pmx);
@@ -94,6 +109,16 @@ static inline void pinmux_free_gpio(unsigned gpio)
94{ 109{
95} 110}
96 111
112static inline int pinmux_gpio_direction_input(unsigned gpio)
113{
114 return 0;
115}
116
117static inline int pinmux_gpio_direction_output(unsigned gpio)
118{
119 return 0;
120}
121
97static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) 122static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
98{ 123{
99 return NULL; 124 return NULL;