2022-04-22 13:52:14 -07:00
|
|
|
.. SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
|
|
|
HTE Kernel provider driver
|
|
|
|
==========================
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
2023-04-13 17:44:51 -07:00
|
|
|
The Nvidia tegra HTE provider also known as GTE (Generic Timestamping Engine)
|
|
|
|
driver implements two GTE instances: 1) GPIO GTE and 2) LIC
|
|
|
|
(Legacy Interrupt Controller) IRQ GTE. Both GTE instances get the timestamp
|
|
|
|
from the system counter TSC which has 31.25MHz clock rate, and the driver
|
|
|
|
converts clock tick rate to nanoseconds before storing it as timestamp value.
|
2022-04-22 13:52:14 -07:00
|
|
|
|
|
|
|
GPIO GTE
|
|
|
|
--------
|
|
|
|
|
|
|
|
This GTE instance timestamps GPIO in real time. For that to happen GPIO
|
2023-04-13 17:44:51 -07:00
|
|
|
needs to be configured as input. Only the always on (AON) GPIO controller
|
|
|
|
instance supports timestamping GPIOs in real time as it is tightly coupled with
|
|
|
|
the GPIO GTE. To support this, GPIOLIB adds two optional APIs as mentioned
|
|
|
|
below. The GPIO GTE code supports both kernel and userspace consumers. The
|
|
|
|
kernel space consumers can directly talk to HTE subsystem while userspace
|
|
|
|
consumers timestamp requests go through GPIOLIB CDEV framework to HTE
|
|
|
|
subsystem. The hte devicetree binding described at
|
|
|
|
``Documentation/devicetree/bindings/timestamp`` provides an example of how a
|
|
|
|
consumer can request an GPIO line.
|
2022-04-22 13:52:14 -07:00
|
|
|
|
docs: tegra194-hte.rst: don't include gpiolib.c twice
All extern functions of drivers/gpio/gpiolib.c are already
inside the Kernel documentation, as driver-api/gpio/index.rst
already includes it.
Placing a kernel-doc here will only cause mess, as the same symbol
will be placed on two parts of the document, causing breakages
in cross-references.
So, instead, add a cross-reference there.
This solves those Sphinx 3.1+ warnings:
.../Documentation/driver-api/hte/tegra194-hte:28: ./drivers/gpio/gpiolib.c:2464: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2464.
.../Documentation/driver-api/hte/tegra194-hte:28: ./drivers/gpio/gpiolib.c:2493: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2493.
.../Documentation/driver-api/hte/tegra194-hte.rst:2464: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2464.
.../Documentation/driver-api/hte/tegra194-hte.rst:2464: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2464.
.../Documentation/driver-api/hte/tegra194-hte.rst:2464: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2464.
.../Documentation/driver-api/hte/tegra194-hte.rst:2493: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2493.
.../Documentation/driver-api/hte/tegra194-hte.rst:2493: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2493.
.../Documentation/driver-api/hte/tegra194-hte.rst:2493: WARNING: Duplicate C declaration, also defined at driver-api/gpio/index:2493.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/de81b472f552bd651f140f0aa779a29652fffa62.1656759989.git.mchehab@kernel.org
Acked-by: Dipen Patel <dipenp@nvidia.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2022-07-02 04:07:34 -07:00
|
|
|
See gpiod_enable_hw_timestamp_ns() and gpiod_disable_hw_timestamp_ns().
|
2022-04-22 13:52:14 -07:00
|
|
|
|
|
|
|
For userspace consumers, GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE flag must be
|
|
|
|
specified during IOCTL calls. Refer to ``tools/gpio/gpio-event-mon.c``, which
|
|
|
|
returns the timestamp in nanoseconds.
|
|
|
|
|
|
|
|
LIC (Legacy Interrupt Controller) IRQ GTE
|
|
|
|
-----------------------------------------
|
|
|
|
|
2023-04-13 17:44:51 -07:00
|
|
|
This GTE instance timestamps LIC IRQ lines in real time. The hte devicetree
|
|
|
|
binding described at ``Documentation/devicetree/bindings/timestamp``
|
2022-04-22 13:52:14 -07:00
|
|
|
provides an example of how a consumer can request an IRQ line. Since it is a
|
|
|
|
one-to-one mapping with IRQ GTE provider, consumers can simply specify the IRQ
|
|
|
|
number that they are interested in. There is no userspace consumer support for
|
|
|
|
this GTE instance in the HTE framework.
|
|
|
|
|
|
|
|
The provider source code of both IRQ and GPIO GTE instances is located at
|
|
|
|
``drivers/hte/hte-tegra194.c``. The test driver
|
|
|
|
``drivers/hte/hte-tegra194-test.c`` demonstrates HTE API usage for both IRQ
|
|
|
|
and GPIO GTE.
|