← Documents Documentation/wmi/devices/dell-wmi-ddv.rst GitHub 원문 ↗

Linux 6.18.37 · WMI / Device Drivers

Dell DDV WMI interface driver (dell-wmi-ddv)

Dell Data Vault WMI의 battery, ePPID, analytics, fan·thermal sensor data 형식과 ACPI battery 매칭 절차를 설명합니다.

Source pathDocumentation/wmi/devices/dell-wmi-ddv.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

dell-wmi-ddv.rst:1-319

Dell Data Vault WMI의 battery, ePPID, analytics, fan·thermal sensor data 형식과 ACPI battery 매칭 절차를 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0-or-later
2
3 ============================================
4 Dell DDV WMI interface driver (dell-wmi-ddv)
5 ============================================
6
7 Introduction
8 ============
9
10 Many Dell notebooks made after ~2020 support a WMI-based interface for
11 retrieving various system data like battery temperature, ePPID, diagnostic data
12 and fan/thermal sensor data.
13
14 This interface is likely used by the `Dell Data Vault` software on Windows,
15 so it was called `DDV`. Currently the ``dell-wmi-ddv`` driver supports
16 version 2 and 3 of the interface, with support for new interface versions
17 easily added.
18
19 .. warning:: The interface is regarded as internal by Dell, so no vendor
20 documentation is available. All knowledge was thus obtained by
21 trial-and-error, please keep that in mind.
22
23 Dell ePPID (electronic Piece Part Identification)
24 =================================================
25
26 The Dell ePPID is used to uniquely identify components in Dell machines,
27 including batteries. It has a form similar to `CC-PPPPPP-MMMMM-YMD-SSSS-FFF`
28 and contains the following information:
29
30 * Country code of origin (CC).
31 * Part number with the first character being a filling number (PPPPPP).
32 * Manufacture Identification (MMMMM).
33 * Manufacturing Year/Month/Date (YMD) in base 36, with Y being the last digit
34 of the year.
35 * Manufacture Sequence Number (SSSS).
36 * Optional Firmware Version/Revision (FFF).
37
38 The `eppidtool <https://pypi.org/project/eppidtool>`_ python utility can be used
39 to decode and display this information.
40
41 All information regarding the Dell ePPID was gathered using Dell support
42 documentation and `this website <https://telcontar.net/KBK/Dell/date_codes>`_.
43
44 WMI interface description
45 =========================
46
47 The WMI interface description can be decoded from the embedded binary MOF (bmof)
48 data using the `bmfdec <https://github.com/pali/bmfdec>`_ utility:
49
50 ::
51
52 [WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x409"), Description("WMI Function"), guid("{8A42EA14-4F2A-FD45-6422-0087F7A7E608}")]
53 class DDVWmiMethodFunction {
54 [key, read] string InstanceName;
55 [read] boolean Active;
56
57 [WmiMethodId(1), Implemented, read, write, Description("Return Battery Design Capacity.")] void BatteryDesignCapacity([in] uint32 arg2, [out] uint32 argr);
58 [WmiMethodId(2), Implemented, read, write, Description("Return Battery Full Charge Capacity.")] void BatteryFullChargeCapacity([in] uint32 arg2, [out] uint32 argr);
59 [WmiMethodId(3), Implemented, read, write, Description("Return Battery Manufacture Name.")] void BatteryManufactureName([in] uint32 arg2, [out] string argr);
60 [WmiMethodId(4), Implemented, read, write, Description("Return Battery Manufacture Date.")] void BatteryManufactureDate([in] uint32 arg2, [out] uint32 argr);
61 [WmiMethodId(5), Implemented, read, write, Description("Return Battery Serial Number.")] void BatterySerialNumber([in] uint32 arg2, [out] uint32 argr);
62 [WmiMethodId(6), Implemented, read, write, Description("Return Battery Chemistry Value.")] void BatteryChemistryValue([in] uint32 arg2, [out] string argr);
63 [WmiMethodId(7), Implemented, read, write, Description("Return Battery Temperature.")] void BatteryTemperature([in] uint32 arg2, [out] uint32 argr);
64 [WmiMethodId(8), Implemented, read, write, Description("Return Battery Current.")] void BatteryCurrent([in] uint32 arg2, [out] uint32 argr);
65 [WmiMethodId(9), Implemented, read, write, Description("Return Battery Voltage.")] void BatteryVoltage([in] uint32 arg2, [out] uint32 argr);
66 [WmiMethodId(10), Implemented, read, write, Description("Return Battery Manufacture Access(MA code).")] void BatteryManufactureAceess([in] uint32 arg2, [out] uint32 argr);
67 [WmiMethodId(11), Implemented, read, write, Description("Return Battery Relative State-Of-Charge.")] void BatteryRelativeStateOfCharge([in] uint32 arg2, [out] uint32 argr);
68 [WmiMethodId(12), Implemented, read, write, Description("Return Battery Cycle Count")] void BatteryCycleCount([in] uint32 arg2, [out] uint32 argr);
69 [WmiMethodId(13), Implemented, read, write, Description("Return Battery ePPID")] void BatteryePPID([in] uint32 arg2, [out] string argr);
70 [WmiMethodId(14), Implemented, read, write, Description("Return Battery Raw Analytics Start")] void BatteryeRawAnalyticsStart([in] uint32 arg2, [out] uint32 argr);
71 [WmiMethodId(15), Implemented, read, write, Description("Return Battery Raw Analytics")] void BatteryeRawAnalytics([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
72 [WmiMethodId(16), Implemented, read, write, Description("Return Battery Design Voltage.")] void BatteryDesignVoltage([in] uint32 arg2, [out] uint32 argr);
73 [WmiMethodId(17), Implemented, read, write, Description("Return Battery Raw Analytics A Block")] void BatteryeRawAnalyticsABlock([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
74 [WmiMethodId(18), Implemented, read, write, Description("Return Version.")] void ReturnVersion([in] uint32 arg2, [out] uint32 argr);
75 [WmiMethodId(32), Implemented, read, write, Description("Return Fan Sensor Information")] void FanSensorInformation([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
76 [WmiMethodId(34), Implemented, read, write, Description("Return Thermal Sensor Information")] void ThermalSensorInformation([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
77 };
78
79 Each WMI method takes an ACPI buffer containing a 32-bit index as input argument,
80 with the first 8 bit being used to specify the battery when using battery-related
81 WMI methods. Other WMI methods may ignore this argument or interpret it
82 differently. The WMI method output format varies:
83
84 * if the function has only a single output, then an ACPI object
85 of the corresponding type is returned
86 * if the function has multiple outputs, when an ACPI package
87 containing the outputs in the same order is returned
88
89 The format of the output should be thoroughly checked, since many methods can
90 return malformed data in case of an error.
91
92 The data format of many battery-related methods seems to be based on the
93 `Smart Battery Data Specification`, so unknown battery-related methods are
94 likely to follow this standard in some way.
95
96 WMI method GetBatteryDesignCapacity()
97 -------------------------------------
98
99 Returns the design capacity of the battery in mAh as an u16.
100
101 WMI method BatteryFullCharge()
102 ------------------------------
103
104 Returns the full charge capacity of the battery in mAh as an u16.
105
106 WMI method BatteryManufactureName()
107 -----------------------------------
108
109 Returns the manufacture name of the battery as an ASCII string.
110
111 WMI method BatteryManufactureDate()
112 -----------------------------------
113
114 Returns the manufacture date of the battery as an u16.
115 The date is encoded in the following manner:
116
117 - bits 0 to 4 contain the manufacture day.
118 - bits 5 to 8 contain the manufacture month.
119 - bits 9 to 15 contain the manufacture year biased by 1980.
120
121 WMI method BatterySerialNumber()
122 --------------------------------
123
124 Returns the serial number of the battery as an u16.
125
126 WMI method BatteryChemistryValue()
127 ----------------------------------
128
129 Returns the chemistry of the battery as an ASCII string.
130 Known values are:
131
132 - "Li-I" for Li-Ion
133
134 WMI method BatteryTemperature()
135 -------------------------------
136
137 Returns the temperature of the battery in tenth degree kelvin as an u16.
138
139 WMI method BatteryCurrent()
140 ---------------------------
141
142 Returns the current flow of the battery in mA as an s16.
143 Negative values indicate discharging.
144
145 WMI method BatteryVoltage()
146 ---------------------------
147
148 Returns the voltage flow of the battery in mV as an u16.
149
150 WMI method BatteryManufactureAccess()
151 -------------------------------------
152
153 Returns the health status of the battery as a u16.
154 The health status encoded in the following manner:
155
156 - the third nibble contains the general failure mode
157 - the fourth nibble contains the specific failure code
158
159 Valid failure modes are:
160
161 - permanent failure (``0x9``)
162 - overheat failure (``0xa``)
163 - overcurrent failure (``0xb``)
164
165 All other failure modes are to be considered normal.
166
167 The following failure codes are valid for a permanent failure:
168
169 - fuse blown (``0x0``)
170 - cell imbalance (``0x1``)
171 - overvoltage (``0x2``)
172 - fet failure (``0x3``)
173
174 The last two bits of the failure code are to be ignored when the battery
175 signals a permanent failure.
176
177 The following failure codes a valid for a overheat failure:
178
179 - overheat at start of charging (``0x5``)
180 - overheat during charging (``0x7``)
181 - overheat during discharging (``0x8``)
182
183 The following failure codes are valid for a overcurrent failure:
184
185 - overcurrent during charging (``0x6``)
186 - overcurrent during discharging (``0xb``)
187
188 WMI method BatteryRelativeStateOfCharge()
189 -----------------------------------------
190
191 Returns the capacity of the battery in percent as an u16.
192
193 WMI method BatteryCycleCount()
194 ------------------------------
195
196 Returns the cycle count of the battery as an u16.
197
198 WMI method BatteryePPID()
199 -------------------------
200
201 Returns the ePPID of the battery as an ASCII string.
202
203 WMI method BatteryeRawAnalyticsStart()
204 --------------------------------------
205
206 Performs an analysis of the battery and returns a status code:
207
208 - ``0x0``: Success
209 - ``0x1``: Interface not supported
210 - ``0xfffffffe``: Error/Timeout
211
212 .. note::
213 The meaning of this method is still largely unknown.
214
215 WMI method BatteryeRawAnalytics()
216 ---------------------------------
217
218 Returns a buffer usually containing 12 blocks of analytics data.
219 Those blocks contain:
220
221 - a block number starting with 0 (u8)
222 - 31 bytes of unknown data
223
224 .. note::
225 The meaning of this method is still largely unknown.
226
227 WMI method BatteryDesignVoltage()
228 ---------------------------------
229
230 Returns the design voltage of the battery in mV as an u16.
231
232 WMI method BatteryeRawAnalyticsABlock()
233 ---------------------------------------
234
235 Returns a single block of analytics data, with the second byte
236 of the index being used for selecting the block number.
237
238 *Supported since WMI interface version 3!*
239
240 .. note::
241 The meaning of this method is still largely unknown.
242
243 WMI method ReturnVersion()
244 --------------------------
245
246 Returns the WMI interface version as an u32.
247
248 WMI method FanSensorInformation()
249 ---------------------------------
250
251 Returns a buffer containing fan sensor entries, terminated
252 with a single ``0xff``.
253 Those entries contain:
254
255 - fan type (u8)
256 - fan speed in RPM (little endian u16)
257
258 WMI method ThermalSensorInformation()
259 -------------------------------------
260
261 Returns a buffer containing thermal sensor entries, terminated
262 with a single ``0xff``.
263 Those entries contain:
264
265 - thermal type (u8)
266 - current temperature (s8)
267 - min. temperature (s8)
268 - max. temperature (s8)
269 - unknown field (u8)
270
271 .. note::
272 TODO: Find out what the meaning of the last byte is.
273
274 ACPI battery matching algorithm
275 ===============================
276
277 The algorithm used to match ACPI batteries to indices is based on information
278 which was found inside the logging messages of the OEM software.
279
280 Basically for each new ACPI battery, the serial numbers of the batteries behind
281 indices 1 till 3 are compared with the serial number of the ACPI battery.
282 Since the serial number of the ACPI battery can either be encoded as a normal
283 integer or as a hexadecimal value, both cases need to be checked. The first
284 index with a matching serial number is then selected.
285
286 A serial number of 0 indicates that the corresponding index is not associated
287 with an actual battery, or that the associated battery is not present.
288
289 Some machines like the Dell Inspiron 3505 only support a single battery and thus
290 ignore the battery index. Because of this the driver depends on the ACPI battery
291 hook mechanism to discover batteries.
292
293 Reverse-Engineering the DDV WMI interface
294 =========================================
295
296 1. Find a supported Dell notebook, usually made after ~2020.
297 2. Dump the ACPI tables and search for the WMI device (usually called "ADDV").
298 3. Decode the corresponding bmof data and look at the ASL code.
299 4. Try to deduce the meaning of a certain WMI method by comparing the control
300 flow with other ACPI methods (_BIX or _BIF for battery related methods
301 for example).
302 5. Use the built-in UEFI diagnostics to view sensor types/values for fan/thermal
303 related methods (sometimes overwriting static ACPI data fields can be used
304 to test different sensor type values, since on some machines this data is
305 not reinitialized upon a warm reset).
306
307 Alternatively:
308
309 1. Load the ``dell-wmi-ddv`` driver, use the ``force`` module param
310 if necessary.
311 2. Use the debugfs interface to access the raw fan/thermal sensor buffer data.
312 3. Compare the data with the built-in UEFI diagnostics.
313
314 In case the DDV WMI interface version available on your Dell notebook is not
315 supported or you are seeing unknown fan/thermal sensors, please submit a
316 bugreport on `bugzilla <https://bugzilla.kernel.org>`_ so they can be added
317 to the ``dell-wmi-ddv`` driver.
318
319 See Documentation/admin-guide/reporting-issues.rst for further information.
320

3. 한국어 전문 번역

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

DDV interface 개요와 주의 사항

1-22

대략 2020년 이후 제조된 많은 Dell notebook은 battery 온도, ePPID, 진단 data, fan 및 thermal sensor data를 가져오는 WMI 기반 interface를 지원합니다.

Windows의 Dell Data Vault software가 이 interface를 사용하는 것으로 보여 `DDV`라는 이름이 붙었습니다. 현재 `dell-wmi-ddv` 드라이버는 interface version 2와 3을 지원하며 새 version도 쉽게 추가할 수 있게 설계되었습니다.

Dell은 이 interface를 내부용으로 간주해 vendor 문서를 제공하지 않습니다. 알려진 내용은 모두 시행착오로 얻은 것이므로 field와 동작 설명에는 이 한계가 적용됩니다.

.. SPDX-License-Identifier: GPL-2.0-or-later

============================================
Dell DDV WMI interface driver (dell-wmi-ddv)
============================================

Introduction
============

Many Dell notebooks made after ~2020 support a WMI-based interface for
retrieving various system data like battery temperature, ePPID, diagnostic data
and fan/thermal sensor data.

This interface is likely used by the `Dell Data Vault` software on Windows,
so it was called `DDV`. Currently the ``dell-wmi-ddv`` driver supports
version 2 and 3 of the interface, with support for new interface versions
easily added.

.. warning:: The interface is regarded as internal by Dell, so no vendor
             documentation is available. All knowledge was thus obtained by
             trial-and-error, please keep that in mind.

Dell ePPID 형식

23-43

Dell ePPID(electronic Piece Part Identification)는 battery를 포함한 Dell 장치의 부품을 고유하게 식별합니다. 형식은 `CC-PPPPPP-MMMMM-YMD-SSSS-FFF`와 비슷합니다.

`YMD`는 base 36으로 표현한 제조 연·월·일이며 Y는 연도의 마지막 자리입니다. 마지막 firmware version 또는 revision field는 선택 사항입니다. `eppidtool` Python utility로 이 정보를 해석해 표시할 수 있습니다.

ePPID 구성
Field의미
CC원산지 국가 code
PPPPPP첫 문자가 filling number인 part number
MMMMM제조사 식별
YMDbase 36 제조 연·월·일; Y는 연도 마지막 자리
SSSS제조 sequence number
FFF선택적 firmware version 또는 revision

Dell 부품 식별 문자열의 각 field입니다.

Dell ePPID (electronic Piece Part Identification)
=================================================

The Dell ePPID is used to uniquely identify components in Dell machines,
including batteries. It has a form similar to `CC-PPPPPP-MMMMM-YMD-SSSS-FFF`
and contains the following information:

* Country code of origin (CC).
* Part number with the first character being a filling number (PPPPPP).
* Manufacture Identification (MMMMM).
* Manufacturing Year/Month/Date (YMD) in base 36, with Y being the last digit
  of the year.
* Manufacture Sequence Number (SSSS).
* Optional Firmware Version/Revision (FFF).

The `eppidtool <https://pypi.org/project/eppidtool>`_ python utility can be used
to decode and display this information.

All information regarding the Dell ePPID was gathered using Dell support
documentation and `this website <https://telcontar.net/KBK/Dell/date_codes>`_.

DDVWmiMethodFunction과 출력 형식

44-95

embedded binary MOF는 `bmfdec`로 해석할 수 있습니다. GUID `{8A42EA14-4F2A-FD45-6422-0087F7A7E608}`의 `DDVWmiMethodFunction`에는 battery 18종과 fan·thermal sensor 2종, 총 20개 method가 선언됩니다.

각 method는 32비트 index를 담은 ACPI buffer를 입력으로 받습니다. battery 관련 method에서는 처음 8비트가 battery를 지정합니다. 다른 method는 이 인수를 무시하거나 다른 방식으로 해석할 수 있습니다.

출력이 하나뿐이면 해당 type의 ACPI object를 반환하고, 출력이 여러 개이면 같은 순서로 담은 ACPI package를 반환합니다. 오류 때 malformed data를 반환하는 method가 많으므로 출력 형식을 철저히 검사해야 합니다.

여러 battery method의 data 형식은 Smart Battery Data Specification을 기반으로 한 것으로 보입니다. 따라서 알려지지 않은 battery method도 이 표준을 어느 정도 따를 가능성이 있습니다.

DDVWmiMethodFunction method
IDMethod반환 정보
1BatteryDesignCapacity설계 용량
2BatteryFullChargeCapacity완전 충전 용량
3BatteryManufactureName제조사 이름
4BatteryManufactureDate제조일
5BatterySerialNumberserial number
6BatteryChemistryValuebattery chemistry
7BatteryTemperature온도
8BatteryCurrent전류
9BatteryVoltage전압
10BatteryManufactureAceessmanufacturer access·health
11BatteryRelativeStateOfCharge상대 충전 상태
12BatteryCycleCountcycle 횟수
13BatteryePPIDbattery ePPID
14BatteryeRawAnalyticsStartraw analytics 시작
15BatteryeRawAnalyticsraw analytics 전체
16BatteryDesignVoltage설계 전압
17BatteryeRawAnalyticsABlockraw analytics 단일 block
18ReturnVersioninterface version
32FanSensorInformationfan sensor 정보
34ThermalSensorInformationthermal sensor 정보

bmof에 선언된 method ID와 알려진 목적입니다.

WMI interface description
=========================

The WMI interface description can be decoded from the embedded binary MOF (bmof)
data using the `bmfdec <https://github.com/pali/bmfdec>`_ utility:

::

 [WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x409"), Description("WMI Function"), guid("{8A42EA14-4F2A-FD45-6422-0087F7A7E608}")]
 class DDVWmiMethodFunction {
   [key, read] string InstanceName;
   [read] boolean Active;

   [WmiMethodId(1), Implemented, read, write, Description("Return Battery Design Capacity.")] void BatteryDesignCapacity([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(2), Implemented, read, write, Description("Return Battery Full Charge Capacity.")] void BatteryFullChargeCapacity([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(3), Implemented, read, write, Description("Return Battery Manufacture Name.")] void BatteryManufactureName([in] uint32 arg2, [out] string argr);
   [WmiMethodId(4), Implemented, read, write, Description("Return Battery Manufacture Date.")] void BatteryManufactureDate([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(5), Implemented, read, write, Description("Return Battery Serial Number.")] void BatterySerialNumber([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(6), Implemented, read, write, Description("Return Battery Chemistry Value.")] void BatteryChemistryValue([in] uint32 arg2, [out] string argr);
   [WmiMethodId(7), Implemented, read, write, Description("Return Battery Temperature.")] void BatteryTemperature([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(8), Implemented, read, write, Description("Return Battery Current.")] void BatteryCurrent([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(9), Implemented, read, write, Description("Return Battery Voltage.")] void BatteryVoltage([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(10), Implemented, read, write, Description("Return Battery Manufacture Access(MA code).")] void BatteryManufactureAceess([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(11), Implemented, read, write, Description("Return Battery Relative State-Of-Charge.")] void BatteryRelativeStateOfCharge([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(12), Implemented, read, write, Description("Return Battery Cycle Count")] void BatteryCycleCount([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(13), Implemented, read, write, Description("Return Battery ePPID")] void BatteryePPID([in] uint32 arg2, [out] string argr);
   [WmiMethodId(14), Implemented, read, write, Description("Return Battery Raw Analytics Start")] void BatteryeRawAnalyticsStart([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(15), Implemented, read, write, Description("Return Battery Raw Analytics")] void BatteryeRawAnalytics([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
   [WmiMethodId(16), Implemented, read, write, Description("Return Battery Design Voltage.")] void BatteryDesignVoltage([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(17), Implemented, read, write, Description("Return Battery Raw Analytics A Block")] void BatteryeRawAnalyticsABlock([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
   [WmiMethodId(18), Implemented, read, write, Description("Return Version.")] void ReturnVersion([in] uint32 arg2, [out] uint32 argr);
   [WmiMethodId(32), Implemented, read, write, Description("Return Fan Sensor Information")] void FanSensorInformation([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
   [WmiMethodId(34), Implemented, read, write, Description("Return Thermal Sensor Information")] void ThermalSensorInformation([in] uint32 arg2, [out] uint32 RawSize, [out, WmiSizeIs("RawSize") : ToInstance] uint8 RawData[]);
 };

Each WMI method takes an ACPI buffer containing a 32-bit index as input argument,
with the first 8 bit being used to specify the battery when using battery-related
WMI methods. Other WMI methods may ignore this argument or interpret it
differently. The WMI method output format varies:

* if the function has only a single output, then an ACPI object
  of the corresponding type is returned
* if the function has multiple outputs, when an ACPI package
  containing the outputs in the same order is returned

The format of the output should be thoroughly checked, since many methods can
return malformed data in case of an error.

The data format of many battery-related methods seems to be based on the
`Smart Battery Data Specification`, so unknown battery-related methods are
likely to follow this standard in some way.

기본 battery 정보 method

96-133

설계 용량과 완전 충전 용량은 `u16` mAh, 제조사 이름과 chemistry는 ASCII 문자열, serial number는 `u16`으로 반환됩니다. 알려진 chemistry 값 `Li-I`는 Li-Ion을 뜻합니다.

제조일은 `u16` bit field입니다. bit 0~4는 일, bit 5~8은 월, bit 9~15는 1980을 bias로 한 연도입니다.

기본 battery method
Method반환형식·단위
GetBatteryDesignCapacity설계 용량u16 mAh
BatteryFullCharge완전 충전 용량u16 mAh
BatteryManufactureName제조사 이름ASCII string
BatteryManufactureDate제조일u16 bit field
BatterySerialNumberserial numberu16
BatteryChemistryValuechemistryASCII string; Li-I는 Li-Ion

반환 type, 단위와 encoding입니다.

WMI method GetBatteryDesignCapacity()
-------------------------------------

Returns the design capacity of the battery in mAh as an u16.

WMI method BatteryFullCharge()
------------------------------

Returns the full charge capacity of the battery in mAh as an u16.

WMI method BatteryManufactureName()
-----------------------------------

Returns the manufacture name of the battery as an ASCII string.

WMI method BatteryManufactureDate()
-----------------------------------

Returns the manufacture date of the battery as an u16.
The date is encoded in the following manner:

- bits 0 to 4 contain the manufacture day.
- bits 5 to 8 contain the manufacture month.
- bits 9 to 15 contain the manufacture year biased by 1980.

WMI method BatterySerialNumber()
--------------------------------

Returns the serial number of the battery as an u16.

WMI method BatteryChemistryValue()
----------------------------------

Returns the chemistry of the battery as an ASCII string.
Known values are:

- "Li-I" for Li-Ion

온도·전류·전압과 health code

134-187

`BatteryTemperature`는 0.1 kelvin 단위 `u16`, `BatteryCurrent`는 mA 단위 `s16`, `BatteryVoltage`는 mV 단위 `u16`을 반환합니다. 전류가 음수이면 방전 중임을 뜻합니다.

`BatteryManufactureAccess`는 battery health를 `u16`으로 반환합니다. 세 번째 nibble은 일반 failure mode, 네 번째 nibble은 구체적인 failure code입니다. mode `0x9`는 permanent failure, `0xa`는 overheat, `0xb`는 overcurrent이며 다른 mode는 정상으로 간주합니다.

permanent failure일 때 failure code의 마지막 두 bit는 무시해야 합니다. 원문의 각 mode별 유효 code는 아래와 같습니다.

battery 측정값
Method반환 형식해석
BatteryTemperatureu16, 0.1 Kbattery 온도
BatteryCurrents16, mA음수는 방전
BatteryVoltageu16, mVbattery 전압

온도·전류·전압 반환 형식입니다.

health failure code
ModeCode의미
Permanent (0x9)0x0fuse blown
Permanent (0x9)0x1cell imbalance
Permanent (0x9)0x2overvoltage
Permanent (0x9)0x3FET failure
Overheat (0xa)0x5충전 시작 때 과열
Overheat (0xa)0x7충전 중 과열
Overheat (0xa)0x8방전 중 과열
Overcurrent (0xb)0x6충전 중 과전류
Overcurrent (0xb)0xb방전 중 과전류

failure mode별로 정의된 구체적 code입니다.

WMI method BatteryTemperature()
-------------------------------

Returns the temperature of the battery in tenth degree kelvin as an u16.

WMI method BatteryCurrent()
---------------------------

Returns the current flow of the battery in mA as an s16.
Negative values indicate discharging.

WMI method BatteryVoltage()
---------------------------

Returns the voltage flow of the battery in mV as an u16.

WMI method BatteryManufactureAccess()
-------------------------------------

Returns the health status of the battery as a u16.
The health status encoded in the following manner:

 - the third nibble contains the general failure mode
 - the fourth nibble contains the specific failure code

Valid failure modes are:

 - permanent failure (``0x9``)
 - overheat failure (``0xa``)
 - overcurrent failure (``0xb``)

All other failure modes are to be considered normal.

The following failure codes are valid for a permanent failure:

 - fuse blown (``0x0``)
 - cell imbalance (``0x1``)
 - overvoltage (``0x2``)
 - fet failure (``0x3``)

The last two bits of the failure code are to be ignored when the battery
signals a permanent failure.

The following failure codes a valid for a overheat failure:

 - overheat at start of charging (``0x5``)
 - overheat during charging (``0x7``)
 - overheat during discharging (``0x8``)

The following failure codes are valid for a overcurrent failure:

 - overcurrent during charging (``0x6``)
 - overcurrent during discharging (``0xb``)

충전 상태·cycle·battery ePPID

188-202

`BatteryRelativeStateOfCharge`는 battery 용량을 백분율 `u16`으로, `BatteryCycleCount`는 cycle 횟수를 `u16`으로 반환합니다. `BatteryePPID`는 battery ePPID를 ASCII 문자열로 반환합니다.

상태 식별 method
Method반환형식
BatteryRelativeStateOfCharge현재 용량u16 percent
BatteryCycleCountcycle 횟수u16
BatteryePPIDbattery ePPIDASCII string

battery 사용 상태와 식별값입니다.

WMI method BatteryRelativeStateOfCharge()
-----------------------------------------

Returns the capacity of the battery in percent as an u16.

WMI method BatteryCycleCount()
------------------------------

Returns the cycle count of the battery as an u16.

WMI method BatteryePPID()
-------------------------

Returns the ePPID of the battery as an ASCII string.

battery raw analytics

203-226

`BatteryeRawAnalyticsStart`는 battery 분석을 수행하고 status를 반환합니다. `0x0`은 성공, `0x1`은 interface 미지원, `0xfffffffe`는 오류 또는 timeout입니다. 이 method의 구체적인 의미는 아직 대부분 알려지지 않았습니다.

`BatteryeRawAnalytics`는 보통 analytics data 12개 block이 든 buffer를 반환합니다. 각 block은 0부터 시작하는 `u8` block number와 의미를 알 수 없는 31바이트로 구성됩니다. 이 data의 의미도 아직 대부분 알려지지 않았습니다.

raw analytics status
Code의미
0x0성공
0x1interface 미지원
0xfffffffe오류 또는 timeout

분석 시작 method의 알려진 반환 code입니다.

WMI method BatteryeRawAnalyticsStart()
--------------------------------------

Performs an analysis of the battery and returns a status code:

- ``0x0``: Success
- ``0x1``: Interface not supported
- ``0xfffffffe``: Error/Timeout

.. note::
   The meaning of this method is still largely unknown.

WMI method BatteryeRawAnalytics()
---------------------------------

Returns a buffer usually containing 12 blocks of analytics data.
Those blocks contain:

- a block number starting with 0 (u8)
- 31 bytes of unknown data

.. note::
   The meaning of this method is still largely unknown.

설계 전압·단일 analytics block·version

227-247

`BatteryDesignVoltage`는 설계 전압을 `u16` mV로 반환합니다. `BatteryeRawAnalyticsABlock`은 index의 두 번째 byte를 block number로 사용해 analytics data block 하나를 반환하며 WMI interface version 3부터 지원됩니다. block의 의미는 아직 대부분 알려지지 않았습니다.

`ReturnVersion`은 WMI interface version을 `u32`로 반환합니다.

version 관련 method
Method반환조건
BatteryDesignVoltageu16 mV모든 지원 version
BatteryeRawAnalyticsABlockanalytics 단일 blockversion 3부터
ReturnVersionu32 interface version모든 지원 version

단위와 지원 version을 함께 정리합니다.

WMI method BatteryDesignVoltage()
---------------------------------

Returns the design voltage of the battery in mV as an u16.

WMI method BatteryeRawAnalyticsABlock()
---------------------------------------

Returns a single block of analytics data, with the second byte
of the index being used for selecting the block number.

*Supported since WMI interface version 3!*

.. note::
   The meaning of this method is still largely unknown.

WMI method ReturnVersion()
--------------------------

Returns the WMI interface version as an u32.

fan·thermal sensor buffer

248-273

`FanSensorInformation`은 `0xff` 한 byte로 끝나는 fan sensor entry buffer를 반환합니다. 각 entry는 `u8` fan type과 little-endian `u16` RPM으로 구성됩니다.

`ThermalSensorInformation`도 `0xff`로 끝나는 entry buffer를 반환합니다. 각 entry는 `u8` thermal type, 현재·최소·최대 온도 `s8` 세 개, 의미가 알려지지 않은 `u8` 하나로 구성됩니다. 마지막 byte의 의미는 아직 조사 과제입니다.

sensor entry layout
Buffer종료Entry field
FanSensorInformation0xfffan type u8; RPM little-endian u16
ThermalSensorInformation0xffthermal type u8; current/min/max s8; unknown u8

buffer terminator와 entry field를 보존해 정리했습니다.

WMI method FanSensorInformation()
---------------------------------

Returns a buffer containing fan sensor entries, terminated
with a single ``0xff``.
Those entries contain:

- fan type (u8)
- fan speed in RPM (little endian u16)

WMI method ThermalSensorInformation()
-------------------------------------

Returns a buffer containing thermal sensor entries, terminated
with a single ``0xff``.
Those entries contain:

- thermal type (u8)
- current temperature (s8)
- min. temperature (s8)
- max. temperature (s8)
- unknown field (u8)

.. note::
   TODO: Find out what the meaning of the last byte is.

ACPI battery index 매칭

274-292

ACPI battery를 DDV index에 연결하는 algorithm은 OEM software log 메시지에서 발견한 정보를 바탕으로 합니다.

새 ACPI battery마다 DDV index 1~3의 serial number를 ACPI battery serial과 비교합니다. ACPI serial은 일반 정수 또는 16진수로 encode될 수 있으므로 두 경우를 모두 검사하고, 처음 일치하는 index를 선택합니다.

serial number 0은 해당 index가 실제 battery와 연결되지 않았거나 연결된 battery가 없는 상태를 뜻합니다. Dell Inspiron 3505처럼 battery 하나만 지원해 index를 무시하는 장치도 있어 드라이버는 ACPI battery hook으로 battery를 발견합니다.

battery index 선택
ACPI battery hook으로 새 battery 발견ACPI serial을 정수와 16진수 두 형식으로 준비DDV index 1부터 3까지 serial 조회serial 0은 비연결 또는 battery 없음으로 건너뜀처음 일치하는 DDV index 선택

ACPI battery와 DDV index 1~3을 연결하는 순서입니다.

ACPI battery matching algorithm
===============================

The algorithm used to match ACPI batteries to indices is based on information
which was found inside the logging messages of the OEM software.

Basically for each new ACPI battery, the serial numbers of the batteries behind
indices 1 till 3 are compared with the serial number of the ACPI battery.
Since the serial number of the ACPI battery can either be encoded as a normal
integer or as a hexadecimal value, both cases need to be checked. The first
index with a matching serial number is then selected.

A serial number of 0 indicates that the corresponding index is not associated
with an actual battery, or that the associated battery is not present.

Some machines like the Dell Inspiron 3505 only support a single battery and thus
ignore the battery index. Because of this the driver depends on the ACPI battery
hook mechanism to discover batteries.

DDV WMI reverse engineering 절차

293-319

지원 Dell notebook에서 ACPI table을 dump하고 보통 `ADDV`라는 WMI 장치를 찾은 뒤, bmof를 decode하고 ASL code를 조사합니다. battery method는 `_BIX`나 `_BIF` 같은 다른 ACPI method의 control flow와 비교해 의미를 추론할 수 있습니다.

fan·thermal method는 내장 UEFI 진단의 sensor type과 값을 비교합니다. 일부 장치는 warm reset 때 static ACPI field를 다시 초기화하지 않으므로 field를 덮어써 다른 sensor type 값을 시험할 수도 있습니다.

대안으로 `dell-wmi-ddv` 드라이버를 필요하면 `force` module parameter와 함께 load하고 debugfs에서 raw fan·thermal buffer를 읽어 UEFI 진단과 비교할 수 있습니다.

지원되지 않는 DDV WMI version 또는 알려지지 않은 fan·thermal sensor를 발견하면 kernel bugzilla에 bug report를 제출해 드라이버에 추가할 수 있습니다. 자세한 보고 절차는 `Documentation/admin-guide/reporting-issues.rst`를 참고합니다.

DDV 분석 경로
ACPI table에서 ADDV 탐색bmof decode와 ASL control flow 분석UEFI 진단에서 sensor type·값 확인debugfs raw buffer와 결과 비교새 version·sensor를 bugzilla에 보고

firmware source와 실제 sensor 값을 함께 비교하는 절차입니다.

Reverse-Engineering the DDV WMI interface
=========================================

1. Find a supported Dell notebook, usually made after ~2020.
2. Dump the ACPI tables and search for the WMI device (usually called "ADDV").
3. Decode the corresponding bmof data and look at the ASL code.
4. Try to deduce the meaning of a certain WMI method by comparing the control
   flow with other ACPI methods (_BIX or _BIF for battery related methods
   for example).
5. Use the built-in UEFI diagnostics to view sensor types/values for fan/thermal
   related methods (sometimes overwriting static ACPI data fields can be used
   to test different sensor type values, since on some machines this data is
   not reinitialized upon a warm reset).

Alternatively:

1. Load the ``dell-wmi-ddv`` driver, use the ``force`` module param
   if necessary.
2. Use the debugfs interface to access the raw fan/thermal sensor buffer data.
3. Compare the data with the built-in UEFI diagnostics.

In case the DDV WMI interface version available on your Dell notebook is not
supported or you are seeing unknown fan/thermal sensors, please submit a
bugreport on `bugzilla <https://bugzilla.kernel.org>`_ so they can be added
to the ``dell-wmi-ddv`` driver.

See Documentation/admin-guide/reporting-issues.rst for further information.