]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: single: fix bias pull up/down handling in pin_config_set
authorChi Zhang <chizhang@asrmicro.com>
Thu, 7 Aug 2025 06:20:38 +0000 (14:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:34:02 +0000 (15:34 -0500)
[ Upstream commit 236152dd9b1675a35eee912e79e6c57ca6b6732f ]

In the pin_config_set function, when handling PIN_CONFIG_BIAS_PULL_DOWN or
PIN_CONFIG_BIAS_PULL_UP, the function calls pcs_pinconf_clear_bias()
which writes the register. However, the subsequent operations continue
using the stale 'data' value from before the register write, effectively
causing the bias clear operation to be overwritten and not take effect.

Fix this by reading the 'data' value from the register after calling
pcs_pinconf_clear_bias().

This bug seems to have existed when this code was first merged in commit
9dddb4df90d1 ("pinctrl: single: support generic pinconf").

Signed-off-by: Chi Zhang <chizhang@asrmicro.com>
Link: https://lore.kernel.org/20250807062038.13610-1-chizhang@asrmicro.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/pinctrl-single.c

index 2ec599e383e4b2d463725b8baf4bb8bbcdc4c9f1..1df0a00ae1ee88be8229604db844b3f25ef6ac7d 100644 (file)
@@ -589,8 +589,10 @@ static int pcs_pinconf_set(struct pinctrl_dev *pctldev,
                        /* 4 parameters */
                        case PIN_CONFIG_BIAS_PULL_DOWN:
                        case PIN_CONFIG_BIAS_PULL_UP:
-                               if (arg)
+                               if (arg) {
                                        pcs_pinconf_clear_bias(pctldev, pin);
+                                       data = pcs->read(pcs->base + offset);
+                               }
                                fallthrough;
                        case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
                                data &= ~func->conf[i].mask;