diff options
author | Bin Gao <bin.gao@linux.intel.com> | 2016-08-15 14:03:23 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-08-19 09:02:19 -0400 |
commit | 7d9e59ce761f2ebe0bf57e6467cc13d932ee109b (patch) | |
tree | fc8092840de21aaecc4f13652dcb0be01fc1536c /drivers/gpio/gpio-wcove.c | |
parent | 9c6686322d749814e3e7af492954ca1777444023 (diff) |
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/gpio-wcove.c')
-rw-r--r-- | drivers/gpio/gpio-wcove.c | 14 |
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, | |||
164 | CTLO_OUTPUT_SET | value); | 164 | CTLO_OUTPUT_SET | value); |
165 | } | 165 | } |
166 | 166 | ||
167 | static int wcove_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio) | ||
168 | { | ||
169 | struct wcove_gpio *wg = gpiochip_get_data(chip); | ||
170 | unsigned int val; | ||
171 | int ret; | ||
172 | |||
173 | ret = regmap_read(wg->regmap, to_reg(gpio, CTRL_OUT), &val); | ||
174 | if (ret) | ||
175 | return ret; | ||
176 | |||
177 | return !(val & CTLO_DIR_OUT); | ||
178 | } | ||
179 | |||
167 | static int wcove_gpio_get(struct gpio_chip *chip, unsigned int gpio) | 180 | static int wcove_gpio_get(struct gpio_chip *chip, unsigned int gpio) |
168 | { | 181 | { |
169 | struct wcove_gpio *wg = gpiochip_get_data(chip); | 182 | struct wcove_gpio *wg = gpiochip_get_data(chip); |
@@ -394,6 +407,7 @@ static int wcove_gpio_probe(struct platform_device *pdev) | |||
394 | wg->chip.label = KBUILD_MODNAME; | 407 | wg->chip.label = KBUILD_MODNAME; |
395 | wg->chip.direction_input = wcove_gpio_dir_in; | 408 | wg->chip.direction_input = wcove_gpio_dir_in; |
396 | wg->chip.direction_output = wcove_gpio_dir_out; | 409 | wg->chip.direction_output = wcove_gpio_dir_out; |
410 | wg->chip.get_direction = wcove_gpio_get_direction; | ||
397 | wg->chip.get = wcove_gpio_get; | 411 | wg->chip.get = wcove_gpio_get; |
398 | wg->chip.set = wcove_gpio_set; | 412 | wg->chip.set = wcove_gpio_set; |
399 | wg->chip.set_single_ended = wcove_gpio_set_single_ended, | 413 | wg->chip.set_single_ended = wcove_gpio_set_single_ended, |