TX2 GPIO Wake issues

Hi, when using the gpio-keys hack to allow gpio wake i am seein the following issues:

  1. Some GPIO appears to latch after one interrupt is fired.
  2. One gpio appears to be level triggered even though it’s set to edge. Interrupts are continually fired which blocks the system and cpu stall is detected.

DTS

pinmux@2430000 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinmux_default>;

	pinmux_default: common {
		can_gpio2_paa2 {
			nvidia,pins = "can_gpio2_paa2";
			nvidia,function = "gpio";
			nvidia,pull = <TEGRA_PIN_PULL_UP>;
			nvidia,tristate = <TEGRA_PIN_ENABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
		};

		
		gpio_sw2_pff2 {
			nvidia,pins = "gpio_sw2_pff2";
			nvidia,function = "rsvd0";
			nvidia,pull = <TEGRA_PIN_PULL_UP>;
			nvidia,tristate = <TEGRA_PIN_ENABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			nvidia,lpdr = <TEGRA_PIN_DISABLE>;
		};

		gpio_pq6_pi6 {
			nvidia,pins = "gpio_pq6_pi6";
			nvidia,function = "rsvd0";
			nvidia,pull = <TEGRA_PIN_PULL_UP>;
			nvidia,tristate = <TEGRA_PIN_ENABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;				
		};

	};
};

gpio-keys {
	compatible = "gpio-keys";

	/delete-node/ volume_down;
	/delete-node/ volume_up;
	/delete-node/ power;

	ttb-wake {
		label = "ttb-wake";
		gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(I, 6) GPIO_ACTIVE_LOW>;
		linux,code = <BTN_9>;
		gpio-key,wakeup;
	};
	
	aux1-wake {
		label = "aux1-wake";
		gpios = <&tegra_aon_gpio TEGRA_AON_GPIO(AA, 2) GPIO_ACTIVE_LOW>;
		linux,code = <BTN_8>;
		gpio-key,wakeup;
	};
	
	
	aux2-wake {
		label = "aux2-wake";
		gpios = <&tegra_aon_gpio TEGRA_AON_GPIO(FF, 2) GPIO_ACTIVE_LOW>;
		linux,code = <BTN_7>;
		gpio-key,wakeup;
	};
};

root@tegra-ubuntu:~# cat /sys/kernel/debug/gpio | grep -E “aux|ttb”
gpio-298 ( |aux1-wake ) in hi
gpio-314 ( |aux2-wake ) in lo
gpio-390 ( |ttb-wake ) in lo

gpio314 and gpio390 are stuck low after being pulled to gnd and then released.

root@tegra-ubuntu:~# cat /proc/interrupts | grep -E “aux|ttb”
200: 1 0 0 0 tegra-gpio 70 Edge ttb-wake
365: 138973 0 0 0 tegra-gpio-aon 42 Edge aux1-wake
381: 1 0 0 0 tegra-gpio-aon 58 Edge aux2-wake

gpio365, when held low, continually fires.

Any help would be appreciated.

Regards,
Chris

hello chris.duncan,

could you please follow TX2 Configuring Pinmux GPIO and PAD to configure GPIOs,
thanks

Hi Jerry,

Are you saying i’ve configured the pinmux incorrectly? If there is an issue, could you be more specific?

Thanks,
Chris

hello chris.duncan,

it seems to me you’re having some hacking, could you please follow the steps to configure GPIOs.
also, could you please share more details about how you observed interrupts are continually fired issue,
thanks

Jerry,

I have followed the TX2 Configuring Pinmux GPIO and PAD instruction, however, after flashing (successfully), the pinmux changes don’t seem to have taken affect.

Should i expect to see the relevant nodes in /proc/device-tree?

“Hacking” the device tree is the only option we have to create the correct nodes for a custom carrier board. Assuming the cfg file created in your instruction works, how do we apply the pins to the wake interrupt controller, without “hacking”?

Regards,
Chris

Jerry,

Isn’t the generated config file from pinmux-dts2cfg.py used for MB1 only - not cboot, u-boot or kernel?

IF there is some magic going on which edits the final flashed DTB, i am not seeing it.

Regards,
Chris

hello chris.duncan,

Am I understand correctly that your issue is something like GPIO behavior not works as expected?

you should have customize the MB1 BCT to configure platform-specific static settings. (seems you had already done), you should also refer to Tegra Linux Driver Package TX2 Adaptation Guide since you’re developing a custom carrier board.

could you please also refer to below steps to trigger GPIOs manually,

  1. Enable GPIOs manually, please refer to gpio definitions: kernel-4.4/include/dt-bindings/gpio/tegra186-gpio.h
  2. Location of the GPIOs
    cd /sys/class/gpio
  3. Generate gpio220 name
    echo 220 > export
  4. Enable the gpio
    echo out > direction && echo 1 > value

Jerry,

Sorry, none of this is helping. My issue is with interrupts continually firing when attached (via gpio-keys) to the wake interupt controller. This only occurs on one pin so i’m not too bothered.

The latching effect i was seeing was caused by a level shifter being push-pull.

The only way to get the pinmux and pin states to persist (from what i can see) is to configure it with the device tree. I don’t believe that configuring the pinmux via BCT alone is enough to persist through all of the bootloader stages and kernel.

Finally…

“echo out > direction && echo 1 > value” can be replaced by “echo high > direction”.

Regards,
Chris