diff options
Diffstat (limited to 'include/asm-generic/gpio.h')
| -rw-r--r-- | include/asm-generic/gpio.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 66d6106a2067..979c6a57f2f1 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
| @@ -28,6 +28,7 @@ static inline int gpio_is_valid(int number) | |||
| 28 | return ((unsigned)number) < ARCH_NR_GPIOS; | 28 | return ((unsigned)number) < ARCH_NR_GPIOS; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | struct device; | ||
| 31 | struct seq_file; | 32 | struct seq_file; |
| 32 | struct module; | 33 | struct module; |
| 33 | 34 | ||
| @@ -135,6 +136,32 @@ extern int __gpio_cansleep(unsigned gpio); | |||
| 135 | 136 | ||
| 136 | extern int __gpio_to_irq(unsigned gpio); | 137 | extern int __gpio_to_irq(unsigned gpio); |
| 137 | 138 | ||
| 139 | #define GPIOF_DIR_OUT (0 << 0) | ||
| 140 | #define GPIOF_DIR_IN (1 << 0) | ||
| 141 | |||
| 142 | #define GPIOF_INIT_LOW (0 << 1) | ||
| 143 | #define GPIOF_INIT_HIGH (1 << 1) | ||
| 144 | |||
| 145 | #define GPIOF_IN (GPIOF_DIR_IN) | ||
| 146 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) | ||
| 147 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) | ||
| 148 | |||
| 149 | /** | ||
| 150 | * struct gpio - a structure describing a GPIO with configuration | ||
| 151 | * @gpio: the GPIO number | ||
| 152 | * @flags: GPIO configuration as specified by GPIOF_* | ||
| 153 | * @label: a literal description string of this GPIO | ||
| 154 | */ | ||
| 155 | struct gpio { | ||
| 156 | unsigned gpio; | ||
| 157 | unsigned long flags; | ||
| 158 | const char *label; | ||
| 159 | }; | ||
| 160 | |||
| 161 | extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); | ||
| 162 | extern int gpio_request_array(struct gpio *array, size_t num); | ||
| 163 | extern void gpio_free_array(struct gpio *array, size_t num); | ||
| 164 | |||
| 138 | #ifdef CONFIG_GPIO_SYSFS | 165 | #ifdef CONFIG_GPIO_SYSFS |
| 139 | 166 | ||
| 140 | /* | 167 | /* |
| @@ -144,6 +171,7 @@ extern int __gpio_to_irq(unsigned gpio); | |||
| 144 | extern int gpio_export(unsigned gpio, bool direction_may_change); | 171 | extern int gpio_export(unsigned gpio, bool direction_may_change); |
| 145 | extern int gpio_export_link(struct device *dev, const char *name, | 172 | extern int gpio_export_link(struct device *dev, const char *name, |
| 146 | unsigned gpio); | 173 | unsigned gpio); |
| 174 | extern int gpio_sysfs_set_active_low(unsigned gpio, int value); | ||
| 147 | extern void gpio_unexport(unsigned gpio); | 175 | extern void gpio_unexport(unsigned gpio); |
| 148 | 176 | ||
| 149 | #endif /* CONFIG_GPIO_SYSFS */ | 177 | #endif /* CONFIG_GPIO_SYSFS */ |
| @@ -181,6 +209,8 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value) | |||
| 181 | 209 | ||
| 182 | #ifndef CONFIG_GPIO_SYSFS | 210 | #ifndef CONFIG_GPIO_SYSFS |
| 183 | 211 | ||
| 212 | struct device; | ||
| 213 | |||
| 184 | /* sysfs support is only available with gpiolib, where it's optional */ | 214 | /* sysfs support is only available with gpiolib, where it's optional */ |
| 185 | 215 | ||
| 186 | static inline int gpio_export(unsigned gpio, bool direction_may_change) | 216 | static inline int gpio_export(unsigned gpio, bool direction_may_change) |
| @@ -194,6 +224,11 @@ static inline int gpio_export_link(struct device *dev, const char *name, | |||
| 194 | return -ENOSYS; | 224 | return -ENOSYS; |
| 195 | } | 225 | } |
| 196 | 226 | ||
| 227 | static inline int gpio_sysfs_set_active_low(unsigned gpio, int value) | ||
| 228 | { | ||
| 229 | return -ENOSYS; | ||
| 230 | } | ||
| 231 | |||
| 197 | static inline void gpio_unexport(unsigned gpio) | 232 | static inline void gpio_unexport(unsigned gpio) |
| 198 | { | 233 | { |
| 199 | } | 234 | } |
