← Documents Documentation/iio/ade9000.rst GitHub 원문 ↗

Linux 6.18.37 · IIO

ADE9000 driver

ADE9000의 다상 전력·에너지 측정, 보정, 이벤트, 파형 버퍼와 CLKOUT을 설명합니다.

Source pathDocumentation/iio/ade9000.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

ade9000.rst:1-268

ADE9000 드라이버는 세 상의 전압·전류와 유효·무효·피상 전력 및 에너지를 IIO 속성으로 노출합니다. 채널별 이득·오프셋 보정, 영점 통과와 RMS sag·swell 이벤트, `dready` 기반 파형 캡처, 다른 장치가 참조할 수 있는 CLKOUT도 지원합니다.

문서 개요
항목
SourceDocumentation/iio/ade9000.rst
분량268 source lines
측정 상A, B, C
측정전압, 전류, 전력, 에너지, 역률
선택 기능IIO events, waveform buffer, clkout

원문 분량과 핵심 기능을 요약합니다.

통합 계측 흐름
세 상의 전압·전류 샘플링DSP에서 전력·에너지·역률 계산scale과 채널별 보정 적용임계값 이벤트로 전력 품질 감시`dready` 기반 파형 버퍼 또는 sysfs 속성으로 수집

입력 변환부터 보정·감시·버퍼 수집까지의 전체 경로입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ===============
4 ADE9000 driver
5 ===============
6
7 This driver supports Analog Device's ADE9000 energy measurement IC on SPI bus.
8
9 1. Supported devices
10 ====================
11
12 * `ADE9000 <https://www.analog.com/media/en/technical-documentation/data-sheets/ADE9000.pdf>`_
13
14 The ADE9000 is a highly accurate, fully integrated, multiphase energy and power
15 quality monitoring device. Superior analog performance and a digital signal
16 processing (DSP) core enable accurate energy monitoring over a wide dynamic
17 range. An integrated high end reference ensures low drift over temperature
18 with a combined drift of less than ±25 ppm/°C maximum for the entire channel
19 including a programmable gain amplifier (PGA) and an analog-to-digital
20 converter (ADC).
21
22 2. Device attributes
23 ====================
24
25 Power and energy measurements are provided for voltage, current, active power,
26 reactive power, apparent power, and power factor across three phases.
27
28 Each IIO device has a device folder under ``/sys/bus/iio/devices/iio:deviceX``,
29 where X is the IIO index of the device. Under these folders reside a set of
30 device files, depending on the characteristics and features of the hardware
31 device in question. These files are consistently generalized and documented in
32 the IIO ABI documentation.
33
34 The following tables show the ADE9000 related device files, found in the
35 specific device folder path ``/sys/bus/iio/devices/iio:deviceX``.
36
37 +---------------------------------------------------+----------------------------------------------------------+
38 | Current measurement related device files | Description |
39 +---------------------------------------------------+----------------------------------------------------------+
40 | in_current[0-2]_raw | Raw current measurement for phases A, B, C. |
41 +---------------------------------------------------+----------------------------------------------------------+
42 | in_current[0-2]_scale | Scale for current channels. |
43 +---------------------------------------------------+----------------------------------------------------------+
44 | in_current[0-2]_calibscale | Calibration gain for current channels (AIGAIN reg). |
45 +---------------------------------------------------+----------------------------------------------------------+
46 | in_altcurrent[0-2]_rms_raw | RMS current measurement for phases A, B, C. |
47 +---------------------------------------------------+----------------------------------------------------------+
48 | in_altcurrent[0-2]_rms_scale | Scale for RMS current channels. |
49 +---------------------------------------------------+----------------------------------------------------------+
50 | in_altcurrent[0-2]_rms_calibbias | RMS offset correction for current channels (IRMSOS reg). |
51 +---------------------------------------------------+----------------------------------------------------------+
52
53 +---------------------------------------------------+----------------------------------------------------------+
54 | Voltage measurement related device files | Description |
55 +---------------------------------------------------+----------------------------------------------------------+
56 | in_voltage[0-2]_raw | Raw voltage measurement for phases A, B, C. |
57 +---------------------------------------------------+----------------------------------------------------------+
58 | in_voltage[0-2]_scale | Scale for voltage channels. |
59 +---------------------------------------------------+----------------------------------------------------------+
60 | in_voltage[0-2]_calibscale | Calibration gain for voltage channels (AVGAIN reg). |
61 +---------------------------------------------------+----------------------------------------------------------+
62 | in_voltage[0-2]_frequency | Measured line frequency from instantaneous voltage. |
63 +---------------------------------------------------+----------------------------------------------------------+
64 | in_altvoltage[0-2]_rms_raw | RMS voltage measurement for phases A, B, C. |
65 +---------------------------------------------------+----------------------------------------------------------+
66 | in_altvoltage[0-2]_rms_scale | Scale for RMS voltage channels. |
67 +---------------------------------------------------+----------------------------------------------------------+
68 | in_altvoltage[0-2]_rms_calibbias | RMS offset correction for voltage channels (VRMSOS reg). |
69 +---------------------------------------------------+----------------------------------------------------------+
70
71 +---------------------------------------------------+----------------------------------------------------------+
72 | Power measurement related device files | Description |
73 +---------------------------------------------------+----------------------------------------------------------+
74 | in_power[0-2]_active_raw | Active power measurement for phases A, B, C. |
75 +---------------------------------------------------+----------------------------------------------------------+
76 | in_power[0-2]_active_scale | Scale for active power channels. |
77 +---------------------------------------------------+----------------------------------------------------------+
78 | in_power[0-2]_active_calibbias | Calibration offset for active power (xWATTOS regs). |
79 +---------------------------------------------------+----------------------------------------------------------+
80 | in_power[0-2]_active_calibscale | Calibration gain for active power (APGAIN reg). |
81 +---------------------------------------------------+----------------------------------------------------------+
82 | in_power[0-2]_reactive_raw | Reactive power measurement for phases A, B, C. |
83 +---------------------------------------------------+----------------------------------------------------------+
84 | in_power[0-2]_reactive_scale | Scale for reactive power channels. |
85 +---------------------------------------------------+----------------------------------------------------------+
86 | in_power[0-2]_reactive_calibbias | Calibration offset for reactive power (xVAROS regs). |
87 +---------------------------------------------------+----------------------------------------------------------+
88 | in_power[0-2]_apparent_raw | Apparent power measurement for phases A, B, C. |
89 +---------------------------------------------------+----------------------------------------------------------+
90 | in_power[0-2]_apparent_scale | Scale for apparent power channels. |
91 +---------------------------------------------------+----------------------------------------------------------+
92 | in_power[0-2]_powerfactor | Power factor for phases A, B, C. |
93 +---------------------------------------------------+----------------------------------------------------------+
94
95 +---------------------------------------------------+----------------------------------------------------------+
96 | Energy measurement related device files | Description |
97 +---------------------------------------------------+----------------------------------------------------------+
98 | in_energy[0-2]_active_raw | Active energy measurement for phases A, B, C. |
99 +---------------------------------------------------+----------------------------------------------------------+
100 | in_energy[0-2]_reactive_raw | Reactive energy measurement for phases A, B, C. |
101 +---------------------------------------------------+----------------------------------------------------------+
102 | in_energy[0-2]_apparent_raw | Apparent energy measurement for phases A, B, C. |
103 +---------------------------------------------------+----------------------------------------------------------+
104
105 +------------------------------+------------------------------------------------------------------+
106 | Shared device attributes | Description |
107 +------------------------------+------------------------------------------------------------------+
108 | name | Name of the IIO device. |
109 +------------------------------+------------------------------------------------------------------+
110 | filter_type | Waveform buffer filter type (sinc4, sinc4+lp). |
111 +------------------------------+------------------------------------------------------------------+
112 | filter_type_available | Available filter types for waveform buffer. |
113 +------------------------------+------------------------------------------------------------------+
114
115 3. Calibration and scaling
116 ===========================
117
118 The ADE9000 provides multiple levels of gain and offset correction:
119
120 **Calibration Gain (per-channel)**
121 Fine-tuning calibration gains applied in the digital domain for each channel type.
122 Controlled via ``calibscale`` attributes (AIGAIN, AVGAIN, APGAIN registers).
123
124 **Calibration Bias (per-channel)**
125 Hardware calibration offsets applied by the device internally:
126
127 - Power measurements: Controlled via ``calibbias`` attributes for power channels (xWATTOS, xVAROS registers).
128 - RMS measurements: Controlled via ``calibbias`` attributes for RMS channels (IRMSOS, VRMSOS registers).
129
130 These are internal chip calibrations, not userspace-applied offsets.
131
132 4. Event attributes
133 ===================
134
135 The ADE9000 provides various interrupts that are mapped to IIO events.
136 Event functionality is only available if the corresponding interrupts are
137 connected in the device tree.
138
139 +---------------------------------------------------+----------------------------------------------------------+
140 | IIO Event Attribute | ADE9000 Datasheet Equivalent |
141 +---------------------------------------------------+----------------------------------------------------------+
142 | in_voltage[0-2]_thresh_either_en | Zero crossing detection interrupt (ZXVx) |
143 +---------------------------------------------------+----------------------------------------------------------+
144 | in_altvoltage[0-2]_rms_thresh_rising_en | RMS swell detection interrupt (SWELLx) |
145 +---------------------------------------------------+----------------------------------------------------------+
146 | in_altvoltage[0-2]_rms_thresh_rising_value | RMS swell threshold (SWELL_LVL register) |
147 +---------------------------------------------------+----------------------------------------------------------+
148 | in_altvoltage[0-2]_rms_thresh_falling_en | RMS sag/dip detection interrupt (DIPx) |
149 +---------------------------------------------------+----------------------------------------------------------+
150 | in_altvoltage[0-2]_rms_thresh_falling_value | RMS sag/dip threshold (DIP_LVL register) |
151 +---------------------------------------------------+----------------------------------------------------------+
152 | in_current[0-2]_thresh_either_en | Current zero crossing detection interrupt (ZXIx) |
153 +---------------------------------------------------+----------------------------------------------------------+
154
155 Event directions:
156
157 - ``rising``: Upper threshold crossing (swell detection)
158 - ``falling``: Lower threshold crossing (sag/dip detection)
159 - ``either``: Any threshold crossing (zero crossing detection)
160 - ``none``: Timeout or non-directional events
161
162 **Note**: Event attributes are only available if the corresponding interrupts
163 (irq0, irq1, dready) are specified in the device tree. The driver works without
164 interrupts but with reduced functionality.
165
166 5. Device buffers
167 =================
168
169 This driver supports IIO buffers for waveform capture. Buffer functionality
170 requires the dready interrupt to be connected.
171
172 The device supports capturing voltage and current waveforms for power quality
173 analysis. The waveform buffer can be configured to capture data from different
174 channel combinations.
175
176 Supported channel combinations for buffered capture:
177
178 - Phase A: voltage and current (IA + VA)
179 - Phase B: voltage and current (IB + VB)
180 - Phase C: voltage and current (IC + VC)
181 - All phases: all voltage and current channels
182 - Individual channels: IA, VA, IB, VB, IC, VC
183
184 Usage examples
185 --------------
186
187 Enable waveform capture for Phase A:
188
189 .. code-block:: bash
190
191 root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_current0_en
192 root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_voltage0_en
193
194 Set buffer length and enable:
195
196 .. code-block:: bash
197
198 root:/sys/bus/iio/devices/iio:device0> echo 100 > buffer/length
199 root:/sys/bus/iio/devices/iio:device0> echo 1 > buffer/enable
200
201 6. Clock output
202 ===============
203
204 The ADE9000 can provide a clock output via the CLKOUT pin when using an external
205 crystal/clock source. This feature is enabled by specifying ``#clock-cells = <0>``
206 in the device tree. The output clock will be registered as "clkout" and can be
207 referenced by other devices.
208
209 7. Usage examples
210 =================
211
212 Show device name:
213
214 .. code-block:: bash
215
216 root:/sys/bus/iio/devices/iio:device0> cat name
217 ade9000
218
219 Read voltage measurements:
220
221 .. code-block:: bash
222
223 root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_raw
224 12345
225 root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_scale
226 0.000030517
227
228 - Phase A voltage = in_voltage0_raw * in_voltage0_scale = 0.3769 V
229
230 Read power measurements:
231
232 .. code-block:: bash
233
234 root:/sys/bus/iio/devices/iio:device0> cat in_power0_active_raw
235 5678
236 root:/sys/bus/iio/devices/iio:device0> cat in_power0_scale
237 0.000244140
238
239 - Phase A active power = in_power0_active_raw * in_power0_scale = 1.386 W
240
241 Configure calibration gains:
242
243 .. code-block:: bash
244
245 # Set current channel 0 calibration gain
246 root:/sys/bus/iio/devices/iio:device0> echo 0x800000 > in_current0_calibscale
247 # Set voltage channel 0 calibration gain
248 root:/sys/bus/iio/devices/iio:device0> echo 0x7FFFFF > in_voltage0_calibscale
249
250 Configure RMS voltage event thresholds (requires interrupts):
251
252 .. code-block:: bash
253
254 # Set RMS sag detection threshold
255 root:/sys/bus/iio/devices/iio:device0> echo 180000 > events/in_altvoltage0_rms_thresh_falling_value
256 # Enable RMS sag detection
257 root:/sys/bus/iio/devices/iio:device0> echo 1 > events/in_altvoltage0_rms_thresh_falling_en
258
259 # Set RMS swell detection threshold
260 root:/sys/bus/iio/devices/iio:device0> echo 260000 > events/in_altvoltage0_rms_thresh_rising_value
261 # Enable RMS swell detection
262 root:/sys/bus/iio/devices/iio:device0> echo 1 > events/in_altvoltage0_rms_thresh_rising_en
263
264 8. IIO Interfacing Tools
265 ========================
266
267 See ``Documentation/iio/iio_tools.rst`` for the description of the available IIO
268 interfacing tools.
269

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

