Understanding SYSFS GPIO number for Xavier NX

Hello,

When I saw Xavier NX Pinmux Table, I can’t understand sysfs GPIO number.

According from Pinmux Table, GPIO06 is GPIO3_PCC.03.

As I know, Xavier NX GPIO range is below.
sudo grep tegra-gpio /sys/kernel/debug/gpio
gpiochip1: GPIOs 248-287, parent: platform/c2f0000.gpio, tegra-gpio-aon:
gpiochip0: GPIOs 288-511, parent: platform/2200000.gpio, tegra-gpio:

So, I calculated GPIO number from below formula

Linux GPIO number = (base + (8 * port) + pin)
=> 288 + (8 * 28) + 3 = 515

But, this value is over GPIO number range.

What’s the exact sysfs GPIO number for GPIO3_PCC.03?

hello jtlee,

may I know which Jetpack release version you’re using?

BTW,
where did you obtain 28?

[edit] revise the erroneous.

you may refer to tegra194-gpio.h for the port index for AON GPIO, which is 2.
so, the calculation formula of GPIO3_PCC.03 should be… (248 + (2 * 8) + 3) = 267

Hello, JerryChang

Your guessing is right. I’ve just guessed from Jetson Nano.

Anyway, I tried to access sysfs GPIO, but I failed.
When I run “echo 275 > /sys/class/gpio/export”, it showed below message.

-bash: echo: write error: Device or resource busy

If I checking gpiolist via “sudo cat /sys/kernel/debug/gpio”, I can’t find GPIO 275. Attached file is showing result for “sudo cat /sys/kernel/debug/gpio”
gpiolist.txt (8.9 KB)

Jetpack Version is 4.6.1.

I want to access GPIO06 because GPIO06’s SODIMM number is 130 and our custom board is using this pin.

Thank you.

hello jtlee,

it mean this pin is occupied.
as you can see in pinmux spreadsheets, this sample usage is [Baseboard CAM MUX Sel].
for example,
$public_sources/kernel_src/hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-jakku-rbpcv2-imx219.dtsi

#define CAM_I2C_MUX     TEGRA194_AON_GPIO(CC, 3)

for your own product design and use-case,
please update the device tree accordingly to remove this pin definition.
thanks

Hello JerryChang.

I wonder that GPIO number for PCC.03 is 267.

When I reviewed tegra194-gpio.h, I found below definition.

#define TEGRA194_AON_GPIO_PORT_AA 0
#define TEGRA194_AON_GPIO_PORT_BB 1
#define TEGRA194_AON_GPIO_PORT_CC 2
#define TEGRA194_AON_GPIO_PORT_DD 3
#define TEGRA194_AON_GPIO_PORT_EE 4

And, you mentioned like below.
#define CAM_I2C_MUX TEGRA194_AON_GPIO(CC, 3)

Also, When I run “sudo cat /sys/kernel/debug/gpio”, I found below.
gpio-267 ( |i2c-mux-gpio ) out hi

So, I guessed that GPIO3_PCC.03 is 248 + (2 * 8) + 3 = 267.

Please confirm it.

Thank you.

my bad, I misread the port index of CC. you’re correct that GPIO3_PCC.03 is 248 + (2 * 8) + 3 = 267.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.