How to calculate gpionum in /sys/class/gpio/export

Hi, NV team:
I checked Jetson_AGX_Devkit_Pinmux_configuration_Tempalte.xlsm, GPIO25_VDD_SYS_EN is PM.05,so i think gpio number is m(12)*32+5 = 389.So i echo 389 > /sys/class/gpio/export, and then it works.

Then i try to use gpio CAM2_MCLK04, fist to config CAM2_MCLK04 to gpio in Jetson_AGX_Devkit_Pinmux_configuration_Tempalte.xlsm .And then genernic *.cfg file flash Xavier. CAM2_MCLK04 is PQ.5, so gpio num is Q(16)*32 +5 = 517. But when i echo 517 > /sys/class/gpio/export ,it returns “bash: echo: write error: Invalid argument” .

Any one can tell me how to calculate the gpio number?

Well, i got it. sould be port * 8 +offset + 288, Q(16)*8 +5 +288 = 421