장치 개요와 IIO 속성 위치

1-35

이 드라이버는 SPI 버스에 연결된 Analog Devices ADE9000 에너지 측정 IC를 지원합니다.

ADE9000은 정확도가 높은 완전 통합형 다상 에너지·전력 품질 감시 장치입니다. 우수한 아날로그 성능과 디지털 신호 처리(DSP) 코어를 결합해 넓은 동적 범위에서 에너지를 정확하게 감시합니다.

통합 고급 기준 전압은 온도 변화에 따른 드리프트를 낮춥니다. 프로그래머블 이득 증폭기(PGA)와 아날로그-디지털 변환기(ADC)를 포함한 전체 채널의 결합 드리프트는 최대 ±25 ppm/°C 미만입니다.

ADE9000 측정 범위
분류측정 항목상 범위
입력전압, 전류A, B, C
전력유효 전력, 무효 전력, 피상 전력A, B, C
품질역률A, B, C
에너지유효 에너지, 무효 에너지, 피상 에너지A, B, C

세 상에 걸쳐 제공되는 전력·에너지 계측 종류를 정리합니다.

각 IIO 장치에는 `/sys/bus/iio/devices/iio:deviceX` 장치 폴더가 있습니다. 여기서 X는 장치의 IIO 인덱스입니다. 이 폴더 아래에는 하드웨어의 특성과 기능에 따른 장치 파일이 있으며, 파일 인터페이스는 IIO ABI 문서에서 일관된 방식으로 일반화해 설명합니다.

