[PATCH v2 4/4] pinctrl: bcm: Add missing SGPIO entries to the BCM2712 AON tables

From: Xiaolei Wang

Date: Fri Nov 13 2026 - 01:30:27 EST


The BCM2712 AON controller describes six SGPIO pins as pin 32..37, but
the AON function tables stop at the last normal GPIO: pin 16 for C0 and
pin 14 for D0. Both are indexed by pin number, so dumping the pin list
walks past the end of the table:

A=/sys/kernel/debug/pinctrl/107d510700.pinctrl-aon-pinctrl-bcm2712
cat $A/pins

pinctrl_pins_show() hands desc->pins[i].number to pin_dbg_show(), so the
list jumps from the last GPIO pin to pin 32, where a valid mux bit makes
brcmstb_pinctrl_fsel_get() evaluate pin_funcs[32].funcs[] outside the
array. The set path walks the same table for any DT node that assigns a
function to aon_sgpio0..5.

Add the entries as pin 32..37 to match pin_regs[] and pins[]. The values
are from the downstream driver (rpi-6.12.y), which keeps separate C0 and
D0 tables; they differ on the HDMI1 and PMIC pins, where D0 selects
vc_i2c0 and vc_i2c3 while C0 uses vc_i2c4 and vc_i2c5. The empty indices
in between are harmless, their mux bit is zero.

Tested on a Raspberry Pi 5 (C0): "cat $A/pins" triggers a KASAN
global-out-of-bounds report in brcmstb_pctl_pin_dbg_show() with the
driver as-is. The D0 table is not runtime tested.

Fixes: 657cbf9b24ba ("pinctrl: bcm: Add STB family pin controller driver")
Cc: Jonathan Bell <jonathan@xxxxxxxxxxxxxxx>
Cc: Phil Elwell <phil@xxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Xiaolei Wang <wangxiaolei01@xxxxxxxxxxx>
---
drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c b/drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c
index 752b78e2c0d8..1720c220cf3e 100644
--- a/drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c
+++ b/drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c
@@ -510,6 +510,12 @@ static const struct brcmstb_pin_funcs bcm2712_c0_aon_gpio_pin_funcs[] = {
BRCMSTB_PIN(14, bsc_m1, uart0, vc_uart0, uui, vc_spi5, arm_jtag, vc_uart2, vc_i2c3),
BRCMSTB_PIN(15, ir_in, aon_fp_4sec_resetb, vc_uart0, pm_led_out, ctl_hdmi_5v, aon_pwm, aon_gpclk, _),
BRCMSTB_PIN(16, aon_cpu_standbyb, gpclk0, pm_led_out, ctl_hdmi_5v, vc_pwm0, usb_pwr, aud_fs_clk0, _),
+ BRCMSTB_PIN(32, hdmi_tx0_bsc, hdmi_tx0_auto_i2c, bsc_m0, vc_i2c0, _, _, _, _),
+ BRCMSTB_PIN(33, hdmi_tx0_bsc, hdmi_tx0_auto_i2c, bsc_m0, vc_i2c0, _, _, _, _),
+ BRCMSTB_PIN(34, hdmi_tx1_bsc, hdmi_tx1_auto_i2c, bsc_m1, vc_i2c4, ctl_hdmi_5v, _, _, _),
+ BRCMSTB_PIN(35, hdmi_tx1_bsc, hdmi_tx1_auto_i2c, bsc_m1, vc_i2c4, _, _, _, _),
+ BRCMSTB_PIN(36, avs_pmu_bsc, bsc_m2, vc_i2c5, ctl_hdmi_5v, _, _, _, _),
+ BRCMSTB_PIN(37, avs_pmu_bsc, bsc_m2, vc_i2c5, _, _, _, _, _),
};

static const struct brcmstb_pin_funcs bcm2712_c0_gpio_pin_funcs[] = {
@@ -585,6 +591,12 @@ static const struct brcmstb_pin_funcs bcm2712_d0_aon_gpio_pin_funcs[] = {
BRCMSTB_PIN(12, uart1, vc_uart2, vc_uart0, vc_spi0, usb_pwr, vc_uart2, vc_spi3, _),
BRCMSTB_PIN(13, bsc_m1, vc_uart0, uui, vc_spi0, arm_jtag, vc_uart2, vc_i2c3, _),
BRCMSTB_PIN(14, bsc_m1, aon_gpclk, vc_uart0, uui, vc_spi0, arm_jtag, vc_uart2, vc_i2c3),
+ BRCMSTB_PIN(32, hdmi_tx0_bsc, hdmi_tx0_auto_i2c, bsc_m0, vc_i2c0, _, _, _, _),
+ BRCMSTB_PIN(33, hdmi_tx0_bsc, hdmi_tx0_auto_i2c, bsc_m0, vc_i2c0, _, _, _, _),
+ BRCMSTB_PIN(34, hdmi_tx1_bsc, hdmi_tx1_auto_i2c, bsc_m1, vc_i2c0, ctl_hdmi_5v, _, _, _),
+ BRCMSTB_PIN(35, hdmi_tx1_bsc, hdmi_tx1_auto_i2c, bsc_m1, vc_i2c0, _, _, _, _),
+ BRCMSTB_PIN(36, avs_pmu_bsc, bsc_m2, vc_i2c3, ctl_hdmi_5v, _, _, _, _),
+ BRCMSTB_PIN(37, avs_pmu_bsc, bsc_m2, vc_i2c3, _, _, _, _, _),
};

static const struct brcmstb_pin_funcs bcm2712_d0_gpio_pin_funcs[] = {
--
2.34.1