gpio: sunxi: Don't clear pull settings when setting input
Subsystems (2)
PATCH 1/1 gpio: sunxi: Don't clear pull settings when setting input
sunxi_gpio_set_flags() always programs the pull register when switching a pin to input. When neither GPIOD_PULL_UP nor GPIOD_PULL_DOWN is requested, this writes 0 (pull disabled) and can clobber an existing bias configuration applied via pinctrl.
Only update the pull configuration when a pull-up or pull-down is explicitly requested, leaving existing pull settings unchanged.
Fixes 35ae126c16a6 ("gpio: sunxi: Implement .set_flags")
Signed-off-by James Hilliard <[email protected]>
--- drivers/gpio/sunxi_gpio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/sunxi_gpio.c +2 -1
@@ -301,7 +301,8 @@ static int sunxi_gpio_set_flags(struct udevice *dev, unsigned int offset, pull =1 ; else if (flags & GPIOD_PULL_DOWN) pull =2 ; -sunxi_gpio_set_pull_bank (plat->regs, offset, pull); +if (pull) +sunxi_gpio_set_pull_bank (plat->regs, offset, pull);sunxi_gpio_set_cfgbank (plat->regs, offset,SUNXI_GPIO_INPUT ); }
Signature · 1 line
2.43.0