뒤의 표에 나오는 ADE9000 관련 파일은 모두 해당 장치의 `/sys/bus/iio/devices/iio:deviceX` 경로에서 찾을 수 있습니다.

ADE9000 IIO 접근 경로
ADE9000이 세 상의 전압·전류를 ADC로 변환DSP가 전력·에너지·역률을 계산SPI 드라이버가 레지스터 값을 IIO 채널로 연결`/sys/bus/iio/devices/iio:deviceX`에서 속성 읽기

하드웨어 측정값이 sysfs 장치 파일로 노출되는 흐름입니다.

.. SPDX-License-Identifier: GPL-2.0

===============
ADE9000 driver
===============

This driver supports Analog Device's ADE9000 energy measurement IC on SPI bus.

1. Supported devices
====================

* `ADE9000 <https://www.analog.com/media/en/technical-documentation/data-sheets/ADE9000.pdf>`_

The ADE9000 is a highly accurate, fully integrated, multiphase energy and power
quality monitoring device. Superior analog performance and a digital signal
processing (DSP) core enable accurate energy monitoring over a wide dynamic
range. An integrated high end reference ensures low drift over temperature
with a combined drift of less than ±25 ppm/°C maximum for the entire channel
including a programmable gain amplifier (PGA) and an analog-to-digital
converter (ADC).

