Issue using AON gpio as interrupt in device tree

Hi,

I’m currently trying to use GPIO04, aka TEGRA194_AON_GPIO(CC, 1) on the Xavier NX as the interrupt line for a PCA9534 I2C gpio expander.

I have set up the device tree as so:

    i2c@c240000 {
        gpio_i: gpio@20 {
            compatible = "nxp,pca9534";
            reg = <0x20>;
            interrupt-parent = <&tegra_aon_gpio>;
            interrupts = <TEGRA194_AON_GPIO(CC, 1) GPIO_ACTIVE_LOW>;
            interrupt-controller;
            #interrupt-cells = <2>;
            gpio-controller;
            #gpio-cells = <2>;

            status = "okay";
        };

I have also adjusted the pinmux as follows:

&tegra_pinctrl {
	pinctrl-names = "default", "drive", "unused";
	pinctrl-0 = <&pinmux_default>;
	status = "okay";
	pinmux_default: common {
		spi2_miso_pcc1 {
			nvidia,pins = "spi2_miso_pcc1";
			nvidia,function = "rsvd2";
			nvidia,pull = <TEGRA_PIN_PULL_UP>;
			nvidia,tristate = <TEGRA_PIN_ENABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			nvidia,io-high-voltage = <TEGRA_PIN_ENABLE>;
			nvidia,lpdr = <TEGRA_PIN_DISABLE>;
		};
	};
};

gpio@c2f0000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_default>;
		gpio_default: default {
			gpio-input = <
				TEGRA_GPIO(CC,1);
				>;
		};
	};

However I am seeing in dmesg that the driver fails to probe due to the IRQ not being able to be set up.

[    5.250949] irq: IRQ261: trimming hierarchy from :pmc@c360000
[    5.251140] pca953x 1-0020: supply vcc not found, using dummy regulator
[    5.256810] pca953x 1-0020: using no AI
[    5.262059] gpio gpiochip2: (tegra194-gpio-aon): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[    5.271058] gpio gpiochip2: (tegra194-gpio-aon): unable to lock HW IRQ 13 for IRQ
[    5.278578] genirq: Failed to request resources for 1-0020 (irq 261) on irqchip gpio
[    5.286475] pca953x 1-0020: failed to request irq 261
[    5.291449] pca953x: probe of 1-0020 failed with error -5 

What is the issue with my current setup? Is it possible to configure AON gpio as hardware interrupts?

Thanks,
Akhil

Hi akhil.m.birlangi,

Are you using the devkit or custom board for Xavier NX?
What’s your Jetpack version in use?

It seems suspend_gpio also use this PIN as suspend-led-gpio in device tree by default.
Please confirm if you have this requirement, or you can remove it.

I would also suggest configuring pinmux through spreadsheet and generate .cfg file for Xavier NX.

We are using a custom board for Xavier NX.

I believe our current Jetpack version is fixed to 35.2.1

Is it possible to simply add a

/delete-node/ suspend_gpio;

to our dts to remove the pin allocation?

Also I am not sure how to generate a .cfg file from the dtsi provided from the pinmux spreadsheet. How do I go about making this .cfg and where should the file be placed during the build?

Thanks,
Akhil

Okay, you can add it to overlay dtbo to remove the usage of this pin.

Please refer to <Linux_for_Tegra>/kernel/pinmux/t19xREADME.txt for details.