Rockpi4/hardware/gpio
ROCK Pi 4 > Hardware > GPIO
Rockchip RK3399 GPIO has 5 banks, GPIO0 to GPIO4, each bank has 32pins, naming as below:
GPIO0_A0 ~ A7 GPIO0_B0 ~ B7 GPIO0_C0 ~ C7 GPIO0_D0 ~ D7 GPIO1_A0 ~ A7 .... GPIO1_D0 ~ D7
For Rockchip 4.4 kernel, the GPIO number can be calculated as below, take GPIO4_D5(PIN22 on 40PIN GPIO) as an example:
GPIO4_D5 = 32*4 + 8*3 + 5 = 157
To set GPIO4_D5 output
cd /sys/class/gpio echo 157 > export cd gpio157 echo out > direction echo 1 > value # output high echo 0 > value # output low