2. Device attributes
====================

Power and energy measurements are provided for voltage, current, active power,
reactive power, apparent power, and power factor across three phases.

Each IIO device has a device folder under ``/sys/bus/iio/devices/iio:deviceX``,
where X is the IIO index of the device. Under these folders reside a set of
device files, depending on the characteristics and features of the hardware
device in question. These files are consistently generalized and documented in
the IIO ABI documentation.

The following tables show the ADE9000 related device files, found in the
specific device folder path ``/sys/bus/iio/devices/iio:deviceX``.

전류·전압·전력·에너지 속성

36-114
전류 측정 장치 파일
장치 파일설명
`in_current[0-2]_raw`A·B·C상의 원시 전류 측정값
`in_current[0-2]_scale`전류 채널 배율
`in_current[0-2]_calibscale`전류 채널 보정 이득, AIGAIN 레지스터
`in_altcurrent[0-2]_rms_raw`A·B·C상의 RMS 전류 측정값
`in_altcurrent[0-2]_rms_scale`RMS 전류 채널 배율
`in_altcurrent[0-2]_rms_calibbias`RMS 전류 오프셋 보정, IRMSOS 레지스터

인덱스 0~2는 각각 A상, B상, C상을 나타냅니다.

전압 측정 장치 파일
장치 파일설명
`in_voltage[0-2]_raw`A·B·C상의 원시 전압 측정값
`in_voltage[0-2]_scale`전압 채널 배율
`in_voltage[0-2]_calibscale`전압 채널 보정 이득, AVGAIN 레지스터
`in_voltage[0-2]_frequency`순간 전압에서 측정한 선로 주파수
`in_altvoltage[0-2]_rms_raw`A·B·C상의 RMS 전압 측정값
`in_altvoltage[0-2]_rms_scale`RMS 전압 채널 배율
`in_altvoltage[0-2]_rms_calibbias`RMS 전압 오프셋 보정, VRMSOS 레지스터

순간 전압, 선로 주파수, RMS 전압과 보정 항목입니다.

전력 측정 장치 파일
장치 파일설명
`in_power[0-2]_active_raw`A·B·C상의 유효 전력 측정값
`in_power[0-2]_active_scale`유효 전력 채널 배율
`in_power[0-2]_active_calibbias`유효 전력 보정 오프셋, xWATTOS 레지스터
`in_power[0-2]_active_calibscale`유효 전력 보정 이득, APGAIN 레지스터
`in_power[0-2]_reactive_raw`A·B·C상의 무효 전력 측정값
`in_power[0-2]_reactive_scale`무효 전력 채널 배율
`in_power[0-2]_reactive_calibbias`무효 전력 보정 오프셋, xVAROS 레지스터
`in_power[0-2]_apparent_raw`A·B·C상의 피상 전력 측정값
`in_power[0-2]_apparent_scale`피상 전력 채널 배율
`in_power[0-2]_powerfactor`A·B·C상의 역률

