Rockchip GPIO Number Calculator

Convert between Rockchip pin names (GPIO3_B5), Linux GPIO numbers (109), libgpiod chip/line (gpiochip3 13) and device-tree syntax (&gpio3 RK_PB5). Works for RK3588, RK3576, RK3568, RK3566, RK3399, RK3328, PX30 and RV-series SoCs.

Linux GPIO109
libgpiodgpioset gpiochip3 13=1
Device tree<&gpio3 RK_PB5 GPIO_ACTIVE_HIGH>
pinctrlrockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
sysfs (legacy)echo 109 > /sys/class/gpio/export

How the numbering works

Each bank has 32 lines split into ports A–D of 8 pins. Linux number = bank × 32 + port × 8 + pin (A=0, B=1, C=2, D=3). The libgpiod line offset is the same without the bank term. Read the full walkthrough in Configure GPIO on Rockchip.

Some SoCs don't bond out every line, and small parts may have fewer banks. Check your SoC's datasheet and the board schematic. Pin muxing and IO-domain voltage (1.8 V vs 3.3 V) still apply.

Full GPIO number table

GPIO0 gpiochip0

01234567
A01234567
B89101112131415
C1617181920212223
D2425262728293031

GPIO1 gpiochip1

01234567
A3233343536373839
B4041424344454647
C4849505152535455
D5657585960616263

GPIO2 gpiochip2

01234567
A6465666768697071
B7273747576777879
C8081828384858687
D8889909192939495

GPIO3 gpiochip3

01234567
A96979899100101102103
B104105106107108109110111
C112113114115116117118119
D120121122123124125126127

GPIO4 gpiochip4

01234567
A128129130131132133134135
B136137138139140141142143
C144145146147148149150151
D152153154155156157158159

正在开发瑞芯微产品?

从硬件设计到 Linux、Android 与 AI 集成,为你的瑞芯微项目提供工程支持。