From: Venkat Reddy Talla Date: Mon, 27 Jun 2016 10:56:24 +0000 (+0530) Subject: gpio: max77620: get gpio value based on direction X-Git-Tag: v4.8-rc1~151^2~14 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1941b4419a24e026ce8354a2fd40c9387577697e;p=karo-tx-linux.git gpio: max77620: get gpio value based on direction Gpio direction is determined by DIRx bit of GPIO configuration register, return max77620 gpio value based on direction in or out. Signed-off-by: Venkat Reddy Talla Reviewed-by: Alexandre Courbot Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c index 8658c32c4690..b46b436cb97f 100644 --- a/drivers/gpio/gpio-max77620.c +++ b/drivers/gpio/gpio-max77620.c @@ -123,7 +123,10 @@ static int max77620_gpio_get(struct gpio_chip *gc, unsigned int offset) return ret; } - return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK); + if (val & MAX77620_CNFG_GPIO_DIR_MASK) + return !!(val & MAX77620_CNFG_GPIO_INPUT_VAL_MASK); + else + return !!(val & MAX77620_CNFG_GPIO_OUTPUT_VAL_MASK); } static int max77620_gpio_dir_output(struct gpio_chip *gc, unsigned int offset,