diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-11-09 14:24:07 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-11-11 09:02:07 +0100 |
commit | ed4348e8b249b56c493519aefeb72c3a8e92737e (patch) | |
tree | dcab6788b95a930401da69a9fe456db2e9998ae8 /include/gpio.h | |
parent | 4faf3055079abfb5c7790f38b8708306be3cc4fc (diff) | |
download | barebox-ed4348e8b249b56c493519aefeb72c3a8e92737e.tar.gz barebox-ed4348e8b249b56c493519aefeb72c3a8e92737e.tar.xz |
gpiolib: add get_direction callback
At least for debugging purposes it is helpful to determine the current
direction for a given GPIO. Add a callback to gpiochip, to allow to
get it.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/gpio.h')
-rw-r--r-- | include/gpio.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h index 140d53c83e..708b2aa119 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -3,6 +3,9 @@ #include <asm/gpio.h> +#define GPIO_DIR_OUT (0 << 0) +#define GPIO_DIR_IN (1 << 0) + #ifndef CONFIG_GPIOLIB static inline int gpio_request(unsigned gpio, const char *label) { @@ -24,6 +27,7 @@ struct gpio_ops { 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_direction)(struct gpio_chip *chip, unsigned offset); int (*get)(struct gpio_chip *chip, unsigned offset); void (*set)(struct gpio_chip *chip, unsigned offset, int value); }; |