Using GPIO interrupt with sysfs not working (maybe config required?)

Hi,
We use a custom carrier board hosting an Orin NX SoM with JP 5.1.3.

We use gpio-341 (PEE.02) as interrupt source for 1pps signal.
We tested it with sysfs:

  1. Exported the GPIO
  2. Activated the signal
  3. Saw the value is changing between 1 and 0.

The problem is that even after echo rising to the edge file we don’t get an interrupt (tested with c program).

Is there any configuration setup we need to do? something to verify? maybe something’s missing in the device tree (we didn’t make any changes in the dt related to this matter)?
device_tree.txt (424.6 KB)

Thanks

Hi bsp_dev,

Have you configured it as input in pinmux for interrupt usage?
Have you also measured this interrupt from waveform?

You have to configure the device tree about the interrupt for PPS. You can refer to the following topic for details.

Hi @KevinFFF ,

I get the following error on dmesg:

4.116624] pps-gpio pps_gpio: failed to request PPS GPIO
[ 4.122158] pps-gpio: probe of pps_gpio failed with error -22

I read the instructions and added the following node to the tegra234-soc-base.dtsi:

pps: pps_gpio
{
compatible = “pps-gpio”;
gpios = <&tegra_main_gpio 341 1>;
assert-falling-edge;
status = “okay”;
};

gpio 341 is PEE.02 and its the 1pps input according to PINMUX sheet

I noticed there are two options for gpio setting in the spreadsheet under customer usage:

  1. GPIO3_PEE.02
  2. GPIO_AO_RET

I used the first one which resulted with “rsvd” value for the nvidia,function property in the ao_n_pee2 dt node.
Than I tried to use the second which resulted with nvidia,function = gpio. I get the same driver error.

I know that PEE.02 is gpio 341 according to /sys/kernel/debug

It is not mapping like this.
It should be derived from the definition in header file.

Please share the full dmesg and device tree for further check.

device tree:
final_dt.txt (424.6 KB)

target dmesg:
dmesg.txt (63.6 KB)

Thanks @KevinFFF

[    4.123685] pps-gpio pps_gpio: failed to request PPS GPIO
[    4.129222] pps-gpio: probe of pps_gpio failed with error -22

It seems you still stuck at PPS gpio issue.

Please modify the following to configure PPS GPIO for PEE.02.

	pps_gpio {
		compatible = "pps-gpio";
-		gpios = <0x02 0x155 0x01>;
+		gpios = <0x51 0x22 0x01>;
		assert-falling-edge;
		status = "okay";
		phandle = <0x475>;
	};

You can refer to tegra234-gpio.h for the definition.
PEE.02 → 4*8 + 2 = 34 = 0x22

#define TEGRA234_AON_GPIO(port, offset) \
  	((TEGRA234_AON_GPIO_PORT_##port * 8) + offset)

0x51 is the phandle for GPIO AON Controller in your case.

	gpio@c2f0000 {
		compatible = "nvidia,tegra234-gpio-aon";
		..
		phandle = <0x51>;
	};

@KevinFFF , Thank you for your help. I still get the same error.
my dts:
final_dt.txt (424.6 KB)
my boot log:
boot.log (125.6 KB)
my pinmmux and gpio .dtsi for BCTs:
tegra234-mb1-bct-pinmux-p3767-dp-a03.txt (65.8 KB)
Orin-jetson_orin_nx_series_usits-gpio-default.txt (4.0 KB)

Could you share the result of the following command on your board after boot up?

$ sudo cat /sys/kernel/debug/gpio | grep PEE.02

You can also try to configure this node (pps_gpio) in kernel source and re-build kernel image/dtb.

Or use 0x0 as ACTIVE_HIGH instead of 0x01 as ACTIVE_LOW:

	pps_gpio {
		compatible = "pps-gpio";
-		gpios = <0x02 0x155 0x01>;
+		gpios = <0x51 0x22 0x0>;
		assert-falling-edge;
		status = "okay";
		phandle = <0x475>;
	};

Please share the block diagram of your connections of PPS module.