Skip to content

Commit

Permalink
gpio: tps68470: Make tps68470_gpio_output() always set the initial value
Browse files Browse the repository at this point in the history
[ Upstream commit 5a7adc6 ]

Make tps68470_gpio_output() call tps68470_gpio_set() for output-only pins
too, so that the initial value passed to gpiod_direction_output() is
honored for these pins too.

Fixes: 275b13a ("gpio: Add support for TPS68470 GPIOs")
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Tested-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
jwrdegoede authored and gregkh committed Aug 3, 2023
1 parent 04f7d49 commit b2d8ac9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpio/gpio-tps68470.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ static int tps68470_gpio_output(struct gpio_chip *gc, unsigned int offset,
struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc);
struct regmap *regmap = tps68470_gpio->tps68470_regmap;

/* Set the initial value */
tps68470_gpio_set(gc, offset, value);

/* rest are always outputs */
if (offset >= TPS68470_N_REGULAR_GPIO)
return 0;

/* Set the initial value */
tps68470_gpio_set(gc, offset, value);

return regmap_update_bits(regmap, TPS68470_GPIO_CTL_REG_A(offset),
TPS68470_GPIO_MODE_MASK,
TPS68470_GPIO_MODE_OUT_CMOS);
Expand Down

0 comments on commit b2d8ac9

Please sign in to comment.