How do I map signal names to GPIO numbers?

Let’s say I’m looking at the carrier board description (latest version, May 1, 2017)

Let’s say I see a signal that I’d like to use as a GPIO. For example, ‘GPIO15_AP2MDM_READY’ which is on pin 6 of the 30-pin L26 header.

How do I translate the name “GPIO15_AP2MDM_READY” into the actual GPIO number to use for /sys/class/gpio/export?
If I try to use “15” (as in the “GPIO15” name) I get an error:

nvidia@tegra-ubuntu:~$ sudo bash
root@tegra-ubuntu:~# echo 15 > /sys/class/gpio/export
bash: echo: write error: Invalid argument

Is there another document that actually documents how to go about this?

Also, is there a C interface or IOCTL interface to the GPIO that may be faster (lower overhead) than the sysfs-based file descriptor interface?

hello snarky,

please refer to this topic for more details.
https://devtalk.nvidia.com/default/topic/1003613/jetson-tx2/gpio-doesn-t-work-/post/5125910/#5125910

for example.
please search GPIO15_AP2MDM_READY in the Jetson-TX2-Generic-Customer-Pinmux.xlsm (from https://developer.nvidia.com/embedded/dlc/jetson-tx2-module-pinmux), you should mapping it to GPIO3_PBB.00.
since PBB00 belong to GPIOs 320-511, platform/2200000.gpio, tegra-gpio.
here’s formula to calculate the actual gpio num = (21*8)+320 = 488.
thanks

Hello JerryChang,

What’s the actual gpio num of GPIO3_PAA.02 ?

What’s the relationship between

#define TEGRA_MAIN_GPIO_PORT_BB 21
#define TEGRA_MAIN_GPIO_PORT_CC 22
#define TEGRA_MAIN_GPIO_PORT_DD 23

and

#define TEGRA_AON_GPIO_PORT_AA 5
#define TEGRA_AON_GPIO_PORT_EE 6
#define TEGRA_AON_GPIO_PORT_FF 7

and

#define TEGRA_PIN_BASE_ID_A 0
#define TEGRA_PIN_BASE_ID_B 1
#define TEGRA_PIN_BASE_ID_C 2
#define TEGRA_PIN_BASE_ID_D 3
#define TEGRA_PIN_BASE_ID_E 4
#define TEGRA_PIN_BASE_ID_F 5
#define TEGRA_PIN_BASE_ID_G 6
#define TEGRA_PIN_BASE_ID_H 7
#define TEGRA_PIN_BASE_ID_I 8
#define TEGRA_PIN_BASE_ID_J 9
#define TEGRA_PIN_BASE_ID_K 10
#define TEGRA_PIN_BASE_ID_L 11
#define TEGRA_PIN_BASE_ID_M 12
#define TEGRA_PIN_BASE_ID_N 13
#define TEGRA_PIN_BASE_ID_O 14
#define TEGRA_PIN_BASE_ID_P 15
#define TEGRA_PIN_BASE_ID_Q 16
#define TEGRA_PIN_BASE_ID_R 17
#define TEGRA_PIN_BASE_ID_S 18
#define TEGRA_PIN_BASE_ID_T 19
#define TEGRA_PIN_BASE_ID_U 20
#define TEGRA_PIN_BASE_ID_V 21
#define TEGRA_PIN_BASE_ID_W 22
#define TEGRA_PIN_BASE_ID_X 23
#define TEGRA_PIN_BASE_ID_Y 24
#define TEGRA_PIN_BASE_ID_Z 25
#define TEGRA_PIN_BASE_ID_AA 26
#define TEGRA_PIN_BASE_ID_BB 27
#define TEGRA_PIN_BASE_ID_CC 28
#define TEGRA_PIN_BASE_ID_DD 29
#define TEGRA_PIN_BASE_ID_EE 30
#define TEGRA_PIN_BASE_ID_FF 31

?

here is a tutorial in order to get the actual gpio number