Re: [PATCH 3/3] gpio: tps65219: Fix TPS65214 GPIO direction programming

From: Jon Cormier

Date: Thu Sep 24 2026 - 14:16:42 EST


On Thu, Sep 24, 2026 at 11:47 AM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Sat, Sep 19, 2026 at 8:11 PM Karl Mehltretter <kmehltretter@xxxxxxxxx> wrote:
> >
> > GPIO_LINE_DIRECTION_OUT and GPIO_LINE_DIRECTION_IN have the values 0
> > and 1, respectively, while the TPS65214 GPIO_CONFIG field is BIT(1).
> > regmap_update_bits() masks the supplied value, so passing either
> > direction value clears the field and selects input mode.
> >
> > Translate the GPIO direction to the register encoding used by
> > tps65214_gpio_get_direction(), setting GPIO_CONFIG for output and
> > clearing it for input.
>
> ...
>
> > + val = direction == GPIO_LINE_DIRECTION_OUT ?
> > + TPS65214_GPIO0_DIR_MASK : 0;
> > ret = regmap_update_bits(gpio->tps->regmap, TPS65219_REG_GENERAL_CONFIG,
> > - TPS65214_GPIO0_DIR_MASK, direction);
> > + TPS65214_GPIO0_DIR_MASK, val);
>
> regmap_assign_bits()
That would make sense, it would simplify the diff. I think something
like this, right.

- ret = regmap_update_bits(gpio->tps->regmap,
TPS65219_REG_GENERAL_CONFIG,
- TPS65214_GPIO0_DIR_MASK, direction);
+ ret = regmap_assign_bits(gpio->tps->regmap,
TPS65219_REG_GENERAL_CONFIG,
+ TPS65214_GPIO0_DIR_MASK, direction
== GPIO_LINE_DIRECTION_OUT);


--
Jonathan Cormier
Senior Software Engineer

Office: 315.425.4045 x222

http://www.CriticalLink.com
6712 Brooklawn Parkway, Syracuse, NY 13211