세 상의 유효·무효·피상 전력과 역률을 노출합니다.

에너지 측정 장치 파일
장치 파일설명
`in_energy[0-2]_active_raw`A·B·C상의 유효 에너지 측정값
`in_energy[0-2]_reactive_raw`A·B·C상의 무효 에너지 측정값
`in_energy[0-2]_apparent_raw`A·B·C상의 피상 에너지 측정값

각 상에서 누적된 세 종류의 에너지 측정값입니다.

공유 장치 속성
속성설명
`name`IIO 장치 이름
`filter_type`파형 버퍼 필터 형식: `sinc4` 또는 `sinc4+lp`
`filter_type_available`파형 버퍼에서 선택할 수 있는 필터 형식

모든 채널에 공통인 장치 식별자와 파형 필터 설정입니다.

세 상 측정값의 속성 구성
채널 인덱스 0·1·2를 A·B·C상에 대응전류와 전압에서 raw·scale·보정 속성 제공DSP 결과를 active·reactive·apparent 전력으로 구분누적 에너지는 energy raw 속성으로 노출공통 파형 필터는 장치 수준 속성으로 선택

채널 번호와 측정 종류가 sysfs 파일 이름으로 결합되는 규칙입니다.


+---------------------------------------------------+----------------------------------------------------------+
| Current measurement related device files          | Description                                              |
+---------------------------------------------------+----------------------------------------------------------+
| in_current[0-2]_raw                               | Raw current measurement for phases A, B, C.              |
+---------------------------------------------------+----------------------------------------------------------+
| in_current[0-2]_scale                             | Scale for current channels.                              |
+---------------------------------------------------+----------------------------------------------------------+
| in_current[0-2]_calibscale                        | Calibration gain for current channels (AIGAIN reg).      |
+---------------------------------------------------+----------------------------------------------------------+
| in_altcurrent[0-2]_rms_raw                        | RMS current measurement for phases A, B, C.              |
+---------------------------------------------------+----------------------------------------------------------+
| in_altcurrent[0-2]_rms_scale                      | Scale for RMS current channels.                          |
+---------------------------------------------------+----------------------------------------------------------+
| in_altcurrent[0-2]_rms_calibbias                  | RMS offset correction for current channels (IRMSOS reg). |
+---------------------------------------------------+----------------------------------------------------------+

+---------------------------------------------------+----------------------------------------------------------+
| Voltage measurement related device files          | Description                                              |
+---------------------------------------------------+----------------------------------------------------------+
| in_voltage[0-2]_raw                               | Raw voltage measurement for phases A, B, C.              |
+---------------------------------------------------+----------------------------------------------------------+
| in_voltage[0-2]_scale                             | Scale for voltage channels.                              |
+---------------------------------------------------+----------------------------------------------------------+
| in_voltage[0-2]_calibscale                        | Calibration gain for voltage channels (AVGAIN reg).      |
+---------------------------------------------------+----------------------------------------------------------+
| in_voltage[0-2]_frequency                         | Measured line frequency from instantaneous voltage.      |
+---------------------------------------------------+----------------------------------------------------------+
| in_altvoltage[0-2]_rms_raw                        | RMS voltage measurement for phases A, B, C.              |
+---------------------------------------------------+----------------------------------------------------------+
| in_altvoltage[0-2]_rms_scale                      | Scale for RMS voltage channels.                          |
+---------------------------------------------------+----------------------------------------------------------+
| in_altvoltage[0-2]_rms_calibbias                  | RMS offset correction for voltage channels (VRMSOS reg). |
+---------------------------------------------------+----------------------------------------------------------+

+---------------------------------------------------+----------------------------------------------------------+
| Power measurement related device files            | Description                                              |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_active_raw                          | Active power measurement for phases A, B, C.             |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_active_scale                        | Scale for active power channels.                         |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_active_calibbias                    | Calibration offset for active power (xWATTOS regs).      |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_active_calibscale                   | Calibration gain for active power (APGAIN reg).          |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_reactive_raw                        | Reactive power measurement for phases A, B, C.           |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_reactive_scale                      | Scale for reactive power channels.                       |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_reactive_calibbias                  | Calibration offset for reactive power (xVAROS regs).     |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_apparent_raw                        | Apparent power measurement for phases A, B, C.           |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_apparent_scale                      | Scale for apparent power channels.                       |
+---------------------------------------------------+----------------------------------------------------------+
| in_power[0-2]_powerfactor                         | Power factor for phases A, B, C.                         |
+---------------------------------------------------+----------------------------------------------------------+

+---------------------------------------------------+----------------------------------------------------------+
| Energy measurement related device files           | Description                                              |
+---------------------------------------------------+----------------------------------------------------------+
| in_energy[0-2]_active_raw                         | Active energy measurement for phases A, B, C.            |
+---------------------------------------------------+----------------------------------------------------------+
| in_energy[0-2]_reactive_raw                       | Reactive energy measurement for phases A, B, C.          |
+---------------------------------------------------+----------------------------------------------------------+
| in_energy[0-2]_apparent_raw                       | Apparent energy measurement for phases A, B, C.          |
+---------------------------------------------------+----------------------------------------------------------+

