diff options
Diffstat (limited to 'include/linux/gpio.h')
-rw-r--r-- | include/linux/gpio.h | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index b8d0e53a802f..13dfd24d01ab 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -16,14 +16,17 @@ | |||
16 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) | 16 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) |
17 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) | 17 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) |
18 | 18 | ||
19 | /* Gpio pin is active-low */ | ||
20 | #define GPIOF_ACTIVE_LOW (1 << 2) | ||
21 | |||
19 | /* Gpio pin is open drain */ | 22 | /* Gpio pin is open drain */ |
20 | #define GPIOF_OPEN_DRAIN (1 << 2) | 23 | #define GPIOF_OPEN_DRAIN (1 << 3) |
21 | 24 | ||
22 | /* Gpio pin is open source */ | 25 | /* Gpio pin is open source */ |
23 | #define GPIOF_OPEN_SOURCE (1 << 3) | 26 | #define GPIOF_OPEN_SOURCE (1 << 4) |
24 | 27 | ||
25 | #define GPIOF_EXPORT (1 << 4) | 28 | #define GPIOF_EXPORT (1 << 5) |
26 | #define GPIOF_EXPORT_CHANGEABLE (1 << 5) | 29 | #define GPIOF_EXPORT_CHANGEABLE (1 << 6) |
27 | #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) | 30 | #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) |
28 | #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) | 31 | #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) |
29 | 32 | ||
@@ -74,6 +77,15 @@ static inline int irq_to_gpio(unsigned int irq) | |||
74 | 77 | ||
75 | #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ | 78 | #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ |
76 | 79 | ||
80 | /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */ | ||
81 | |||
82 | struct device; | ||
83 | |||
84 | int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); | ||
85 | int devm_gpio_request_one(struct device *dev, unsigned gpio, | ||
86 | unsigned long flags, const char *label); | ||
87 | void devm_gpio_free(struct device *dev, unsigned int gpio); | ||
88 | |||
77 | #else /* ! CONFIG_GPIOLIB */ | 89 | #else /* ! CONFIG_GPIOLIB */ |
78 | 90 | ||
79 | #include <linux/kernel.h> | 91 | #include <linux/kernel.h> |
@@ -205,6 +217,18 @@ static inline int gpio_to_irq(unsigned gpio) | |||
205 | return -EINVAL; | 217 | return -EINVAL; |
206 | } | 218 | } |
207 | 219 | ||
220 | static inline int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset) | ||
221 | { | ||
222 | WARN_ON(1); | ||
223 | return -EINVAL; | ||
224 | } | ||
225 | |||
226 | static inline void gpio_unlock_as_irq(struct gpio_chip *chip, | ||
227 | unsigned int offset) | ||
228 | { | ||
229 | WARN_ON(1); | ||
230 | } | ||
231 | |||
208 | static inline int irq_to_gpio(unsigned irq) | 232 | static inline int irq_to_gpio(unsigned irq) |
209 | { | 233 | { |
210 | /* irq can never have been returned from gpio_to_irq() */ | 234 | /* irq can never have been returned from gpio_to_irq() */ |
@@ -236,14 +260,25 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip) | |||
236 | WARN_ON(1); | 260 | WARN_ON(1); |
237 | } | 261 | } |
238 | 262 | ||
239 | #endif /* ! CONFIG_GPIOLIB */ | 263 | static inline int devm_gpio_request(struct device *dev, unsigned gpio, |
264 | const char *label) | ||
265 | { | ||
266 | WARN_ON(1); | ||
267 | return -EINVAL; | ||
268 | } | ||
240 | 269 | ||
241 | struct device; | 270 | static inline int devm_gpio_request_one(struct device *dev, unsigned gpio, |
271 | unsigned long flags, const char *label) | ||
272 | { | ||
273 | WARN_ON(1); | ||
274 | return -EINVAL; | ||
275 | } | ||
242 | 276 | ||
243 | /* bindings for managed devices that want to request gpios */ | 277 | static inline void devm_gpio_free(struct device *dev, unsigned int gpio) |
244 | int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); | 278 | { |
245 | int devm_gpio_request_one(struct device *dev, unsigned gpio, | 279 | WARN_ON(1); |
246 | unsigned long flags, const char *label); | 280 | } |
247 | void devm_gpio_free(struct device *dev, unsigned int gpio); | 281 | |
282 | #endif /* ! CONFIG_GPIOLIB */ | ||
248 | 283 | ||
249 | #endif /* __LINUX_GPIO_H */ | 284 | #endif /* __LINUX_GPIO_H */ |