gpio: sunxi: Don't clear pull settings when setting input
Subsystems (2)
PATCH v2 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]>
---
Changes v1 -> v2:
- remove no local pull variable
--- drivers/gpio/sunxi_gpio.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpio/sunxi_gpio.c +2 -5
@@ -295,13 +295,10 @@ static int sunxi_gpio_set_flags(struct udevice *dev, unsigned int offset,sunxi_gpio_set_value_bank (plat->regs, offset, value);sunxi_gpio_set_cfgbank (plat->regs, offset,SUNXI_GPIO_OUTPUT ); }else if (flags &GPIOD_IS_IN ) { -u32 pull =0 ; -if (flags &GPIOD_PULL_UP ) - pull =1 ; +sunxi_gpio_set_pull_bank (plat->regs, offset,1 );else if (flags &GPIOD_PULL_DOWN ) - pull =2 ; -sunxi_gpio_set_pull_bank (plat->regs, offset, pull); +sunxi_gpio_set_pull_bank (plat->regs, offset,2 );sunxi_gpio_set_cfgbank (plat->regs, offset,SUNXI_GPIO_INPUT ); }
Signature · 1 line
2.43.0