Gpioset issuse beteween different Jetpack

we use the same gpio pin with different Jetpack, there is a strange thing.
This pin is configured as output high in pinmux.
When use Jepack4(r3273), using

gpioset gpiochip1 2=0

the pin will not become low and only with

gpioset -m time -s 1 gpiochip1 2=0

it will set to low for 1 second and back to high at end. This is normal because when gpioset over it will release this pin and put it back to original status.

But in Jetpack5(r3560), we use the same cmd

gpioset -m time -s 1 gpiochip2 2=0 (same chip num changed to 2)

this pin will be low forever except set it to high
It seems in this jetpack, the gpio will not get back to original status when use gpioset to control it.

Why this happens?

Thanks!

Hi 854053437,

Yes, your observation is reasonable.
On r32.7.3, after gpioset exits, the pin behavior can look like it returns to the original pinmux-defined state.
On r35.6.0, that behavior should not be relied on. gpioset only guarantees the line state while the process is alive; after release, whether the pin appears to “go back” depends on the Tegra GPIO/pinctrl implementation of that release, and r35 no longer behaves like r32 in this regard.
Also, with libgpiod, the pinmux must already be correctly configured in MB1/BCT; it is not automatically restored by the user-space GPIO tool.

HI, Kevin
Thanks for explaination. May I know how to find the source code about Tegra GPIO/pinctrl to set this result

Thanks!

You can check the Jetson Linux kernel source for this behavior.
For JP5 / r35.x, the main files are drivers/gpio/gpio-tegra186.c and drivers/pinctrl/tegra/pinctrl-tegra186.c. You can get the source from the Jetson Linux source package or sync it with source_sync.sh.

Thanks !