요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0+
HTE Kernel provider driver
==========================
Description
-----------
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.
GPIO GTE
--------
This GTE instance timestamps GPIO in real time. For that to happen GPIO
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.
See gpiod_enable_hw_timestamp_ns() and gpiod_disable_hw_timestamp_ns().
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
-----------------------------------------
This GTE instance timestamps LIC IRQ lines in real time. The hte devicetree
binding described at ``Documentation/devicetree/bindings/timestamp``
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.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Nvidia Tegra GTE provider
1-13문서 제목은 `HTE Kernel provider driver`입니다. Nvidia Tegra HTE provider는 GTE(Generic Timestamping Engine)라고도 하며 두 GTE instance를 구현합니다. 첫째는 GPIO GTE, 둘째는 LIC(Legacy Interrupt Controller) IRQ GTE입니다.
두 instance 모두 31.25 MHz clock rate의 system counter TSC에서 timestamp를 얻고 driver가 clock tick을 nanosecond로 변환한 뒤 timestamp value로 저장합니다.
공통 clock source와 timestamp 대상입니다.
GPIO GTE와 kernel·userspace consumer
14-33GPIO GTE는 GPIO를 real time으로 timestamp합니다. 이를 위해 GPIO는 input으로 구성해야 합니다. GPIO GTE와 긴밀히 결합된 always-on(AON) GPIO controller instance만 real-time GPIO timestamping을 지원합니다.
GPIOLIB은 이를 위해 optional API `gpiod_enable_hw_timestamp_ns()`와 `gpiod_disable_hw_timestamp_ns()`를 추가합니다.
GPIO GTE code는 kernel과 userspace consumer를 모두 지원합니다. Kernel-space consumer는 HTE subsystem과 직접 통신하고, userspace timestamp request는 GPIOLIB CDEV framework를 거쳐 HTE subsystem으로 전달됩니다.
Consumer가 GPIO line을 요청하는 예제는 `Documentation/devicetree/bindings/timestamp`의 HTE Device Tree binding에 있습니다.
Userspace consumer는 IOCTL 호출에서 `GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE` flag를 지정해야 합니다. `tools/gpio/gpio-event-mon.c` 예제는 timestamp를 nanosecond로 반환합니다.
AON GPIO event가 kernel 또는 userspace consumer에 전달되는 흐름입니다.
Kernel과 userspace request의 차이입니다.
LIC IRQ GTE와 source code
34-47LIC IRQ GTE instance는 LIC IRQ line을 real time으로 timestamp합니다. IRQ line request 예제도 `Documentation/devicetree/bindings/timestamp`의 HTE binding에 있습니다.
IRQ GTE provider와 1:1 mapping이므로 consumer는 관심 있는 IRQ number를 지정하면 됩니다. 이 GTE instance는 HTE framework에서 userspace consumer를 지원하지 않습니다.
IRQ와 GPIO GTE provider source는 모두 `drivers/hte/hte-tegra194.c`에 있습니다. Test driver `drivers/hte/hte-tegra194-test.c`는 IRQ와 GPIO GTE 양쪽의 HTE API 사용법을 보여 줍니다.
IRQ number가 provider line과 1:1로 연결되는 timestamp 경로입니다.
요약과 해설
tegra-hte.rst:1-47Tegra provider는 31.25 MHz TSC를 공유하는 GPIO GTE와 LIC IRQ GTE를 제공합니다. GPIO path는 AON controller와 kernel·userspace consumer를 지원하지만 LIC IRQ path는 1:1 kernel mapping만 지원합니다.