I think I figured it out. What was confusing me was that the port value is a letter and corresponds to a number.
A = 0, B=1, C=2, D=3 … AA = 26, BB = 27 and so on.
Take that corresponding number and multiply it by 8.
Then add the offset and you’ll end up with the sysfs
gpio
number.
Example:
TEGRA_GPIO(BB, 0)
BB = 27
27 * 8 + 0 (no offset) = 216
Therefore TEGRA_GPIO(BB, 0) = gpio216
Another example:
TEGRA_GPIO(J, 7)
J = 9
9 * 8 + 7 = 79
Therefore TEGRA_GPIO(J, 7) = gpio79
To determine the device tree mapping from the physical pin number or signal side, look at the pinmux table, look for the Jetson Nano signal name that corresponds to the physical pin number then look at the GPIO column and the values after “GPIO#_P” should give you the (port, offset).
Example:
GPIO3_PBB.00 is TEGRA_GPIO(BB, 0)
Does this all sound correct?
Thanks
Jamie