summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAlex Tran <alex.tran@oss.qualcomm.com>2026-07-24 09:42:28 -0700
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>2026-07-27 13:14:30 +0200
commit67ff4bf723c8bd1f1b10450fa3e8f55762418104 (patch)
tree87254585cbcc5f76c5fcccf252f8a83d068fd960 /drivers/gpio
parent9dc325327babe7f159e84cbe9380a45342da0585 (diff)
gpio: gpio-by-pinctrl: Apply initial value in direction output wrapper
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. 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> Link: https://patch.msgid.link/20260724-gpio-pinctrl-output-set-val-v2-1-cad55d025636@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-by-pinctrl.c18
1 files 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;