GPIO8 mapping on Linux driver

Hi, May I confirm that GPIO8 map to Linux driver will be /dev/gpiochip0, BOARD_SELECT_LINE is 130? It’s GPIO pin by default so I don’t need configure .dts file, correct?
Thanks

hello lynn9a,

that’s incorrect. please check via kernel init for all allocated GPIOs.
for example,

$ dmesg | grep gpiochip_setup_dev
[    0.768588] gpiochip_setup_dev: registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio)
[    0.777389] gpiochip_setup_dev: registered GPIOs 248 to 287 on device: gpiochip1 (tegra-gpio-aon)
[    0.924518] gpiochip_setup_dev: registered GPIOs 240 to 247 on device: gpiochip2 (max77620-gpio)

please also see developer guide, To check the GPIO number for reference,
thanks

Hi
Thanks for info, GPIO8 is signal name, it’s GPIO3_PQ02, pin#208. I did use the way from the web you mentioned to get this result and since I couldn’t measure whether it’s high or low, so need confirm with you. Can you confirm it’s on gpioctrl0, line 130?
Thanks

hello lynn9a,

what’s line-130 here means? it’s not the correct GPIO number if so.

please refer to tegra194-gpio.h for the Xavier NX’s GPIOs.
for example,

#define TEGRA194_MAIN_GPIO_PORT_Q 16
...
#define TEGRA194_MAIN_GPIO(port, offset) \
  	((TEGRA194_MAIN_GPIO_PORT_##port * 8) + offset)

the GPIO number of GPIO3_PQ02 is… ((16*8) + 2 + 288) = 418

Hi
From this page:

GPIO08, it’s on pin 208, its name is GPIO3_PQ02, when I write gpio driver, I need give which gpio chip and select line number, since it’s pin208, should be /dev/gpiochip0, select line number = 16 x 8 + 2=130, offset is 0, correct?
Thanks

hello lynn9a,

no, you’ll still need to check the allocated range by kernel.
for example,

the correct GPIO number of GPIO3_PQ02 is… ((16*8) + 2 + 288) = 418
thanks

Hello, Jerry,

My code is an Linux app, which need to open gpio device (chip) first, then the gpio number is supplied for ioctl calls for gpio output control. This is the gpio number I was asking. It seems to me that since the device(chip0) already open, the gpio number should not include the base port number of the chip0 (which is 288 in this case). So the gpio number should be (16*8) + 2 = 130 should be used for ioctl calls. Please advice.
thanks,

hello lynn9a,

why don’t you check GPIO pin allocation ranges from your side.

dmesg|grep gpiochip_setup_dev
[ 0.764080] gpiochip_setup_dev: registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio)
[ 0.770912] gpiochip_setup_dev: registered GPIOs 248 to 287 on device: gpiochip1 (tegra-gpio-aon)
[ 0.921533] gpiochip_setup_dev: registered GPIOs 240 to 247 on device: gpiochip2 (max77620-gpio)

I was able to test GPIO11, which name is GPIO3_PQ06, I used gpiochip0, line select 16*8+6=134, set high and low, I measured the voltage which is consistent with my driver setting. GPIO08 which name is GPIO3_PQ02, should be 4 number away from GPIO3_PQ06, correct?
Thanks

hello lynn9a,

that’s correct if you controlling the GPIO before gpiochip_setup_dev allocation.