GPIO mapping wrong

Which system do you use? Android, Ubuntu, OOWOW or others?


Which version of system do you use? Khadas official images, self built images, or others?

Linux Khadas 5.4.180 #1.4.2 SMP PREEMPT Wed Jan 4 17:20:58 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

Please describe your issue below:

GPIO kernel mapping does not match GPIO header details shown at VIM4 GPIO Header [Khadas Docs]

Post a console log of your issue below:

grep "GPIO periphs-banks:" /sys/kernel/debug/pinctrl/fe000000.apb4:pinctrl@4000-pinctrl-meson/pinmux-pins
pin 19 (GPIOC_6): GPIO periphs-banks:374
pin 26 (GPIOX_6): GPIO periphs-banks:381
pin 27 (GPIOX_7): GPIO periphs-banks:382
pin 37 (GPIOX_17): GPIO periphs-banks:392
pin 39 (GPIOX_19): GPIO periphs-banks:394
pin 61 (GPIOD_4): GPIO periphs-banks:416
pin 65 (GPIOD_8): GPIO periphs-banks:420
pin 66 (GPIOD_9): GPIO periphs-banks:421
pin 68 (GPIOD_11): GPIO periphs-banks:423
pin 92 (GPIOT_1): GPIO periphs-banks:447
pin 111 (GPIOT_20): GPIO periphs-banks:466
pin 112 (GPIOT_21): GPIO periphs-banks:467
pin 120 (GPIOM_5): GPIO periphs-banks:475
pin 134 (GPIOY_5): GPIO periphs-banks:489
pin 135 (GPIOY_6): GPIO periphs-banks:490
pin 136 (GPIOY_7): GPIO periphs-banks:491
pin 146 (GPIOY_17): GPIO periphs-banks:501
pin 147 (GPIOY_18): GPIO periphs-banks:502

The following kernel pins have no mapping to physical pins on the 40-pin header
374, 381, 382, 392, 394, 416, 421, 423, 475, 489

The following kernel pins are listed in the GPIO header documentation but have no pinmux pin
446, 449, 448, 450, 482, 464, 465, 417. These relate to GPIO header pins 30, 31, 32, 33, 35, 36, 37, 39

These are the pins for some special functions,What do you need these pins for?

Those pins listed are part of the kernel pin-muxing so could be configured for GPIO in the sysfs. Since they do not have any apparent external pin, this is of little use.

I am more concerned that the pins listed on the web page for the GPIO header are not part of the pin-muxing. Is the pin-mux wrong, or is the GPIO header documentation wrong? They do not align.

What I want to do is use the pins available on the GPIO header for either (digital) input or output by exporting them through sysfs.

Furthermore, I want to know if the inputs will change state when grounded, or if they require an input voltage. I’ve had varying results on different hardware platforms.

It doesn’t matter. Please check GPIO number here:

It should work with the GPIO sysfs.

I thank you for your reply, but you’ve directed me to the document (web page) that I said was wrong!
Quite simply, not all the pins listed in that document with GPIO num are actually listed in /sys/kernel/debug/pinctrl/fe000000.apb4:pinctrl@4000-pinctrl-meson/pinmux-pins.

Looking at the web page, it suggests GPIO num to header pin mapping of 447=29, 446=30, 449=31, 448=32, 450=33, but the pinmux GPIOT_0 to GPIOT_8 only shows GPIO num 447, with the others shown as UNCLAIMED.

pin 92 (GPIOT_1): GPIO periphs-banks:447

Am I reading the kernel pinmux file correctly?
Could you test each pin actually functions as an input when configured so in the sysfs?

Need to check driver, but if you just want to use gpio via sysfs you can just ignore this.

Of course, I checked all gpios output list on the documentation, all work as expected. Read also works.

You have issue with gpio sysfs ?