+------------------------------+------------------------------------------------------------------+
| Shared device attributes     | Description                                                      |
+------------------------------+------------------------------------------------------------------+
| name                         | Name of the IIO device.                                          |
+------------------------------+------------------------------------------------------------------+
| filter_type                  | Waveform buffer filter type (sinc4, sinc4+lp).                   |
+------------------------------+------------------------------------------------------------------+
| filter_type_available        | Available filter types for waveform buffer.                      |
+------------------------------+------------------------------------------------------------------+

보정 단계와 IIO 이벤트

115-164

ADE9000은 여러 단계의 이득 및 오프셋 보정을 제공합니다.

채널별 Calibration Gain은 각 채널 유형에 디지털 영역에서 적용하는 미세 조정 보정 이득입니다. `calibscale` 속성으로 제어하며 AIGAIN, AVGAIN, APGAIN 레지스터에 대응합니다.

채널별 Calibration Bias는 장치 내부에서 적용하는 하드웨어 보정 오프셋입니다. 전력 채널의 `calibbias` 속성은 xWATTOS와 xVAROS 레지스터를 제어하고, RMS 채널의 `calibbias` 속성은 IRMSOS와 VRMSOS 레지스터를 제어합니다. 이 값은 사용자 공간에서 사후 적용하는 오프셋이 아니라 칩 내부 보정입니다.

ADE9000 보정 계층
보정IIO 속성대상레지스터
Calibration Gain`calibscale`전류·전압·유효 전력AIGAIN, AVGAIN, APGAIN
Calibration Bias`calibbias`유효·무효 전력xWATTOS, xVAROS
RMS Calibration Bias`calibbias`RMS 전류·전압IRMSOS, VRMSOS

이득과 바이어스가 적용되는 영역 및 대응 레지스터입니다.

ADE9000의 여러 인터럽트는 IIO 이벤트로 매핑됩니다. 해당 인터럽트를 Device Tree에 연결했을 때만 이벤트 기능을 사용할 수 있습니다.

ADE9000 IIO 이벤트 속성
IIO 이벤트 속성ADE9000 데이터시트 대응
`in_voltage[0-2]_thresh_either_en`전압 영점 통과 인터럽트 ZXVx
`in_altvoltage[0-2]_rms_thresh_rising_en`RMS swell 감지 인터럽트 SWELLx
`in_altvoltage[0-2]_rms_thresh_rising_value`RMS swell 임계값, SWELL_LVL
`in_altvoltage[0-2]_rms_thresh_falling_en`RMS sag/dip 감지 인터럽트 DIPx
`in_altvoltage[0-2]_rms_thresh_falling_value`RMS sag/dip 임계값, DIP_LVL
`in_current[0-2]_thresh_either_en`전류 영점 통과 인터럽트 ZXIx

IIO 이벤트 파일과 데이터시트의 인터럽트·임계값을 대응시킵니다.

IIO 이벤트 방향
방향의미
`rising`상한 임계값 통과, swell 감지
`falling`하한 임계값 통과, sag/dip 감지
`either`어느 방향이든 임계값 통과, 영점 통과 감지
`none`시간 초과 또는 방향이 없는 이벤트

이벤트 방향 이름이 나타내는 임계값 통과 방식입니다.

이벤트 속성은 Device Tree에 해당 인터럽트 `irq0`, `irq1`, `dready`가 지정된 경우에만 나타납니다. 인터럽트가 없어도 드라이버는 동작하지만 사용할 수 있는 기능이 줄어듭니다.

임계값 이벤트 처리
Device Tree에서 irq0·irq1·dready 연결RMS swell 또는 sag/dip 임계값 설정대응 이벤트 enable 속성 활성화ADE9000 인터럽트 발생IIO event 방향과 채널 정보로 사용자 공간에 전달

칩의 전력 품질 감지가 IIO 이벤트로 전달되는 경로입니다.

3. Calibration and scaling
===========================

The ADE9000 provides multiple levels of gain and offset correction:

**Calibration Gain (per-channel)**
  Fine-tuning calibration gains applied in the digital domain for each channel type.
  Controlled via ``calibscale`` attributes (AIGAIN, AVGAIN, APGAIN registers).

**Calibration Bias (per-channel)**
  Hardware calibration offsets applied by the device internally:

  - Power measurements: Controlled via ``calibbias`` attributes for power channels (xWATTOS, xVAROS registers).
  - RMS measurements: Controlled via ``calibbias`` attributes for RMS channels (IRMSOS, VRMSOS registers).

  These are internal chip calibrations, not userspace-applied offsets.

4. Event attributes
===================

The ADE9000 provides various interrupts that are mapped to IIO events.
Event functionality is only available if the corresponding interrupts are
connected in the device tree.

