Here are my notes for determining the Linux GPIO number from the NVIDIA pin ID.
- Identify NVIDIA’s pin ID. This will be something like Q08 or AA05. There is always a letter (or two letters) and then a number. This is in the NVIDIA pinmux spreadsheet has this value in the GPIO column in the Pin Muxing section (e.g. GPIO3_PG.00 is pin G00).
- Open the proper GPIO header file from the device tree area of the source tree. (` find hardware/nvidia/ -name ‘*gpio*.h’). tegra194-gpio.h is an example.
- Inside the gpio header file, towards the end, you’ll see macros for computing a pin offet. You will find the index of the alpha value. For example I is 8. The formula is : ($alpha * 8) + $offset. Therefore I07 is (8 * 8) + 7 == 71. This is the pin id OFFSET.
- The last step is to examine /sys/kernel/debuig/gpio to find the BASE pin id value from the kernels point of view.
- The final step is to add BASE + OFFSET which gives the Linux pin id number that can be used with the /sys/class/gpio facility.
In tegra194-gpio.h there is this macro:
#define TEGRA194_MAIN_GPIO(port, offset) \
((TEGRA194_MAIN_GPIO_PORT_##port * 8) + offset)
So, the offset for J55 would be
(J * 8) + 55) Since J is 9 the offset is 127.
I hope this helps.