[PATCH 3/3] pinctrl: single: unify pinconf offset mapping with pinmux

Billy Tsai
2025-12-22T12:05:41Z

Use the same register offset calculation for pinconf as pinmux to
properly handle bit-per-mux configurations. Ensures consistent and
correct offset mapping for pin configuration operations.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
drivers/pinctrl/pinctrl-single.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index e65ae737b4c5..aaf830315c5d 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -505,7 +505,8 @@ static int pcs_pinconf_get(struct pinctrl_dev *pctldev,
continue;
}

- offset = pin * (pcs->width / BITS_PER_BYTE);
+ /* Use the same offset mapping as pinmux (handles bit-per-mux) */
+ offset = pcs_pin_reg_offset_get(pcs, pin);
data = pcs->read(pcs->base + offset) & func->conf[i].mask;
switch (func->conf[i].param) {
/* 4 parameters */
@@ -573,7 +574,8 @@ static int pcs_pinconf_set(struct pinctrl_dev *pctldev,
if (param != func->conf[i].param)
continue;

- offset = pin * (pcs->width / BITS_PER_BYTE);
+ /* Use the same offset mapping as pinmux (handles bit-per-mux) */
+ offset = pcs_pin_reg_offset_get(pcs, pin);
data = pcs->read(pcs->base + offset);
arg = pinconf_to_config_argument(configs[j]);
switch (param) {

--
2.34.1