tegra-hte.rst 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. HTE Kernel provider driver
  3. ==========================
  4. Description
  5. -----------
  6. The Nvidia tegra HTE provider also known as GTE (Generic Timestamping Engine)
  7. driver implements two GTE instances: 1) GPIO GTE and 2) LIC
  8. (Legacy Interrupt Controller) IRQ GTE. Both GTE instances get the timestamp
  9. from the system counter TSC which has 31.25MHz clock rate, and the driver
  10. converts clock tick rate to nanoseconds before storing it as timestamp value.
  11. GPIO GTE
  12. --------
  13. This GTE instance timestamps GPIO in real time. For that to happen GPIO
  14. needs to be configured as input. Only the always on (AON) GPIO controller
  15. instance supports timestamping GPIOs in real time as it is tightly coupled with
  16. the GPIO GTE. To support this, GPIOLIB adds two optional APIs as mentioned
  17. below. The GPIO GTE code supports both kernel and userspace consumers. The
  18. kernel space consumers can directly talk to HTE subsystem while userspace
  19. consumers timestamp requests go through GPIOLIB CDEV framework to HTE
  20. subsystem. The hte devicetree binding described at
  21. ``Documentation/devicetree/bindings/timestamp`` provides an example of how a
  22. consumer can request an GPIO line.
  23. See gpiod_enable_hw_timestamp_ns() and gpiod_disable_hw_timestamp_ns().
  24. For userspace consumers, GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE flag must be
  25. specified during IOCTL calls. Refer to ``tools/gpio/gpio-event-mon.c``, which
  26. returns the timestamp in nanoseconds.
  27. LIC (Legacy Interrupt Controller) IRQ GTE
  28. -----------------------------------------
  29. This GTE instance timestamps LIC IRQ lines in real time. The hte devicetree
  30. binding described at ``Documentation/devicetree/bindings/timestamp``
  31. provides an example of how a consumer can request an IRQ line. Since it is a
  32. one-to-one mapping with IRQ GTE provider, consumers can simply specify the IRQ
  33. number that they are interested in. There is no userspace consumer support for
  34. this GTE instance in the HTE framework.
  35. The provider source code of both IRQ and GPIO GTE instances is located at
  36. ``drivers/hte/hte-tegra194.c``. The test driver
  37. ``drivers/hte/hte-tegra194-test.c`` demonstrates HTE API usage for both IRQ
  38. and GPIO GTE.