mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper
@ 2026-08-10 18:58 Alex Tran
  2026-08-10 20:02 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alex Tran @ 2026-08-10 18:58 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, Alex Tran, Dan Carpenter,
	AKASHI Takahiro, Andy Shevchenko, Bartosz Golaszewski

Apply the requested initial value via the existing gpio set
wrapper, so that the pin is not left at its previous level.
Afterwards, configure the gpio pin as output.

Fixes: 7671f4949a6c ("gpio: gpio-by-pinctrl: add pinctrl based generic GPIO driver")
Signed-off-by: Alex Tran <alex.tran@oss.qualcomm.com>
---
Changes in v3:
- Apply initial value before configuring as output
- Link to v2: https://patch.msgid.link/20260724-gpio-pinctrl-output-set-val-v2-1-cad55d025636@oss.qualcomm.com

Changes in v2:
- Add fixes tag
- Link to v1: https://patch.msgid.link/20260723-gpio-pinctrl-output-set-val-v1-1-ed4477dcd3e1@oss.qualcomm.com

To: Linus Walleij <linusw@kernel.org>
To: Bartosz Golaszewski <brgl@kernel.org>
To: Dan Carpenter <error27@gmail.com>
To: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/gpio/gpio-by-pinctrl.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-by-pinctrl.c b/drivers/gpio/gpio-by-pinctrl.c
index 7d7c48ce5163..f54efd635f13 100644
--- a/drivers/gpio/gpio-by-pinctrl.c
+++ b/drivers/gpio/gpio-by-pinctrl.c
@@ -27,12 +27,6 @@ static int pin_control_gpio_get_direction(struct gpio_chip *gc, unsigned int off
 	return GPIO_LINE_DIRECTION_IN;
 }
 
-static int pin_control_gpio_direction_output(struct gpio_chip *chip,
-					     unsigned int offset, int val)
-{
-	return pinctrl_gpio_direction_output(chip, offset);
-}
-
 static int pin_control_gpio_get(struct gpio_chip *chip, unsigned int offset)
 {
 	unsigned long config;
@@ -55,6 +49,18 @@ static int pin_control_gpio_set(struct gpio_chip *chip, unsigned int offset,
 	return pinctrl_gpio_set_config(chip, offset, config);
 }
 
+static int pin_control_gpio_direction_output(struct gpio_chip *chip,
+					     unsigned int offset, int val)
+{
+	int ret;
+
+	ret = pin_control_gpio_set(chip, offset, val);
+	if (ret)
+		return ret;
+
+	return pinctrl_gpio_direction_output(chip, offset);
+}
+
 static int pin_control_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;

---
base-commit: 4539944e515183668109bdf4d0c3d7d228383d88
change-id: 20260723-gpio-pinctrl-output-set-val-676008568122

Best regards,
--  
Alex Tran <alex.tran@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper
  2026-08-10 18:58 [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper Alex Tran
@ 2026-08-10 20:02 ` Andy Shevchenko
  2026-08-11  6:41 ` Linus Walleij
  2026-08-11 14:08 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-08-10 20:02 UTC (permalink / raw)
  To: Alex Tran
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Dan Carpenter, AKASHI Takahiro, Bartosz Golaszewski

On Mon, Aug 10, 2026 at 11:58:17AM -0700, Alex Tran wrote:
> Apply the requested initial value via the existing gpio set

GPIO

> wrapper, so that the pin is not left at its previous level.
> Afterwards, configure the gpio pin as output.

GPIO

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper
  2026-08-10 18:58 [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper Alex Tran
  2026-08-10 20:02 ` Andy Shevchenko
@ 2026-08-11  6:41 ` Linus Walleij
  2026-08-11 14:08 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2026-08-11  6:41 UTC (permalink / raw)
  To: Alex Tran
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Dan Carpenter,
	AKASHI Takahiro, Andy Shevchenko, Bartosz Golaszewski

On Mon, Aug 10, 2026 at 8:59 PM Alex Tran <alex.tran@oss.qualcomm.com> wrote:

> Apply the requested initial value via the existing gpio set
> wrapper, so that the pin is not left at its previous level.
> Afterwards, configure the gpio pin as output.
>
> Fixes: 7671f4949a6c ("gpio: gpio-by-pinctrl: add pinctrl based generic GPIO driver")
> Signed-off-by: Alex Tran <alex.tran@oss.qualcomm.com>

Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper
  2026-08-10 18:58 [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper Alex Tran
  2026-08-10 20:02 ` Andy Shevchenko
  2026-08-11  6:41 ` Linus Walleij
@ 2026-08-11 14:08 ` Bartosz Golaszewski
  2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-08-11 14:08 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Alex Tran
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Dan Carpenter,
	AKASHI Takahiro, Andy Shevchenko


On Mon, 10 Aug 2026 11:58:17 -0700, Alex Tran wrote:
> Apply the requested initial value via the existing gpio set
> wrapper, so that the pin is not left at its previous level.
> Afterwards, configure the gpio pin as output.
> 
> 

Applied, thanks!

[1/1] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper
      https://git.kernel.org/brgl/c/408866669ce01b8f2111afdea2c13d15a8960bff

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-11 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 18:58 [PATCH v3] gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper Alex Tran
2026-08-10 20:02 ` Andy Shevchenko
2026-08-11  6:41 ` Linus Walleij
2026-08-11 14:08 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®