summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorBin Gao <bin.gao@linux.intel.com>2016-08-15 20:03:23 +0200
committerLinus Walleij <linus.walleij@linaro.org>2016-08-19 15:02:19 +0200
commit7d9e59ce761f2ebe0bf57e6467cc13d932ee109b (patch)
treefc8092840de21aaecc4f13652dcb0be01fc1536c /drivers/gpio
parentgpio: add Technologic I2C-FPGA gpio support (diff)
downloadlinux-7d9e59ce761f2ebe0bf57e6467cc13d932ee109b.tar.xz
linux-7d9e59ce761f2ebe0bf57e6467cc13d932ee109b.zip
gpio: wcove-gpio: add get_direction method
This patch adds .get_direction method for the gpio_chip structure of the wcove_gpio driver. Signed-off-by: Bin Gao <bin.gao@intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-wcove.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
index f5c88df96eaa..e11d6a3fb641 100644
--- a/drivers/gpio/gpio-wcove.c
+++ b/drivers/gpio/gpio-wcove.c
@@ -164,6 +164,19 @@ static int wcove_gpio_dir_out(struct gpio_chip *chip, unsigned int gpio,
CTLO_OUTPUT_SET | value);
}
+static int wcove_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio)
+{
+ struct wcove_gpio *wg = gpiochip_get_data(chip);
+ unsigned int val;
+ int ret;
+
+ ret = regmap_read(wg->regmap, to_reg(gpio, CTRL_OUT), &val);
+ if (ret)
+ return ret;
+
+ return !(val & CTLO_DIR_OUT);
+}
+
static int wcove_gpio_get(struct gpio_chip *chip, unsigned int gpio)
{
struct wcove_gpio *wg = gpiochip_get_data(chip);
@@ -394,6 +407,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)
wg->chip.label = KBUILD_MODNAME;
wg->chip.direction_input = wcove_gpio_dir_in;
wg->chip.direction_output = wcove_gpio_dir_out;
+ wg->chip.get_direction = wcove_gpio_get_direction;
wg->chip.get = wcove_gpio_get;
wg->chip.set = wcove_gpio_set;
wg->chip.set_single_ended = wcove_gpio_set_single_ended,