[TX2][GPIO] How can we set gpio high for GPIO7_TOUCH_RST?

Hi Nvidia:
We want to set touch panel gpio reset to high.
But we can’t understand how to set it by device tree or code.

We see GPIO7_TOUCH_RST is GPIO3_PS.03 in Jetson-TX2-Generic-Customer-Pinmux-Template.xlsm.
How can we know gpio number for GPIO3_PS.03?

DarkHou

hello dark.hou,

you might refer to Jetson TX2 Platform Adaptation and Bring-Up Guide, and check the [GPIO Changes] session for the examples to calculate the GPIO numbers.

there are some APIs to control GPIOs.
$l4t-r32.1/public_sources/kernel/kernel-4.9/include/linux/gpio.h

you may also refer to camera sensor drivers for the usage.
$l4t-r32.1/public_sources/kernel/nvidia/drivers/media/i2c/imx185.c

BTW, here’s documentation Jetson TX2 Pinmux and GPIO Configuration for your reference.
thanks

Hi dark.hou,

Additionaly to the info provided by JerryChang you can set a GPIO to high through a device tree definition. You can take the following code as reference, this uses the gpio-controller node (see https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt). GPIOs for the TX2 are defined in hardware/nvidia/soc/tegra/kernel-include/dt-bindings/gpio/tegra186-gpio.h.

gpio@2200000 {
    camera-enable-output {
        gpio-hog;
        gpios = <TEGRA_MAIN_GPIO(X, 6) 0>;
        output-high;
        label = "camera-enable-output";
        status = "okay";
    };
};

To map a GPIO from schematics to the corresponding device tree definition you’ll need the pinmux spreadsheet https://developer.nvidia.com/embedded/dlc/jetson-tx2-series-module-pinmux. For example, in the definition above the gpio478 (GPIO3_PX.06) is being set to high.

Hope this info helps.

Regards,

We can set GPIO7_TOUCH_RST now.
Thanks you very much.

Hi,
I need to configure and read gpio pins using java program…does anybody know.