Jetson Nano GPIO calculatin formula

Hi,
Jetson Nano uses tegra186-gpio.h right?

I see in the file,
#define TEGRA186_MAIN_GPIO(port, offset)
((TEGRA186_MAIN_GPIO_PORT_##port * 8) + offset)

what is the formula to calculate sysfs numbers for the GPIO in Jetson nano? What is the offset value we need to use? where can I get the offset value?

no, that’s incorrect.
it’s TX2 series to use the header file “tegra186-gpio.h”; you should check “tegra-gpio.h” header file for Jetson Nano.
there’s formula in the header file,
i.e. #define TEGRA_GPIO(port, offset) ((TEGRA_GPIO_PORT_##port * 8) + offset)

you may also check kernel init messages for the allocation range of the GPIOs.
the offset is zero for tegra-gpio,
for example,

$ dmesg | grep "registered GPIOs"

[    0.541703] gpiochip_setup_dev: registered GPIOs 0 to 255 on device: gpiochip0 (tegra-gpio)
[    0.595180] gpiochip_setup_dev: registered GPIOs 504 to 511 on device: gpiochip1 (max77620-gpio)

Thanks Jerry, that was helpful