Merge branch 'mini2440-dev-unlikely' into mini2440-dev
[linux-2.6/mini2440.git] / include / linux / gpio.h
blob059bd189d35ddd1d1e6931b0aa4ddc2c95a9c9a3
1 #ifndef __LINUX_GPIO_H
2 #define __LINUX_GPIO_H
4 /* see Documentation/gpio.txt */
6 #ifdef CONFIG_GENERIC_GPIO
7 #include <asm/gpio.h>
9 #else
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/errno.h>
15 struct device;
18 * Some platforms don't support the GPIO programming interface.
20 * In case some driver uses it anyway (it should normally have
21 * depended on GENERIC_GPIO), these routines help the compiler
22 * optimize out much GPIO-related code ... or trigger a runtime
23 * warning when something is wrongly called.
26 static inline int gpio_is_valid(int number)
28 return 0;
31 static inline int gpio_request(unsigned gpio, const char *label)
33 return -ENOSYS;
36 static inline void gpio_free(unsigned gpio)
38 might_sleep();
40 /* GPIO can never have been requested */
41 WARN_ON(1);
44 static inline int gpio_direction_input(unsigned gpio)
46 return -ENOSYS;
49 static inline int gpio_direction_output(unsigned gpio, int value)
51 return -ENOSYS;
54 static inline int gpio_get_value(unsigned gpio)
56 /* GPIO can never have been requested or set as {in,out}put */
57 WARN_ON(1);
58 return 0;
61 static inline void gpio_set_value(unsigned gpio, int value)
63 /* GPIO can never have been requested or set as output */
64 WARN_ON(1);
67 static inline int gpio_cansleep(unsigned gpio)
69 /* GPIO can never have been requested or set as {in,out}put */
70 WARN_ON(1);
71 return 0;
74 static inline int gpio_get_value_cansleep(unsigned gpio)
76 /* GPIO can never have been requested or set as {in,out}put */
77 WARN_ON(1);
78 return 0;
81 static inline void gpio_set_value_cansleep(unsigned gpio, int value)
83 /* GPIO can never have been requested or set as output */
84 WARN_ON(1);
87 static inline int gpio_export(unsigned gpio, bool direction_may_change)
89 /* GPIO can never have been requested or set as {in,out}put */
90 WARN_ON(1);
91 return -EINVAL;
94 static inline int gpio_export_link(struct device *dev, const char *name,
95 unsigned gpio)
97 /* GPIO can never have been exported */
98 WARN_ON(1);
99 return -EINVAL;
103 static inline void gpio_unexport(unsigned gpio)
105 /* GPIO can never have been exported */
106 WARN_ON(1);
109 static inline int gpio_to_irq(unsigned gpio)
111 /* GPIO can never have been requested or set as input */
112 WARN_ON(1);
113 return -EINVAL;
116 static inline int irq_to_gpio(unsigned irq)
118 /* irq can never have been returned from gpio_to_irq() */
119 WARN_ON(1);
120 return -EINVAL;
123 #endif
125 #endif /* __LINUX_GPIO_H */