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@xxxxxxxxx> --- Cc: barebox@xxxxxxxxxxxxxxxxxxx --- include/gpio.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/gpio.h b/include/gpio.h index 140d53c..708b2aa 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); }; -- 1.8.4.rc3 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox