Confused to Camera Powerdown GPIO

I am modifying the device tree for HDMI input. I searched the datasheet and found that the CAM0_PWDN and CAM1_PWDN pin number is 114 and 120. But I see that the pin number of device tree file tegra186-camera-lanai-rbpcv2-imx219.dtsi is set to

#define CAM0_PWDN   TEGRA_MAIN_GPIO(N, 0)
#define CAM1_PWDN   TEGRA_MAIN_GPIO(N, 3)

Then
#define TEGRA_MAIN_GPIO_PORT_N 13

#define TEGRA_MAIN_GPIO(port, offset) \
	((TEGRA_MAIN_GPIO_PORT_##port * 8) + offset)

so
N*8+0 = 104 is not 114.
N*8+3 = 107 is not 120. Could you explain it to me?

hello yunhuzhou,

that’s incorrect. you’ll also need to add the GPIO allocation range.
for example,

# dmesg | grep "registered GPIOs"
[    0.467123] gpiochip_setup_dev: registered GPIOs 320 to 511 on device: gpiochip0 (tegra-gpio)

taking this GPIO3_PR.00 as an example,
#define CAM0_PWDN TEGRA_MAIN_GPIO(R, 0)
#define TEGRA_MAIN_GPIO_PORT_R 17
#define TEGRA_MAIN_GPIO(port, offset) ((TEGRA_MAIN_GPIO_PORT_##port * 8) + offset)

the gpio number for this pin GPIO3_PR.00 is… ((17 * 8) + 0) + 320 = 456

furthermore,
you may double check sysnode for confirmation.

# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 320-511, parent: platform/2200000.gpio, tegra-gpio:
 gpio-456 (                    |cam_pwdn_gpio       ) out lo    

for more details.
please see-also developer guide, To check the GPIO number.

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