Documentation/driver-api/hte/tegra-hte.rst GitHub 원문 ↗

Linux 6.18.37 · Driver API

HTE Kernel provider driver

Tegra GPIO GTE와 LIC IRQ GTE의 TSC 기반 nanosecond timestamp 경로를 설명합니다.

Source pathDocumentation/driver-api/hte/tegra-hte.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

tegra-hte.rst:1-47

Tegra provider는 31.25 MHz TSC를 공유하는 GPIO GTE와 LIC IRQ GTE를 제공합니다. GPIO path는 AON controller와 kernel·userspace consumer를 지원하지만 LIC IRQ path는 1:1 kernel mapping만 지원합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

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로 저장합니다.

Tegra GTE instance
InstanceTimestamp 대상Clock source변환
GPIO GTEAON GPIO state change31.25 MHz TSCTick → ns
LIC IRQ GTELIC IRQ line31.25 MHz TSCTick → ns

공통 clock source와 timestamp 대상입니다.

GPIO GTE와 kernel·userspace consumer

14-33

GPIO 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로 반환합니다.

GPIO GTE timestamp 경로
AON GPIO를 input으로 구성GPIO GTE가 state change captureTSC tick을 nanosecond로 변환HTE subsystem에 timestamp pushKernel consumer callback 또는 GPIOLIB CDEVUserspace는 HTE event-clock flag 사용

AON GPIO event가 kernel 또는 userspace consumer에 전달되는 흐름입니다.

GPIO GTE consumer 경로
Consumer진입 경로필수 설정
KernelHTE subsystem 직접gpiod_enable_hw_timestamp_ns()
UserspaceGPIOLIB CDEV → HTEGPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE

Kernel과 userspace request의 차이입니다.

LIC IRQ GTE와 source code

34-47

LIC 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 사용법을 보여 줍니다.

LIC IRQ GTE mapping
Consumer가 IRQ number 지정LIC IRQ GTE와 1:1 mappingIRQ event captureTSC tick을 nanosecond로 변환HTE kernel consumer에 전달Userspace consumer는 지원하지 않음

IRQ number가 provider line과 1:1로 연결되는 timestamp 경로입니다.