Jetson NX GPIO3_PQ.03 control question

Hello,

No. 124 GPIO of nx does not work.
The development environment is as follows.

  • Soc - NX
  • Jetpack - 4.5.1

dts defines it as:

	i2c@31e0000 {
		clock-frequency = <100000>;
		
		lt6911uxc_b@2b {
			compatible = "lontium,lt6911uxc";
			reg = <0x2b>;
			status = "okay";
			devnode = "video1";
			/* Reset */
			reset-gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 3) GPIO_ACTIVE_LOW>;
			/* Interrupt */
			interrupt-parent = <&tegra_main_gpio>;
			interrupts = <TEGRA194_MAIN_GPIO(Q, 5) GPIO_ACTIVE_LOW>;

			port@0 {
				ret = <0>;
				status = "okay";
				hdmi2csi_lt6911_out1: endpoint {
					status = "okay";
					port-index = <4>;
					bus-width = <4>;
					remote-endpoint = <&hdmi2csi_csi_in1>;
				};
			};
		};		
	};

In the driver code I control like this

	gpio = of_get_named_gpio(node, "reset-gpio", 0);
	if (gpio < 0)
	{
		if (gpio == -EPROBE_DEFER)
		{
			dev_err(&client->dev, "reset-gpio read failed: (%d)\n",
					gpio);
			goto prop_err;
		}
		dev_info(&client->dev, "reset-gpio not found, ignoring\n");
	}
	pdata->reset_gpio = gpio;

	dev_info(&client->dev, "reset-gpio control start reset_gpio %d\n", pdata->reset_gpio);

	gpio_set_value(pdata->reset_gpio, 1);
	usleep_range(1000000, 1000000);
	gpio_set_value(pdata->reset_gpio, 0);
	usleep_range(1000000, 1000000);
	gpio_set_value(pdata->reset_gpio, 1);
	dev_info(&client->dev, "reset-gpio control end\n");

If you run the code above, the reset-gpio pin is uncontrolled.
I have checked the following for the reset-gpio pin.

hardware/nvidia/soc/t19x/kernel-include/dt-bindings/gpio/tegra194-gpio.h
#define TEGRA194_MAIN_GPIO_PORT_Q 16
$ sudo grep tegra-gpio /sys/kernel/debug/gpio

gpiochip1: GPIOs 248-287, parent: platform/c2f0000.gpio, tegra-gpio-aon:
gpiochip0: GPIOs 288-511, parent: platform/2200000.gpio, tegra-gpio

Linux GPIO number = (base + (8 * port) + pin)
288 + (8 * 16) + 3 = 419

And if you set the following contents and operate it, it will work normally.

sudo sh -c "echo 419 > /sys/class/gpio/export" 
sudo sh -c "echo out > /sys/class/gpio/gpio419/direction" 
sudo sh -c "echo 1 > /sys/class/gpio/gpio419/value" 

I hope it works with just the driver code. (without script)
Can’t reset-gpio work just by defining dts?

hello TJCUT,

that’s looks correct implementation, according to pinmux spreadsheets, it’s used by Baseboard M.2 Wake Request to AP.
is there’s m.2 connected on your target?

M.2 is not connected.

hello TJCUT,

  1. did you obtain the pin correctly, please check kernel logs, was there related errors about this pin, reset-gpio?
  2. please return the pin number as unsigned int,
    for example…
  1. please try toggle the pin, and keep it at the same state for observation, for example, keep it as low and checking.

The pin number has been verified correctly.

[    7.734113] lt6911uxc 8-002b: reset-gpio control start reset_gpio 419
[    9.734233] lt6911uxc 8-002b: reset-gpio control end

For reference, if you use the code as follows, it works normally.

	gpio_direction_output(pdata->reset_gpio, 1);

	gpio_set_value(pdata->reset_gpio, 1);
	usleep_range(1000000, 1000000);
	gpio_set_value(pdata->reset_gpio, 0);

gpio_direction_output(pdata->reset_gpio, 1);
By adding the above function, it works fine.

Is it possible to declare direction in a dts file?

hello TJCUT,

there’s default configurations,

	gpio@2200000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_default>;
		gpio_default: default {
			gpio-input = <...>;
			gpio-output-low = <...>;
			gpio-output-high = <...>;

those pin configurations were applied by the software pinmux configuration file,
you may refer to developer guide, please check Pinmux Changes session to define your board’s pinmux configuration,
thanks

1 Like

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