diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/pinctrl/pinmux.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index bb7a9792f1ea..937b3e2fa36f 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
| @@ -54,7 +54,13 @@ struct pinctrl_dev; | |||
| 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(pin number) 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 | */ |
| 59 | struct pinmux_ops { | 65 | struct pinmux_ops { |
| 60 | int (*request) (struct pinctrl_dev *pctldev, unsigned offset); | 66 | int (*request) (struct pinctrl_dev *pctldev, unsigned offset); |
| @@ -76,11 +82,17 @@ struct pinmux_ops { | |||
| 76 | void (*gpio_disable_free) (struct pinctrl_dev *pctldev, | 82 | void (*gpio_disable_free) (struct pinctrl_dev *pctldev, |
| 77 | struct pinctrl_gpio_range *range, | 83 | struct pinctrl_gpio_range *range, |
| 78 | unsigned offset); | 84 | unsigned offset); |
| 85 | int (*gpio_set_direction) (struct pinctrl_dev *pctldev, | ||
| 86 | struct pinctrl_gpio_range *range, | ||
| 87 | unsigned offset, | ||
| 88 | bool input); | ||
| 79 | }; | 89 | }; |
| 80 | 90 | ||
| 81 | /* External interface to pinmux */ | 91 | /* External interface to pinmux */ |
| 82 | extern int pinmux_request_gpio(unsigned gpio); | 92 | extern int pinmux_request_gpio(unsigned gpio); |
| 83 | extern void pinmux_free_gpio(unsigned gpio); | 93 | extern void pinmux_free_gpio(unsigned gpio); |
| 94 | extern int pinmux_gpio_direction_input(unsigned gpio); | ||
| 95 | extern int pinmux_gpio_direction_output(unsigned gpio); | ||
| 84 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); | 96 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); |
| 85 | extern void pinmux_put(struct pinmux *pmx); | 97 | extern void pinmux_put(struct pinmux *pmx); |
| 86 | extern int pinmux_enable(struct pinmux *pmx); | 98 | extern int pinmux_enable(struct pinmux *pmx); |
| @@ -97,6 +109,16 @@ static inline void pinmux_free_gpio(unsigned gpio) | |||
| 97 | { | 109 | { |
| 98 | } | 110 | } |
| 99 | 111 | ||
| 112 | static inline int pinmux_gpio_direction_input(unsigned gpio) | ||
| 113 | { | ||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline int pinmux_gpio_direction_output(unsigned gpio) | ||
| 118 | { | ||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | |||
| 100 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) | 122 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) |
| 101 | { | 123 | { |
| 102 | return NULL; | 124 | return NULL; |
