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

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.