+---------------------------------------------------+----------------------------------------------------------+
| IIO Event Attribute                               | ADE9000 Datasheet Equivalent                             |
+---------------------------------------------------+----------------------------------------------------------+
| in_voltage[0-2]_thresh_either_en                  | Zero crossing detection interrupt (ZXVx)                 |
+---------------------------------------------------+----------------------------------------------------------+
| in_altvoltage[0-2]_rms_thresh_rising_en           | RMS swell detection interrupt (SWELLx)                   |
+---------------------------------------------------+----------------------------------------------------------+
| in_altvoltage[0-2]_rms_thresh_rising_value        | RMS swell threshold (SWELL_LVL register)                 |
+---------------------------------------------------+----------------------------------------------------------+
| in_altvoltage[0-2]_rms_thresh_falling_en          | RMS sag/dip detection interrupt (DIPx)                   |
+---------------------------------------------------+----------------------------------------------------------+
| in_altvoltage[0-2]_rms_thresh_falling_value       | RMS sag/dip threshold (DIP_LVL register)                 |
+---------------------------------------------------+----------------------------------------------------------+
| in_current[0-2]_thresh_either_en                  | Current zero crossing detection interrupt (ZXIx)         |
+---------------------------------------------------+----------------------------------------------------------+

Event directions:

- ``rising``: Upper threshold crossing (swell detection)
- ``falling``: Lower threshold crossing (sag/dip detection)
- ``either``: Any threshold crossing (zero crossing detection)
- ``none``: Timeout or non-directional events

**Note**: Event attributes are only available if the corresponding interrupts
(irq0, irq1, dready) are specified in the device tree. The driver works without
interrupts but with reduced functionality.

파형 버퍼와 CLKOUT

165-207

이 드라이버는 파형 캡처용 IIO 버퍼를 지원합니다. 버퍼 기능을 사용하려면 `dready` 인터럽트를 연결해야 합니다.

ADE9000은 전력 품질 분석을 위해 전압과 전류 파형을 캡처할 수 있습니다. 파형 버퍼는 여러 채널 조합 가운데 하나를 선택하도록 구성할 수 있습니다.

버퍼 캡처 채널 조합
선택활성 채널
A상IA + VA
B상IB + VB
C상IC + VC
모든 상모든 전압·전류 채널
개별 채널IA, VA, IB, VB, IC, VC 중 선택

상별 전압·전류 쌍, 전체 채널 또는 개별 채널을 선택할 수 있습니다.

다음 명령은 A상의 전류와 전압 파형 캡처를 활성화합니다.

root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_current0_en
root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_voltage0_en

다음 명령은 버퍼 길이를 100으로 설정한 뒤 버퍼를 활성화합니다.

root:/sys/bus/iio/devices/iio:device0> echo 100 > buffer/length
root:/sys/bus/iio/devices/iio:device0> echo 1 > buffer/enable
A상 파형 캡처
`in_current0_en`을 1로 설정`in_voltage0_en`을 1로 설정`buffer/length`를 100으로 설정`buffer/enable`을 1로 설정`dready`에 맞춰 IA·VA 파형 수집

scan element 선택부터 버퍼 시작까지의 명령 순서입니다.

외부 크리스털 또는 클록 소스를 사용할 때 ADE9000은 CLKOUT 핀으로 클록을 출력할 수 있습니다. Device Tree에 `#clock-cells = <0>`을 지정하면 이 기능이 활성화됩니다. 출력 클록은 `clkout`이라는 이름으로 등록되며 다른 장치가 참조할 수 있습니다.

ADE9000 CLKOUT 등록
조건등록 결과소비자 사용
외부 crystal/clock 사용CLKOUT 핀 동작하드웨어 클록 출력
`#clock-cells = <0>``clkout` 등록다른 Device Tree 장치가 참조

외부 클록 입력을 다른 장치가 사용할 수 있는 clock provider 출력으로 노출합니다.


5. Device buffers
=================

This driver supports IIO buffers for waveform capture. Buffer functionality
requires the dready interrupt to be connected.

The device supports capturing voltage and current waveforms for power quality
analysis. The waveform buffer can be configured to capture data from different
channel combinations.

Supported channel combinations for buffered capture:

- Phase A: voltage and current (IA + VA)
- Phase B: voltage and current (IB + VB)
- Phase C: voltage and current (IC + VC)
- All phases: all voltage and current channels
- Individual channels: IA, VA, IB, VB, IC, VC

Usage examples
--------------

Enable waveform capture for Phase A:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_current0_en
        root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_voltage0_en

Set buffer length and enable:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> echo 100 > buffer/length
        root:/sys/bus/iio/devices/iio:device0> echo 1 > buffer/enable

6. Clock output
===============

The ADE9000 can provide a clock output via the CLKOUT pin when using an external
crystal/clock source. This feature is enabled by specifying ``#clock-cells = <0>``
in the device tree. The output clock will be registered as "clkout" and can be
referenced by other devices.

측정·보정·이벤트 사용 예

208-268

장치 이름을 확인하려면 `name`을 읽습니다. 예제 결과는 `ade9000`입니다.

root:/sys/bus/iio/devices/iio:device0> cat name
ade9000

