GTE on linux: duplicated event on GPIO rising edge

Dear @KevinFFF,

Thanks for your fast follow up. I unfortunately do not have access to an eval kit but I can provide the reproduction steps.

  • The kernel module source to use for the test is located at sources/kernel/nvidia/drivers/staging/platform/tegra/gte_test/tegra194_gte_test.c
  • Apply the following patch tegra194_gte_test.patch (5.0 KB), or replace the original file with
    tegra194_gte_test.c (6.4 KB) - whatever is the most convenient for you.
  • Build the kernel module and copy it on the platform
  • Chose the input and output pins you would like to use for the test on your hardware. You can then find the mapping to the gpio identifiers with sudo cat /sys/kernel/debug/gpio.
  • Check under which GPIO controller the input GPIO is. This info can be found in the TRM in the table 1.1 GPIO Controllers and Port Mapping in the section GPIO Controllers / Overview / Features.
  • Under sources /hardware/nvidia/soc/t23x/kernel-include/dt-bindings/interrupt/tegra234-irq.h lookup the identifier for TEGRA234_IRQ_GPIO<X>_0, <X> being the GPIO controller ID.
  • Load the kernel module with: sudo insmod tegra194_gte_test.ko gpio_in=<gpio_in_id> gpio_out=<gpio_out_id> lic_irq=<lic_irq_id>
  • Enable the GTE timestamping with: sudo su -c "echo 1 > /sys/kernel/tegra_gte_test/gpio_en_dis"

At this stage:

  • The output GPIO should toggle every 5s
  • Before you connect the input and output pins together, the kernel log should report No timestamp available
  • Once you connect both pins together, messages like: GPIO HW Timestamp: raw 54791076543, ns 1753314449376 should appear.

Here is an example out I get:

[659.614352] GPIO HW Timestamp: raw 21125127462,  ns 676004078784
[659.614362] GPIO HW Timestamp: raw 21125133396,  ns 676004268672
[669.854125] GPIO HW Timestamp: raw 21445117941,  ns 686243774112
[669.854134] GPIO HW Timestamp: raw 21445126020,  ns 686244032640
[680.093824] GPIO HW Timestamp: raw 21765108679,  ns 696483477728
[680.093831] GPIO HW Timestamp: raw 21765116689,  ns 696483734048
[690.333467] GPIO HW Timestamp: raw 22085099729,  ns 706723191328
[690.333475] GPIO HW Timestamp: raw 22085105778,  ns 706723384896
[700.573441] GPIO HW Timestamp: raw 22405098950,  ns 716963166400
[700.573449] GPIO HW Timestamp: raw 22405104979,  ns 716963359328

Which gives the following intervals:

  • 0.189888
  • 10239.50544
  • 0.258528
  • 10239.445088
  • 0.25632
  • 10239.45728
  • 0.193568
  • 10239.781504
  • 0.192928

Before loading the module and writing to the sysfs to enable the GTE, I checked that no other events are registered: cat /sys/bus/platform/drivers/tegra_gte/3aa0000.gte/events_registered returns 0.

Afterwards the same command returns 1, and only the entry event296 (GPIO controller 1 in my test case) is listed under /sys/bus/platform/drivers/tegra_gte/3aa0000.gte/event296

Please let me know if the steps are unclear or if you spot anything suspicious. I’m also open to provide more logs if this can help.

Thank you.