9
0
Fork 0

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>
This commit is contained in:
Sebastian Hesselbarth 2013-11-09 14:24:07 +01:00 committed by Sascha Hauer
parent 4faf305507
commit ed4348e8b2
1 changed files with 4 additions and 0 deletions

View File

@ -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);
};