Re: [PATCH v2] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper

From: Andy Shevchenko

Date: Thu Aug 06 2026 - 17:59:40 EST


On Fri, Jul 24, 2026 at 09:42:28AM -0700, Alex Tran wrote:
> After successfully configuring gpio pin as output, set the
> requested initial output value via the existing gpio set
> wrapper, so that the pin is not left at its previous level.

...

> +static int pin_control_gpio_direction_output(struct gpio_chip *chip,
> + unsigned int offset, int val)
> +{
> + int ret;
> +
> + ret = pinctrl_gpio_direction_output(chip, offset);
> + if (ret)
> + return ret;
> +
> + return pin_control_gpio_set(chip, offset, val);
> +}

But this is a wrong order. First we should submit the value and
only _then_ set the direction. This is not glitch-free in such
an order. Granted, not all HW is well implemented.

--
With Best Regards,
Andy Shevchenko