drivers/gpio/gpio-by-pinctrl.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
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.
Signed-off-by: Alex Tran <alex.tran@oss.qualcomm.com>
---
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..fb8440acb31d 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 = pinctrl_gpio_direction_output(chip, offset);
+ if (ret)
+ return ret;
+
+ return pin_control_gpio_set(chip, offset, val);
+}
+
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>
On Thu, 23 Jul 2026 22:20:25 +0200, Alex Tran <alex.tran@oss.qualcomm.com> said: > 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. > > Signed-off-by: Alex Tran <alex.tran@oss.qualcomm.com> > --- Good catch, I'd like to backport it as a bug, can you add the Fixes tag? Bart
On 7/24/2026 12:43 AM, Bartosz Golaszewski wrote: > On Thu, 23 Jul 2026 22:20:25 +0200, Alex Tran <alex.tran@oss.qualcomm.com> said: >> 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. >> >> Signed-off-by: Alex Tran <alex.tran@oss.qualcomm.com> >> --- > Good catch, I'd like to backport it as a bug, can you add the Fixes tag? > > Bart Sure I'll send in v2 with it added. Thanks, Alex
© 2016 - 2026 Red Hat, Inc.