aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Sierra <asierra@xes-inc.com>2015-03-31 11:11:47 -0400
committerLinus Walleij <linus.walleij@linaro.org>2015-04-08 03:54:27 -0400
commit62e08f25bd09b088f266ea6fc34d2f596d83c04e (patch)
tree544ac1f99e0bcfc657891be5123f01171bc89177
parentafeb7b45e96239f0bfa610dd40945786f5a9b164 (diff)
gpio: ich: Implement get_direction function
Allow the kernel to query the driver for a GPIO's pin direction. Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-ich.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c
index 7818cd1453ae..4ba7ed502131 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
@@ -173,6 +173,11 @@ static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr)
173 return !!(ichx_priv.use_gpio & (1 << (nr / 32))); 173 return !!(ichx_priv.use_gpio & (1 << (nr / 32)));
174} 174}
175 175
176static int ichx_gpio_get_direction(struct gpio_chip *gpio, unsigned nr)
177{
178 return ichx_read_bit(GPIO_IO_SEL, nr) ? GPIOF_DIR_IN : GPIOF_DIR_OUT;
179}
180
176static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) 181static int ichx_gpio_direction_input(struct gpio_chip *gpio, unsigned nr)
177{ 182{
178 /* 183 /*
@@ -286,6 +291,7 @@ static void ichx_gpiolib_setup(struct gpio_chip *chip)
286 ichx_priv.desc->get : ichx_gpio_get; 291 ichx_priv.desc->get : ichx_gpio_get;
287 292
288 chip->set = ichx_gpio_set; 293 chip->set = ichx_gpio_set;
294 chip->get_direction = ichx_gpio_get_direction;
289 chip->direction_input = ichx_gpio_direction_input; 295 chip->direction_input = ichx_gpio_direction_input;
290 chip->direction_output = ichx_gpio_direction_output; 296 chip->direction_output = ichx_gpio_direction_output;
291 chip->base = modparam_gpiobase; 297 chip->base = modparam_gpiobase;