4 /* see Documentation/gpio.txt */
6 /* make these flag values available regardless of GPIO kconfig options */
7 #define GPIOF_DIR_OUT (0 << 0)
8 #define GPIOF_DIR_IN (1 << 0)
10 #define GPIOF_INIT_LOW (0 << 1)
11 #define GPIOF_INIT_HIGH (1 << 1)
13 #define GPIOF_IN (GPIOF_DIR_IN)
14 #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15 #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
18 * struct gpio - a structure describing a GPIO with configuration
19 * @gpio: the GPIO number
20 * @flags: GPIO configuration as specified by GPIOF_*
21 * @label: a literal description string of this GPIO
29 #ifdef CONFIG_GENERIC_GPIO
34 #include <linux/kernel.h>
35 #include <linux/types.h>
36 #include <linux/errno.h>
37 #include <linux/bug.h>
42 static inline bool gpio_is_valid(int number)
47 static inline int gpio_request(unsigned gpio, const char *label)
52 static inline int gpio_request_one(unsigned gpio,
53 unsigned long flags, const char *label)
58 static inline int gpio_request_array(const struct gpio *array, size_t num)
63 static inline void gpio_free(unsigned gpio)
67 /* GPIO can never have been requested */
71 static inline void gpio_free_array(const struct gpio *array, size_t num)
75 /* GPIO can never have been requested */
79 static inline int gpio_direction_input(unsigned gpio)
84 static inline int gpio_direction_output(unsigned gpio, int value)
89 static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
94 static inline int gpio_get_value(unsigned gpio)
96 /* GPIO can never have been requested or set as {in,out}put */
101 static inline void gpio_set_value(unsigned gpio, int value)
103 /* GPIO can never have been requested or set as output */
107 static inline int gpio_cansleep(unsigned gpio)
109 /* GPIO can never have been requested or set as {in,out}put */
114 static inline int gpio_get_value_cansleep(unsigned gpio)
116 /* GPIO can never have been requested or set as {in,out}put */
121 static inline void gpio_set_value_cansleep(unsigned gpio, int value)
123 /* GPIO can never have been requested or set as output */
127 static inline int gpio_export(unsigned gpio, bool direction_may_change)
129 /* GPIO can never have been requested or set as {in,out}put */
134 static inline int gpio_export_link(struct device *dev, const char *name,
137 /* GPIO can never have been exported */
142 static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
144 /* GPIO can never have been requested */
149 static inline void gpio_unexport(unsigned gpio)
151 /* GPIO can never have been exported */
155 static inline int gpio_to_irq(unsigned gpio)
157 /* GPIO can never have been requested or set as input */
162 static inline int irq_to_gpio(unsigned irq)
164 /* irq can never have been returned from gpio_to_irq() */
171 #endif /* __LINUX_GPIO_H */