Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: single: fix bias pull up/down handling in pin_config_set

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>

authored by

Chi Zhang and committed by
Linus Walleij
236152dd 694a97ee

+3 -1
+3 -1
drivers/pinctrl/pinctrl-single.c
··· 589 589 /* 4 parameters */ 590 590 case PIN_CONFIG_BIAS_PULL_DOWN: 591 591 case PIN_CONFIG_BIAS_PULL_UP: 592 - if (arg) 592 + if (arg) { 593 593 pcs_pinconf_clear_bias(pctldev, pin); 594 + data = pcs->read(pcs->base + offset); 595 + } 594 596 fallthrough; 595 597 case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 596 598 data &= ~func->conf[i].mask;