diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2010-03-05 16:44:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:48 -0500 |
commit | 3e45f1d1155894e6f4291f5536b224874d52d8e2 (patch) | |
tree | d7b44dd5248bdb053c0cd6632e82ce8893833519 /include/asm-generic | |
parent | 62fecb70cfaa9b4c6aa1981acd53b18f4ad925f0 (diff) |
gpio: introduce gpio_request_one() and friends
gpio_request() without initial configuration of the GPIO is normally
useless, introduce gpio_request_one() together with GPIOF_ flags for
input/output direction and initial output level.
gpio_{request,free}_array() for multiple GPIOs.
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Ben Nizette <bn@niasdigital.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/gpio.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 485eeb6c4ef3..979c6a57f2f1 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -136,6 +136,32 @@ extern int __gpio_cansleep(unsigned gpio); | |||
136 | 136 | ||
137 | extern int __gpio_to_irq(unsigned gpio); | 137 | extern int __gpio_to_irq(unsigned gpio); |
138 | 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 | |||
139 | #ifdef CONFIG_GPIO_SYSFS | 165 | #ifdef CONFIG_GPIO_SYSFS |
140 | 166 | ||
141 | /* | 167 | /* |