diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-12-21 14:26:08 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-12-22 16:39:23 +0100 |
commit | 8429aed80eeafc64a17e98f45cc93984d5938bb9 (patch) | |
tree | ae502c3d743fa59a2e5f12f97499b36c8c11c3ec /include/gpio.h | |
parent | b46b57f35a27090cfbac4900d1a3d522d7898e53 (diff) | |
download | barebox-8429aed80eeafc64a17e98f45cc93984d5938bb9.tar.gz barebox-8429aed80eeafc64a17e98f45cc93984d5938bb9.tar.xz |
gpiolib: add gpio_request and gpio_free support
as today if no request or free provided do not complain
if the gpio is not request auto requested at first use
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/gpio.h')
-rw-r--r-- | include/gpio.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h index 9fb11c3268..eedb980d00 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -3,6 +3,7 @@ #include <asm/gpio.h> +#ifndef CONFIG_GPIOLIB static inline int gpio_request(unsigned gpio, const char *label) { return 0; @@ -11,10 +12,16 @@ static inline int gpio_request(unsigned gpio, const char *label) static inline void gpio_free(unsigned gpio) { } +#else +int gpio_request(unsigned gpio, const char *label); +void gpio_free(unsigned gpio); +#endif struct gpio_chip; struct gpio_ops { + int (*request)(struct gpio_chip *chip, unsigned offset); + void (*free)(struct gpio_chip *chip, unsigned offset); int (*direction_input)(struct gpio_chip *chip, unsigned offset); int (*direction_output)(struct gpio_chip *chip, unsigned offset, int value); int (*get)(struct gpio_chip *chip, unsigned offset); |