hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/gpio/gpio-tps68470.c
....@@ -47,7 +47,6 @@
4747 return !!(val & BIT(offset));
4848 }
4949
50
-/* Return 0 if output, 1 if input */
5150 static int tps68470_gpio_get_direction(struct gpio_chip *gc,
5251 unsigned int offset)
5352 {
....@@ -57,7 +56,7 @@
5756
5857 /* rest are always outputs */
5958 if (offset >= TPS68470_N_REGULAR_GPIO)
60
- return 0;
59
+ return GPIO_LINE_DIRECTION_OUT;
6160
6261 ret = regmap_read(regmap, TPS68470_GPIO_CTL_REG_A(offset), &val);
6362 if (ret) {
....@@ -67,7 +66,8 @@
6766 }
6867
6968 val &= TPS68470_GPIO_MODE_MASK;
70
- return val >= TPS68470_GPIO_MODE_OUT_CMOS ? 0 : 1;
69
+ return val >= TPS68470_GPIO_MODE_OUT_CMOS ? GPIO_LINE_DIRECTION_OUT :
70
+ GPIO_LINE_DIRECTION_IN;
7171 }
7272
7373 static void tps68470_gpio_set(struct gpio_chip *gc, unsigned int offset,
....@@ -91,12 +91,12 @@
9191 struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc);
9292 struct regmap *regmap = tps68470_gpio->tps68470_regmap;
9393
94
+ /* Set the initial value */
95
+ tps68470_gpio_set(gc, offset, value);
96
+
9497 /* rest are always outputs */
9598 if (offset >= TPS68470_N_REGULAR_GPIO)
9699 return 0;
97
-
98
- /* Set the initial value */
99
- tps68470_gpio_set(gc, offset, value);
100100
101101 return regmap_update_bits(regmap, TPS68470_GPIO_CTL_REG_A(offset),
102102 TPS68470_GPIO_MODE_MASK,