Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bin Gao and committed by
Linus Walleij
7d9e59ce 9c668632

+14
+14
drivers/gpio/gpio-wcove.c
··· 164 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 180 static int wcove_gpio_get(struct gpio_chip *chip, unsigned int gpio) 168 181 { 169 182 struct wcove_gpio *wg = gpiochip_get_data(chip); ··· 407 394 wg->chip.label = KBUILD_MODNAME; 408 395 wg->chip.direction_input = wcove_gpio_dir_in; 409 396 wg->chip.direction_output = wcove_gpio_dir_out; 397 + wg->chip.get_direction = wcove_gpio_get_direction; 410 398 wg->chip.get = wcove_gpio_get; 411 399 wg->chip.set = wcove_gpio_set; 412 400 wg->chip.set_single_ended = wcove_gpio_set_single_ended,