A상 전압은 `in_voltage0_raw`와 `in_voltage0_scale`을 읽어 계산합니다. 예제 값 12345와 0.000030517을 곱하면 0.3769 V입니다.

root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_raw
12345
root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_scale
0.000030517
Phase A voltage = in_voltage0_raw * in_voltage0_scale = 0.3769 V

A상 유효 전력도 같은 방식으로 `in_power0_active_raw`와 `in_power0_scale`을 곱합니다. 예제 값 5678과 0.000244140의 결과는 1.386 W입니다.

root:/sys/bus/iio/devices/iio:device0> cat in_power0_active_raw
5678
root:/sys/bus/iio/devices/iio:device0> cat in_power0_scale
0.000244140
Phase A active power = in_power0_active_raw * in_power0_scale = 1.386 W

다음 예제는 전류 채널 0의 보정 이득을 `0x800000`으로, 전압 채널 0의 보정 이득을 `0x7FFFFF`로 설정합니다.

# Set current channel 0 calibration gain
root:/sys/bus/iio/devices/iio:device0> echo 0x800000 > in_current0_calibscale
# Set voltage channel 0 calibration gain
root:/sys/bus/iio/devices/iio:device0> echo 0x7FFFFF > in_voltage0_calibscale

RMS 전압 이벤트 임계값 설정은 인터럽트가 연결된 경우에만 사용할 수 있습니다. 다음 명령은 sag 감지 임계값을 180000으로 설정해 활성화하고, swell 감지 임계값을 260000으로 설정해 활성화합니다.

# Set RMS sag detection threshold
root:/sys/bus/iio/devices/iio:device0> echo 180000 > events/in_altvoltage0_rms_thresh_falling_value
# Enable RMS sag detection
root:/sys/bus/iio/devices/iio:device0> echo 1 > events/in_altvoltage0_rms_thresh_falling_en

# Set RMS swell detection threshold
root:/sys/bus/iio/devices/iio:device0> echo 260000 > events/in_altvoltage0_rms_thresh_rising_value
# Enable RMS swell detection
root:/sys/bus/iio/devices/iio:device0> echo 1 > events/in_altvoltage0_rms_thresh_rising_en
ADE9000 예제 계산과 설정
작업입력·설정결과
A상 전압12345 × 0.0000305170.3769 V
A상 유효 전력5678 × 0.0002441401.386 W
전류 보정 이득`in_current0_calibscale = 0x800000`AIGAIN 조정
전압 보정 이득`in_voltage0_calibscale = 0x7FFFFF`AVGAIN 조정
RMS sagfalling threshold 180000하한 이벤트 활성화
RMS swellrising threshold 260000상한 이벤트 활성화

원문 예제의 입력 파일, 연산 또는 설정 결과를 한눈에 정리합니다.

ADE9000 운영 절차
`name`으로 장치 식별raw와 scale을 읽어 실제 전압·전력 계산`calibscale`로 채널별 이득 보정RMS falling·rising 임계값 설정대응 이벤트를 활성화해 sag·swell 감시

장치 확인부터 보정과 전력 품질 이벤트 감시까지의 예제 흐름입니다.

사용 가능한 IIO 인터페이스 도구에 관한 설명은 `Documentation/iio/iio_tools.rst`를 참고합니다.


7. Usage examples
=================

Show device name:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat name
        ade9000

Read voltage measurements:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_raw
        12345
        root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_scale
        0.000030517

- Phase A voltage = in_voltage0_raw * in_voltage0_scale = 0.3769 V

Read power measurements:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat in_power0_active_raw
        5678
        root:/sys/bus/iio/devices/iio:device0> cat in_power0_scale
        0.000244140

- Phase A active power = in_power0_active_raw * in_power0_scale = 1.386 W

Configure calibration gains:

.. code-block:: bash

        # Set current channel 0 calibration gain
        root:/sys/bus/iio/devices/iio:device0> echo 0x800000 > in_current0_calibscale
        # Set voltage channel 0 calibration gain
        root:/sys/bus/iio/devices/iio:device0> echo 0x7FFFFF > in_voltage0_calibscale

Configure RMS voltage event thresholds (requires interrupts):

.. code-block:: bash

        # Set RMS sag detection threshold
        root:/sys/bus/iio/devices/iio:device0> echo 180000 > events/in_altvoltage0_rms_thresh_falling_value
        # Enable RMS sag detection
        root:/sys/bus/iio/devices/iio:device0> echo 1 > events/in_altvoltage0_rms_thresh_falling_en

        # Set RMS swell detection threshold
        root:/sys/bus/iio/devices/iio:device0> echo 260000 > events/in_altvoltage0_rms_thresh_rising_value
        # Enable RMS swell detection
        root:/sys/bus/iio/devices/iio:device0> echo 1 > events/in_altvoltage0_rms_thresh_rising_en

8. IIO Interfacing Tools
========================

See ``Documentation/iio/iio_tools.rst`` for the description of the available IIO
interfacing tools.