On Linux 5.10 (Jetpack 5), the GPIO numbers and sysfs names are completely different than earlier (I was previously using Linux 4.9). I’m using Xavier AGX.
The GPIO numbers changed. E.g. pin B8 used to be number 437, now it is 454. There doesn’t seem to be any straightforward mapping between the old and new numbers.
The sysfs directory name is now PXX.NN, where XX is 2 or 3 letters and NN is a 2 digit number. E.g. echo 499 > export creates a directory called PZ.07 instead of gpio499. This is the first platform I’ve ever seen that names things this way. I understand that the sysfs interface is deprecated, however it’s still functional, just with (seemingly arbitrary) name changes.
Questions: Is it possible to revert these changes? Why did this change? Will it change again? I am not asking how to map between pins and GPIOs, I can do that through /sys/kernel/debug/gpio and the pinmux spreadsheet.
To help run user land application from JP4 to JP5, is it possible to make JP5 use the same GPIO number as JP4? I have already copied the same pinmux.cfg file that is used in JP4, but numbers still look different:
When booting my custom board into JP4:
$ sudo dmesg | grep gpiochip
[ 0.909357] gpio gpiochip0: gpio-line-names specifies 210 line names but there are 224 lines on the chip
[ 0.910792] gpiochip_setup_dev: registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio)
[ 0.917748] gpio gpiochip1: gpio-line-names specifies 30 line names but there are 40 lines on the chip
[ 0.918125] gpiochip_setup_dev: registered GPIOs 248 to 287 on device: gpiochip1 (tegra-gpio-aon)
[ 1.059489] gpiochip_setup_dev: registered GPIOs 240 to 247 on device: gpiochip2 (max77620-gpio)
When booting the same board to JP5:
$ sudo dmesg | grep gpiochip
[ 3.348027] gpiochip0: registered GPIOs 504 to 511 on max77620-gpio
[ 4.851219] gpiochip1: registered GPIOs 335 to 503 on tegra194-gpio
[ 4.857926] gpiochip2: registered GPIOs 305 to 334 on tegra194-gpio-aon
eg: for tegra-gpio-aon, JP4 has GPIOs 248 to 287, but JP5 has GPIOs 305 to 334. Not only the numbers are different, the ranges are also different.
If there is no way to configure JP5 GPIO use the same numbering as JP4. Is there a simple number translator? We can then update our user land application to talk to the new GPIO numbers. In JP4, user land application talks to GPIO number 288, 291, 253, 254, 256, 257, 417, 420, 489, 490. What should be the corresponding numbers in JP5?
since there’re base changes, for example, registered GPIOs ... on tegra194-gpio/tegra194-gpio-aon
you may adding 335 - 288 = 47 to those tegra194-gpio GPIO numbers,
please try adding 305 - 248 = 57 to those tegra194-gpio-aon GPIO numbers.
The GPIO range is also different. eg, for tegra194-gpio, based on dmesg, in JP 4, registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio) so there are 224 lines, but in JP 5 gpiochip1: registered GPIOs 335 to 503 on tegra194-gpio so there are 169 lines. If I take gpio 489 that I used in JP4 and add the base change 47, it becomes 536, that is already outside the JP5’s upper 503. Am I missing something?
BTW, is there a way to configure JP5 GPIO number scheme to match JP4, so that we don’t have to change the user land application?
With exact same hardware, while booting into JP4 and JP5 gives different number of GPIO lines? eg: gpio-aon has 40 lines (248 to 287) in JP4.6 and 30 lines (305 to 334) in JP5?
what’s the actual use-case?
there’s kernel update about GPIOs, you may see header file tegra194-gpio.h to compare the difference between k-4.9 and k-5.10.
as I mentioned previously.
please see-also comment #8 to identify its GPIO number in JP-5.