4 /* see Documentation/gpio.txt */
6 #ifdef CONFIG_GENERIC_GPIO
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/errno.h>
20 * Some platforms don't support the GPIO programming interface.
22 * In case some driver uses it anyway (it should normally have
23 * depended on GENERIC_GPIO), these routines help the compiler
24 * optimize out much GPIO-related code ... or trigger a runtime
25 * warning when something is wrongly called.
28 static inline bool gpio_is_valid(int number
)
33 static inline int gpio_request(unsigned gpio
, const char *label
)
38 static inline int gpio_request_one(unsigned gpio
,
39 unsigned long flags
, const char *label
)
44 static inline int gpio_request_array(const struct gpio
*array
, size_t num
)
49 static inline void gpio_free(unsigned gpio
)
53 /* GPIO can never have been requested */
57 static inline void gpio_free_array(const struct gpio
*array
, size_t num
)
61 /* GPIO can never have been requested */
65 static inline int gpio_direction_input(unsigned gpio
)
70 static inline int gpio_direction_output(unsigned gpio
, int value
)
75 static inline int gpio_set_debounce(unsigned gpio
, unsigned debounce
)
80 static inline int gpio_get_value(unsigned gpio
)
82 /* GPIO can never have been requested or set as {in,out}put */
87 static inline void gpio_set_value(unsigned gpio
, int value
)
89 /* GPIO can never have been requested or set as output */
93 static inline int gpio_cansleep(unsigned gpio
)
95 /* GPIO can never have been requested or set as {in,out}put */
100 static inline int gpio_get_value_cansleep(unsigned gpio
)
102 /* GPIO can never have been requested or set as {in,out}put */
107 static inline void gpio_set_value_cansleep(unsigned gpio
, int value
)
109 /* GPIO can never have been requested or set as output */
113 static inline int gpio_export(unsigned gpio
, bool direction_may_change
)
115 /* GPIO can never have been requested or set as {in,out}put */
120 static inline int gpio_export_link(struct device
*dev
, const char *name
,
123 /* GPIO can never have been exported */
128 static inline int gpio_sysfs_set_active_low(unsigned gpio
, int value
)
130 /* GPIO can never have been requested */
135 static inline void gpio_unexport(unsigned gpio
)
137 /* GPIO can never have been exported */
141 static inline int gpio_to_irq(unsigned gpio
)
143 /* GPIO can never have been requested or set as input */
148 static inline int irq_to_gpio(unsigned irq
)
150 /* irq can never have been returned from gpio_to_irq() */
157 #endif /* __LINUX_GPIO_H */