How to find out GPIO03 is which gpiochip and number?

i want find out nx gpio03 is which chip, i want control /sys/class/gpio

hello lorilovebird,

please access pinmux spreadsheets to check that.
you may also refer to Topic 145524 for an example,
thanks

1 Like

however,i found the gpio is GPIO3_PCC.01 , what is CC mean?

hello lorilovebird,

please refer to L4T sources package for public release sources.
you may check the header file for the details of Tegra’s GPIO IDs.
for example,
$L4T_Sources/r32.4.3/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/dt-bindings/gpio/tegra186-gpio.h

/* GPIOs implemented by main GPIO controller */
...
    #define TEGRA_MAIN_GPIO_PORT_CC 22

you should also check your kernel init messages for the allocation ranges for these GPIO chips, such as MAIN, AON,… etc
for example,

nvidia@nvidia-desktop:~$ dmesg | grep "registered GPIOs"
[    0.778328] gpiochip_setup_dev: registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio)
[    0.786632] gpiochip_setup_dev: registered GPIOs 248 to 287 on device: gpiochip1 (tegra-gpio-aon)
[    0.934262] gpiochip_setup_dev: registered GPIOs 240 to 247 on device: gpiochip2 (max77620-gpio)

according to the formula below
#define TEGRA_MAIN_GPIO(port, offset) ((TEGRA_MAIN_GPIO_PORT_##port * 8) + offset)
that GPIO3_PCC.01 means port CC with offset 1, here’s the GPIO number calculation results.
i.e. 288 + ((22* 8) + 1 ) = 465

1 Like

It is working ,thankyou