From: James Hilliard <james.hilliard1@gmail.com>
To: u-boot@lists.denx.de
Cc: James Hilliard <james.hilliard1@gmail.com>,
Tom Rini <trini@konsulko.com>,
Andre Przywara <andre.przywara@arm.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Simon Glass <sjg@chromium.org>
Subject: [PATCH v2 1/1] gpio: sunxi: Don't clear pull settings when setting input
Date: Sat, 7 Feb 2026 12:48:00 -0700 [thread overview]
Message-ID: <20260207194801.4128903-1-james.hilliard1@gmail.com> (raw)
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 <james.hilliard1@gmail.com>
---
Changes v1 -> v2:
- remove no local pull variable
---
drivers/gpio/sunxi_gpio.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index 094c45a6927..9acf1c2ecab 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -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);
}
--
2.43.0
reply other threads:[~2026-02-07 21:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260207194801.4128903-1-james.hilliard1@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=andre.przywara@arm.com \
--cc=jernej.skrabec@gmail.com \
--cc=samuel@sholland.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox