gpio: lp87565: Set proper output level and direction for direction_output

The value argument of lp87565_gpio_direction_output() means output level
rather than gpio direction.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by Axel Lin and committed by Linus Walleij fa8f6d06 727fd697

+24 -22
+24 -22
drivers/gpio/gpio-lp87565.c
··· 26 struct regmap *map; 27 }; 28 29 static int lp87565_gpio_get_direction(struct gpio_chip *chip, 30 unsigned int offset) 31 { ··· 75 { 76 struct lp87565_gpio *gpio = gpiochip_get_data(chip); 77 78 return regmap_update_bits(gpio->map, 79 LP87565_REG_GPIO_CONFIG, 80 - BIT(offset), !value ? BIT(offset) : 0); 81 - } 82 - 83 - static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset) 84 - { 85 - struct lp87565_gpio *gpio = gpiochip_get_data(chip); 86 - int ret, val; 87 - 88 - ret = regmap_read(gpio->map, LP87565_REG_GPIO_IN, &val); 89 - if (ret < 0) 90 - return ret; 91 - 92 - return !!(val & BIT(offset)); 93 - } 94 - 95 - static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset, 96 - int value) 97 - { 98 - struct lp87565_gpio *gpio = gpiochip_get_data(chip); 99 - 100 - regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT, 101 - BIT(offset), value ? BIT(offset) : 0); 102 } 103 104 static int lp87565_gpio_request(struct gpio_chip *gc, unsigned int offset)
··· 26 struct regmap *map; 27 }; 28 29 + static int lp87565_gpio_get(struct gpio_chip *chip, unsigned int offset) 30 + { 31 + struct lp87565_gpio *gpio = gpiochip_get_data(chip); 32 + int ret, val; 33 + 34 + ret = regmap_read(gpio->map, LP87565_REG_GPIO_IN, &val); 35 + if (ret < 0) 36 + return ret; 37 + 38 + return !!(val & BIT(offset)); 39 + } 40 + 41 + static void lp87565_gpio_set(struct gpio_chip *chip, unsigned int offset, 42 + int value) 43 + { 44 + struct lp87565_gpio *gpio = gpiochip_get_data(chip); 45 + 46 + regmap_update_bits(gpio->map, LP87565_REG_GPIO_OUT, 47 + BIT(offset), value ? BIT(offset) : 0); 48 + } 49 + 50 static int lp87565_gpio_get_direction(struct gpio_chip *chip, 51 unsigned int offset) 52 { ··· 54 { 55 struct lp87565_gpio *gpio = gpiochip_get_data(chip); 56 57 + lp87565_gpio_set(chip, offset, value); 58 + 59 return regmap_update_bits(gpio->map, 60 LP87565_REG_GPIO_CONFIG, 61 + BIT(offset), BIT(offset)); 62 } 63 64 static int lp87565_gpio_request(struct gpio_chip *gc, unsigned int offset)