]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gpio: max77620: get gpio value based on direction
authorVenkat Reddy Talla <vreddytalla@nvidia.com>
Mon, 27 Jun 2016 10:56:24 +0000 (16:26 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 4 Jul 2016 09:39:38 +0000 (11:39 +0200)
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 <vreddytalla@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-max77620.c

index 8658c32c46904eccb2163a6bd409ee87d890b57a..b46b436cb97feaf3966fb240f8c727f2dc3b8cd1 100644 (file)
@@ -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,