Commit | Line | Data |
---|---|---|
1da177e4 | 1 | Naming and data format standards for sysfs files |
b04f2f7d | 2 | ================================================ |
1da177e4 LT |
3 | |
4 | The libsensors library offers an interface to the raw sensors data | |
125ff808 JD |
5 | through the sysfs interface. Since lm-sensors 3.0.0, libsensors is |
6 | completely chip-independent. It assumes that all the kernel drivers | |
7 | implement the standard sysfs interface described in this document. | |
8 | This makes adding or updating support for any given chip very easy, as | |
9 | libsensors, and applications using it, do not need to be modified. | |
10 | This is a major improvement compared to lm-sensors 2. | |
1da177e4 LT |
11 | |
12 | Note that motherboards vary widely in the connections to sensor chips. | |
13 | There is no standard that ensures, for example, that the second | |
14 | temperature sensor is connected to the CPU, or that the second fan is on | |
15 | the CPU. Also, some values reported by the chips need some computation | |
16 | before they make full sense. For example, most chips can only measure | |
17 | voltages between 0 and +4V. Other voltages are scaled back into that | |
18 | range using external resistors. Since the values of these resistors | |
19 | can change from motherboard to motherboard, the conversions cannot be | |
20 | hard coded into the driver and have to be done in user space. | |
21 | ||
740e06a8 | 22 | For this reason, even if we aim at a chip-independent libsensors, it will |
1da177e4 LT |
23 | still require a configuration file (e.g. /etc/sensors.conf) for proper |
24 | values conversion, labeling of inputs and hiding of unused inputs. | |
25 | ||
26 | An alternative method that some programs use is to access the sysfs | |
27 | files directly. This document briefly describes the standards that the | |
28 | drivers follow, so that an application program can scan for entries and | |
29 | access this data in a simple and consistent way. That said, such programs | |
30 | will have to implement conversion, labeling and hiding of inputs. For | |
31 | this reason, it is still not recommended to bypass the library. | |
32 | ||
1da177e4 | 33 | Each chip gets its own directory in the sysfs /sys/devices tree. To |
740e06a8 | 34 | find all sensor chips, it is easier to follow the device symlinks from |
b04f2f7d | 35 | `/sys/class/hwmon/hwmon*`. |
1da177e4 | 36 | |
125ff808 JD |
37 | Up to lm-sensors 3.0.0, libsensors looks for hardware monitoring attributes |
38 | in the "physical" device directory. Since lm-sensors 3.0.1, attributes found | |
39 | in the hwmon "class" device directory are also supported. Complex drivers | |
40 | (e.g. drivers for multifunction chips) may want to use this possibility to | |
41 | avoid namespace pollution. The only drawback will be that older versions of | |
42 | libsensors won't support the driver in question. | |
43 | ||
740e06a8 | 44 | All sysfs values are fixed point numbers. |
1da177e4 LT |
45 | |
46 | There is only one value per file, unlike the older /proc specification. | |
47 | The common scheme for files naming is: <type><number>_<item>. Usual | |
48 | types for sensor chips are "in" (voltage), "temp" (temperature) and | |
49 | "fan" (fan). Usual items are "input" (measured value), "max" (high | |
50 | threshold, "min" (low threshold). Numbering usually starts from 1, | |
51 | except for voltages which start from 0 (because most data sheets use | |
52 | this). A number is always used for elements that can be present more | |
53 | than once, even if there is a single element of the given type on the | |
54 | specific chip. Other files do not refer to a specific element, so | |
55 | they have a simple name, and no number. | |
56 | ||
57 | Alarms are direct indications read from the chips. The drivers do NOT | |
58 | make comparisons of readings to thresholds. This allows violations | |
59 | between readings to be caught and alarmed. The exact definition of an | |
60 | alarm (for example, whether a threshold must be met or must be exceeded | |
61 | to cause an alarm) is chip-dependent. | |
62 | ||
2ed42633 HG |
63 | When setting values of hwmon sysfs attributes, the string representation of |
64 | the desired value must be written, note that strings which are not a number | |
65 | are interpreted as 0! For more on how written strings are interpreted see the | |
66 | "sysfs attribute writes interpretation" section at the end of this file. | |
1da177e4 LT |
67 | |
68 | ------------------------------------------------------------------------- | |
69 | ||
b04f2f7d MCC |
70 | ======= =========================================== |
71 | `[0-*]` denotes any positive number starting from 0 | |
72 | `[1-*]` denotes any positive number starting from 1 | |
057bc350 | 73 | RO read only value |
cd4e96c5 | 74 | WO write only value |
057bc350 | 75 | RW read/write value |
b04f2f7d | 76 | ======= =========================================== |
057bc350 RM |
77 | |
78 | Read/write values may be read-only for some chips, depending on the | |
79 | hardware implementation. | |
80 | ||
176544dc JD |
81 | All entries (except name) are optional, and should only be created in a |
82 | given driver if the chip has the feature. | |
83 | ||
84 | ||
b04f2f7d MCC |
85 | ***************** |
86 | Global attributes | |
87 | ***************** | |
176544dc | 88 | |
b04f2f7d MCC |
89 | `name` |
90 | The chip name. | |
176544dc | 91 | This should be a short, lowercase string, not containing |
f1728415 GR |
92 | whitespace, dashes, or the wildcard character '*'. |
93 | This attribute represents the chip name. It is the only | |
94 | mandatory attribute. | |
176544dc | 95 | I2C devices get this attribute created automatically. |
b04f2f7d | 96 | |
176544dc JD |
97 | RO |
98 | ||
b04f2f7d MCC |
99 | `update_interval` |
100 | The interval at which the chip will update readings. | |
d2b847d4 | 101 | Unit: millisecond |
b04f2f7d | 102 | |
d2b847d4 | 103 | RW |
b04f2f7d | 104 | |
a51b9944 GR |
105 | Some devices have a variable update rate or interval. |
106 | This attribute can be used to change it to the desired value. | |
d2b847d4 | 107 | |
740e06a8 | 108 | |
b04f2f7d MCC |
109 | ******** |
110 | Voltages | |
111 | ******** | |
112 | ||
113 | `in[0-*]_min` | |
114 | Voltage min value. | |
1da177e4 | 115 | |
1da177e4 | 116 | Unit: millivolt |
b04f2f7d | 117 | |
057bc350 | 118 | RW |
b04f2f7d MCC |
119 | |
120 | `in[0-*]_lcrit` | |
121 | Voltage critical min value. | |
122 | ||
f46fc8cd | 123 | Unit: millivolt |
b04f2f7d | 124 | |
f46fc8cd | 125 | RW |
b04f2f7d | 126 | |
f46fc8cd GR |
127 | If voltage drops to or below this limit, the system may |
128 | take drastic action such as power down or reset. At the very | |
129 | least, it should report a fault. | |
130 | ||
b04f2f7d MCC |
131 | `in[0-*]_max` |
132 | Voltage max value. | |
133 | ||
1da177e4 | 134 | Unit: millivolt |
b04f2f7d | 135 | |
057bc350 | 136 | RW |
b04f2f7d MCC |
137 | |
138 | `in[0-*]_crit` | |
139 | Voltage critical max value. | |
140 | ||
f46fc8cd | 141 | Unit: millivolt |
b04f2f7d | 142 | |
f46fc8cd | 143 | RW |
b04f2f7d | 144 | |
f46fc8cd GR |
145 | If voltage reaches or exceeds this limit, the system may |
146 | take drastic action such as power down or reset. At the very | |
147 | least, it should report a fault. | |
148 | ||
b04f2f7d MCC |
149 | `in[0-*]_input` |
150 | Voltage input value. | |
151 | ||
1da177e4 | 152 | Unit: millivolt |
b04f2f7d | 153 | |
057bc350 | 154 | RO |
b04f2f7d | 155 | |
057bc350 | 156 | Voltage measured on the chip pin. |
b04f2f7d | 157 | |
1da177e4 LT |
158 | Actual voltage depends on the scaling resistors on the |
159 | motherboard, as recommended in the chip datasheet. | |
b04f2f7d | 160 | |
1da177e4 LT |
161 | This varies by chip and by motherboard. |
162 | Because of this variation, values are generally NOT scaled | |
163 | by the chip driver, and must be done by the application. | |
164 | However, some drivers (notably lm87 and via686a) | |
057bc350 | 165 | do scale, because of internal resistors built into a chip. |
176544dc JD |
166 | These drivers will output the actual voltage. Rule of |
167 | thumb: drivers should report the voltage values at the | |
168 | "pins" of the chip. | |
169 | ||
b04f2f7d | 170 | `in[0-*]_average` |
0084e9fa | 171 | Average voltage |
b04f2f7d | 172 | |
0084e9fa | 173 | Unit: millivolt |
b04f2f7d | 174 | |
0084e9fa GR |
175 | RO |
176 | ||
b04f2f7d | 177 | `in[0-*]_lowest` |
0084e9fa | 178 | Historical minimum voltage |
b04f2f7d | 179 | |
0084e9fa | 180 | Unit: millivolt |
b04f2f7d | 181 | |
0084e9fa GR |
182 | RO |
183 | ||
b04f2f7d | 184 | `in[0-*]_highest` |
0084e9fa | 185 | Historical maximum voltage |
b04f2f7d | 186 | |
0084e9fa | 187 | Unit: millivolt |
b04f2f7d | 188 | |
0084e9fa GR |
189 | RO |
190 | ||
b04f2f7d | 191 | `in[0-*]_reset_history` |
0084e9fa | 192 | Reset inX_lowest and inX_highest |
b04f2f7d | 193 | |
0084e9fa GR |
194 | WO |
195 | ||
b04f2f7d | 196 | `in_reset_history` |
0084e9fa | 197 | Reset inX_lowest and inX_highest for all sensors |
b04f2f7d | 198 | |
0084e9fa GR |
199 | WO |
200 | ||
b04f2f7d MCC |
201 | `in[0-*]_label` |
202 | Suggested voltage channel label. | |
203 | ||
176544dc | 204 | Text string |
b04f2f7d | 205 | |
176544dc JD |
206 | Should only be created if the driver has hints about what |
207 | this voltage channel is being used for, and user-space | |
208 | doesn't. In all other cases, the label is provided by | |
209 | user-space. | |
b04f2f7d | 210 | |
176544dc | 211 | RO |
1da177e4 | 212 | |
b04f2f7d | 213 | `in[0-*]_enable` |
fb41a710 | 214 | Enable or disable the sensors. |
b04f2f7d | 215 | |
fb41a710 | 216 | When disabled the sensor read will return -ENODATA. |
b04f2f7d MCC |
217 | |
218 | - 1: Enable | |
219 | - 0: Disable | |
220 | ||
fb41a710 SB |
221 | RW |
222 | ||
b04f2f7d MCC |
223 | `cpu[0-*]_vid` |
224 | CPU core reference voltage. | |
225 | ||
1da177e4 | 226 | Unit: millivolt |
b04f2f7d | 227 | |
057bc350 | 228 | RO |
b04f2f7d | 229 | |
1da177e4 LT |
230 | Not always correct. |
231 | ||
b04f2f7d MCC |
232 | `vrm` |
233 | Voltage Regulator Module version number. | |
234 | ||
057bc350 | 235 | RW (but changing it should no more be necessary) |
b04f2f7d | 236 | |
057bc350 RM |
237 | Originally the VRM standard version multiplied by 10, but now |
238 | an arbitrary number, as not all standards have a version | |
239 | number. | |
b04f2f7d | 240 | |
1da177e4 LT |
241 | Affects the way the driver calculates the CPU core reference |
242 | voltage from the vid pins. | |
243 | ||
057bc350 RM |
244 | Also see the Alarms section for status flags associated with voltages. |
245 | ||
1da177e4 | 246 | |
b04f2f7d MCC |
247 | **** |
248 | Fans | |
249 | **** | |
250 | ||
251 | `fan[1-*]_min` | |
252 | Fan minimum value | |
1da177e4 | 253 | |
1da177e4 | 254 | Unit: revolution/min (RPM) |
b04f2f7d | 255 | |
057bc350 | 256 | RW |
1da177e4 | 257 | |
b04f2f7d MCC |
258 | `fan[1-*]_max` |
259 | Fan maximum value | |
260 | ||
d54d4624 | 261 | Unit: revolution/min (RPM) |
b04f2f7d | 262 | |
d54d4624 CE |
263 | Only rarely supported by the hardware. |
264 | RW | |
265 | ||
b04f2f7d MCC |
266 | `fan[1-*]_input` |
267 | Fan input value. | |
268 | ||
1da177e4 | 269 | Unit: revolution/min (RPM) |
b04f2f7d | 270 | |
057bc350 | 271 | RO |
1da177e4 | 272 | |
b04f2f7d MCC |
273 | `fan[1-*]_div` |
274 | Fan divisor. | |
275 | ||
1da177e4 | 276 | Integer value in powers of two (1, 2, 4, 8, 16, 32, 64, 128). |
b04f2f7d | 277 | |
057bc350 | 278 | RW |
b04f2f7d | 279 | |
1da177e4 LT |
280 | Some chips only support values 1, 2, 4 and 8. |
281 | Note that this is actually an internal clock divisor, which | |
282 | affects the measurable speed range, not the read value. | |
283 | ||
b04f2f7d MCC |
284 | `fan[1-*]_pulses` |
285 | Number of tachometer pulses per fan revolution. | |
286 | ||
2d2e148a | 287 | Integer value, typically between 1 and 4. |
b04f2f7d | 288 | |
2d2e148a | 289 | RW |
b04f2f7d | 290 | |
2d2e148a GR |
291 | This value is a characteristic of the fan connected to the |
292 | device's input, so it has to be set in accordance with the fan | |
293 | model. | |
b04f2f7d | 294 | |
2d2e148a GR |
295 | Should only be created if the chip has a register to configure |
296 | the number of pulses. In the absence of such a register (and | |
297 | thus attribute) the value assumed by all devices is 2 pulses | |
298 | per fan revolution. | |
299 | ||
b04f2f7d | 300 | `fan[1-*]_target` |
2dbc514a | 301 | Desired fan speed |
b04f2f7d | 302 | |
2dbc514a | 303 | Unit: revolution/min (RPM) |
b04f2f7d | 304 | |
2dbc514a | 305 | RW |
b04f2f7d | 306 | |
2dbc514a JD |
307 | Only makes sense if the chip supports closed-loop fan speed |
308 | control based on the measured fan speed. | |
309 | ||
b04f2f7d MCC |
310 | `fan[1-*]_label` |
311 | Suggested fan channel label. | |
312 | ||
176544dc | 313 | Text string |
b04f2f7d | 314 | |
176544dc JD |
315 | Should only be created if the driver has hints about what |
316 | this fan channel is being used for, and user-space doesn't. | |
317 | In all other cases, the label is provided by user-space. | |
b04f2f7d | 318 | |
176544dc JD |
319 | RO |
320 | ||
b04f2f7d | 321 | `fan[1-*]_enable` |
fb41a710 | 322 | Enable or disable the sensors. |
b04f2f7d | 323 | |
fb41a710 | 324 | When disabled the sensor read will return -ENODATA. |
b04f2f7d MCC |
325 | |
326 | - 1: Enable | |
327 | - 0: Disable | |
328 | ||
fb41a710 SB |
329 | RW |
330 | ||
057bc350 RM |
331 | Also see the Alarms section for status flags associated with fans. |
332 | ||
333 | ||
b04f2f7d MCC |
334 | *** |
335 | PWM | |
336 | *** | |
337 | ||
338 | `pwm[1-*]` | |
339 | Pulse width modulation fan control. | |
1da177e4 | 340 | |
1da177e4 | 341 | Integer value in the range 0 to 255 |
b04f2f7d | 342 | |
057bc350 | 343 | RW |
b04f2f7d | 344 | |
1da177e4 LT |
345 | 255 is max or 100%. |
346 | ||
b04f2f7d | 347 | `pwm[1-*]_enable` |
875f25d5 | 348 | Fan speed control method: |
b04f2f7d MCC |
349 | |
350 | - 0: no fan speed control (i.e. fan at full speed) | |
351 | - 1: manual fan speed control enabled (using `pwm[1-*]`) | |
352 | - 2+: automatic fan speed control enabled | |
353 | ||
f8d0c19a JD |
354 | Check individual chip documentation files for automatic mode |
355 | details. | |
b04f2f7d | 356 | |
057bc350 RM |
357 | RW |
358 | ||
b04f2f7d MCC |
359 | `pwm[1-*]_mode` |
360 | - 0: DC mode (direct current) | |
361 | - 1: PWM mode (pulse-width modulation) | |
362 | ||
f8d0c19a JD |
363 | RW |
364 | ||
b04f2f7d MCC |
365 | `pwm[1-*]_freq` |
366 | Base PWM frequency in Hz. | |
367 | ||
f8d0c19a JD |
368 | Only possibly available when pwmN_mode is PWM, but not always |
369 | present even then. | |
b04f2f7d | 370 | |
057bc350 | 371 | RW |
1da177e4 | 372 | |
b04f2f7d | 373 | `pwm[1-*]_auto_channels_temp` |
1da177e4 | 374 | Select which temperature channels affect this PWM output in |
b04f2f7d MCC |
375 | auto mode. |
376 | ||
377 | Bitfield, 1 is temp1, 2 is temp2, 4 is temp3 etc... | |
1da177e4 | 378 | Which values are possible depend on the chip used. |
b04f2f7d | 379 | |
057bc350 | 380 | RW |
1da177e4 | 381 | |
b04f2f7d MCC |
382 | `pwm[1-*]_auto_point[1-*]_pwm` / `pwm[1-*]_auto_point[1-*]_temp` / `pwm[1-*]_auto_point[1-*]_temp_hyst` |
383 | Define the PWM vs temperature curve. | |
384 | ||
385 | Number of trip points is chip-dependent. Use this for chips | |
386 | which associate trip points to PWM output channels. | |
387 | ||
057bc350 | 388 | RW |
1da177e4 | 389 | |
b04f2f7d MCC |
390 | `temp[1-*]_auto_point[1-*]_pwm` / `temp[1-*]_auto_point[1-*]_temp` / `temp[1-*]_auto_point[1-*]_temp_hyst` |
391 | Define the PWM vs temperature curve. | |
392 | ||
393 | Number of trip points is chip-dependent. Use this for chips | |
394 | which associate trip points to temperature channels. | |
395 | ||
057bc350 | 396 | RW |
1da177e4 | 397 | |
f7290e24 JD |
398 | There is a third case where trip points are associated to both PWM output |
399 | channels and temperature channels: the PWM values are associated to PWM | |
400 | output channels while the temperature values are associated to temperature | |
401 | channels. In that case, the result is determined by the mapping between | |
402 | temperature inputs and PWM outputs. When several temperature inputs are | |
403 | mapped to a given PWM output, this leads to several candidate PWM values. | |
404 | The actual result is up to the chip, but in general the highest candidate | |
405 | value (fastest fan speed) wins. | |
406 | ||
1da177e4 | 407 | |
b04f2f7d MCC |
408 | ************ |
409 | Temperatures | |
410 | ************ | |
411 | ||
412 | `temp[1-*]_type` | |
413 | Sensor type selection. | |
1da177e4 | 414 | |
b26f9330 | 415 | Integers 1 to 6 |
b04f2f7d | 416 | |
057bc350 | 417 | RW |
b04f2f7d MCC |
418 | |
419 | - 1: CPU embedded diode | |
420 | - 2: 3904 transistor | |
421 | - 3: thermal diode | |
422 | - 4: thermistor | |
423 | - 5: AMD AMDSI | |
424 | - 6: Intel PECI | |
425 | ||
1da177e4 LT |
426 | Not all types are supported by all chips |
427 | ||
b04f2f7d MCC |
428 | `temp[1-*]_max` |
429 | Temperature max value. | |
430 | ||
740e06a8 | 431 | Unit: millidegree Celsius (or millivolt, see below) |
b04f2f7d | 432 | |
057bc350 | 433 | RW |
1da177e4 | 434 | |
b04f2f7d MCC |
435 | `temp[1-*]_min` |
436 | Temperature min value. | |
437 | ||
740e06a8 | 438 | Unit: millidegree Celsius |
b04f2f7d | 439 | |
057bc350 | 440 | RW |
1da177e4 | 441 | |
b04f2f7d | 442 | `temp[1-*]_max_hyst` |
1da177e4 | 443 | Temperature hysteresis value for max limit. |
b04f2f7d | 444 | |
740e06a8 | 445 | Unit: millidegree Celsius |
b04f2f7d | 446 | |
1da177e4 LT |
447 | Must be reported as an absolute temperature, NOT a delta |
448 | from the max value. | |
b04f2f7d | 449 | |
057bc350 | 450 | RW |
1da177e4 | 451 | |
b04f2f7d | 452 | `temp[1-*]_min_hyst` |
01325145 JD |
453 | Temperature hysteresis value for min limit. |
454 | Unit: millidegree Celsius | |
b04f2f7d | 455 | |
01325145 JD |
456 | Must be reported as an absolute temperature, NOT a delta |
457 | from the min value. | |
b04f2f7d | 458 | |
01325145 JD |
459 | RW |
460 | ||
b04f2f7d MCC |
461 | `temp[1-*]_input` |
462 | Temperature input value. | |
463 | ||
740e06a8 | 464 | Unit: millidegree Celsius |
b04f2f7d | 465 | |
057bc350 | 466 | RO |
1da177e4 | 467 | |
b04f2f7d MCC |
468 | `temp[1-*]_crit` |
469 | Temperature critical max value, typically greater than | |
1da177e4 | 470 | corresponding temp_max values. |
b04f2f7d | 471 | |
740e06a8 | 472 | Unit: millidegree Celsius |
b04f2f7d | 473 | |
057bc350 | 474 | RW |
1da177e4 | 475 | |
b04f2f7d | 476 | `temp[1-*]_crit_hyst` |
1da177e4 | 477 | Temperature hysteresis value for critical limit. |
b04f2f7d | 478 | |
740e06a8 | 479 | Unit: millidegree Celsius |
b04f2f7d | 480 | |
1da177e4 LT |
481 | Must be reported as an absolute temperature, NOT a delta |
482 | from the critical value. | |
b04f2f7d | 483 | |
057bc350 | 484 | RW |
1da177e4 | 485 | |
b04f2f7d | 486 | `temp[1-*]_emergency` |
28e7438f GR |
487 | Temperature emergency max value, for chips supporting more than |
488 | two upper temperature limits. Must be equal or greater than | |
489 | corresponding temp_crit values. | |
b04f2f7d | 490 | |
28e7438f | 491 | Unit: millidegree Celsius |
b04f2f7d | 492 | |
28e7438f GR |
493 | RW |
494 | ||
b04f2f7d | 495 | `temp[1-*]_emergency_hyst` |
28e7438f | 496 | Temperature hysteresis value for emergency limit. |
b04f2f7d | 497 | |
28e7438f | 498 | Unit: millidegree Celsius |
b04f2f7d | 499 | |
28e7438f GR |
500 | Must be reported as an absolute temperature, NOT a delta |
501 | from the emergency value. | |
b04f2f7d | 502 | |
28e7438f GR |
503 | RW |
504 | ||
b04f2f7d MCC |
505 | `temp[1-*]_lcrit` |
506 | Temperature critical min value, typically lower than | |
f46fc8cd | 507 | corresponding temp_min values. |
b04f2f7d | 508 | |
f46fc8cd | 509 | Unit: millidegree Celsius |
b04f2f7d | 510 | |
f46fc8cd GR |
511 | RW |
512 | ||
b04f2f7d | 513 | `temp[1-*]_lcrit_hyst` |
01325145 | 514 | Temperature hysteresis value for critical min limit. |
b04f2f7d | 515 | |
01325145 | 516 | Unit: millidegree Celsius |
b04f2f7d | 517 | |
01325145 JD |
518 | Must be reported as an absolute temperature, NOT a delta |
519 | from the critical min value. | |
b04f2f7d | 520 | |
01325145 JD |
521 | RW |
522 | ||
b04f2f7d | 523 | `temp[1-*]_offset` |
59ac8367 HR |
524 | Temperature offset which is added to the temperature reading |
525 | by the chip. | |
b04f2f7d | 526 | |
59ac8367 | 527 | Unit: millidegree Celsius |
b04f2f7d | 528 | |
59ac8367 HR |
529 | Read/Write value. |
530 | ||
b04f2f7d MCC |
531 | `temp[1-*]_label` |
532 | Suggested temperature channel label. | |
533 | ||
176544dc | 534 | Text string |
b04f2f7d | 535 | |
176544dc JD |
536 | Should only be created if the driver has hints about what |
537 | this temperature channel is being used for, and user-space | |
538 | doesn't. In all other cases, the label is provided by | |
539 | user-space. | |
b04f2f7d | 540 | |
176544dc | 541 | RO |
1da177e4 | 542 | |
b04f2f7d | 543 | `temp[1-*]_lowest` |
cd4e96c5 | 544 | Historical minimum temperature |
b04f2f7d | 545 | |
cd4e96c5 | 546 | Unit: millidegree Celsius |
b04f2f7d | 547 | |
cd4e96c5 AP |
548 | RO |
549 | ||
b04f2f7d | 550 | `temp[1-*]_highest` |
cd4e96c5 | 551 | Historical maximum temperature |
b04f2f7d | 552 | |
cd4e96c5 | 553 | Unit: millidegree Celsius |
b04f2f7d | 554 | |
cd4e96c5 AP |
555 | RO |
556 | ||
b04f2f7d | 557 | `temp[1-*]_reset_history` |
cd4e96c5 | 558 | Reset temp_lowest and temp_highest |
b04f2f7d | 559 | |
cd4e96c5 AP |
560 | WO |
561 | ||
b04f2f7d | 562 | `temp_reset_history` |
cd4e96c5 | 563 | Reset temp_lowest and temp_highest for all sensors |
b04f2f7d | 564 | |
cd4e96c5 AP |
565 | WO |
566 | ||
b04f2f7d | 567 | `temp[1-*]_enable` |
fb41a710 | 568 | Enable or disable the sensors. |
b04f2f7d | 569 | |
fb41a710 | 570 | When disabled the sensor read will return -ENODATA. |
b04f2f7d MCC |
571 | |
572 | - 1: Enable | |
573 | - 0: Disable | |
574 | ||
fb41a710 SB |
575 | RW |
576 | ||
740e06a8 JD |
577 | Some chips measure temperature using external thermistors and an ADC, and |
578 | report the temperature measurement as a voltage. Converting this voltage | |
579 | back to a temperature (or the other way around for limits) requires | |
580 | mathematical functions not available in the kernel, so the conversion | |
581 | must occur in user space. For these chips, all temp* files described | |
582 | above should contain values expressed in millivolt instead of millidegree | |
583 | Celsius. In other words, such temperature channels are handled as voltage | |
584 | channels by the driver. | |
585 | ||
057bc350 RM |
586 | Also see the Alarms section for status flags associated with temperatures. |
587 | ||
1da177e4 | 588 | |
b04f2f7d MCC |
589 | ******** |
590 | Currents | |
591 | ******** | |
592 | ||
593 | `curr[1-*]_max` | |
594 | Current max value | |
1da177e4 | 595 | |
1da177e4 | 596 | Unit: milliampere |
b04f2f7d | 597 | |
057bc350 | 598 | RW |
1da177e4 | 599 | |
b04f2f7d MCC |
600 | `curr[1-*]_min` |
601 | Current min value. | |
602 | ||
1da177e4 | 603 | Unit: milliampere |
b04f2f7d | 604 | |
057bc350 | 605 | RW |
1da177e4 | 606 | |
b04f2f7d MCC |
607 | `curr[1-*]_lcrit` |
608 | Current critical low value | |
609 | ||
581693b5 | 610 | Unit: milliampere |
b04f2f7d | 611 | |
581693b5 GR |
612 | RW |
613 | ||
b04f2f7d MCC |
614 | `curr[1-*]_crit` |
615 | Current critical high value. | |
616 | ||
581693b5 | 617 | Unit: milliampere |
b04f2f7d | 618 | |
581693b5 GR |
619 | RW |
620 | ||
b04f2f7d MCC |
621 | `curr[1-*]_input` |
622 | Current input value | |
623 | ||
1da177e4 | 624 | Unit: milliampere |
b04f2f7d | 625 | |
057bc350 | 626 | RO |
1da177e4 | 627 | |
b04f2f7d | 628 | `curr[1-*]_average` |
0084e9fa | 629 | Average current use |
b04f2f7d | 630 | |
0084e9fa | 631 | Unit: milliampere |
b04f2f7d | 632 | |
0084e9fa GR |
633 | RO |
634 | ||
b04f2f7d | 635 | `curr[1-*]_lowest` |
0084e9fa | 636 | Historical minimum current |
b04f2f7d | 637 | |
0084e9fa | 638 | Unit: milliampere |
b04f2f7d | 639 | |
0084e9fa GR |
640 | RO |
641 | ||
b04f2f7d | 642 | `curr[1-*]_highest` |
0084e9fa GR |
643 | Historical maximum current |
644 | Unit: milliampere | |
645 | RO | |
646 | ||
b04f2f7d | 647 | `curr[1-*]_reset_history` |
0084e9fa | 648 | Reset currX_lowest and currX_highest |
b04f2f7d | 649 | |
0084e9fa GR |
650 | WO |
651 | ||
b04f2f7d | 652 | `curr_reset_history` |
0084e9fa | 653 | Reset currX_lowest and currX_highest for all sensors |
b04f2f7d | 654 | |
0084e9fa GR |
655 | WO |
656 | ||
b04f2f7d | 657 | `curr[1-*]_enable` |
fb41a710 | 658 | Enable or disable the sensors. |
b04f2f7d | 659 | |
fb41a710 | 660 | When disabled the sensor read will return -ENODATA. |
b04f2f7d MCC |
661 | |
662 | - 1: Enable | |
663 | - 0: Disable | |
664 | ||
fb41a710 SB |
665 | RW |
666 | ||
581693b5 GR |
667 | Also see the Alarms section for status flags associated with currents. |
668 | ||
b04f2f7d MCC |
669 | ***** |
670 | Power | |
671 | ***** | |
672 | ||
673 | `power[1-*]_average` | |
674 | Average power use | |
38fb56a2 | 675 | |
38fb56a2 | 676 | Unit: microWatt |
b04f2f7d | 677 | |
38fb56a2 DW |
678 | RO |
679 | ||
b04f2f7d MCC |
680 | `power[1-*]_average_interval` |
681 | Power use averaging interval. A poll | |
115a57c5 DW |
682 | notification is sent to this file if the |
683 | hardware changes the averaging interval. | |
b04f2f7d | 684 | |
ddedc658 | 685 | Unit: milliseconds |
b04f2f7d | 686 | |
ddedc658 DW |
687 | RW |
688 | ||
b04f2f7d MCC |
689 | `power[1-*]_average_interval_max` |
690 | Maximum power use averaging interval | |
691 | ||
115a57c5 | 692 | Unit: milliseconds |
b04f2f7d | 693 | |
115a57c5 DW |
694 | RO |
695 | ||
b04f2f7d MCC |
696 | `power[1-*]_average_interval_min` |
697 | Minimum power use averaging interval | |
698 | ||
115a57c5 | 699 | Unit: milliseconds |
b04f2f7d | 700 | |
115a57c5 DW |
701 | RO |
702 | ||
b04f2f7d MCC |
703 | `power[1-*]_average_highest` |
704 | Historical average maximum power use | |
705 | ||
38fb56a2 | 706 | Unit: microWatt |
b04f2f7d | 707 | |
38fb56a2 DW |
708 | RO |
709 | ||
b04f2f7d MCC |
710 | `power[1-*]_average_lowest` |
711 | Historical average minimum power use | |
712 | ||
38fb56a2 | 713 | Unit: microWatt |
b04f2f7d | 714 | |
38fb56a2 DW |
715 | RO |
716 | ||
b04f2f7d MCC |
717 | `power[1-*]_average_max` |
718 | A poll notification is sent to | |
719 | `power[1-*]_average` when power use | |
115a57c5 | 720 | rises above this value. |
b04f2f7d | 721 | |
115a57c5 | 722 | Unit: microWatt |
b04f2f7d | 723 | |
115a57c5 DW |
724 | RW |
725 | ||
b04f2f7d MCC |
726 | `power[1-*]_average_min` |
727 | A poll notification is sent to | |
728 | `power[1-*]_average` when power use | |
115a57c5 | 729 | sinks below this value. |
b04f2f7d | 730 | |
115a57c5 | 731 | Unit: microWatt |
b04f2f7d | 732 | |
115a57c5 DW |
733 | RW |
734 | ||
b04f2f7d MCC |
735 | `power[1-*]_input` |
736 | Instantaneous power use | |
737 | ||
38fb56a2 | 738 | Unit: microWatt |
b04f2f7d | 739 | |
38fb56a2 DW |
740 | RO |
741 | ||
b04f2f7d MCC |
742 | `power[1-*]_input_highest` |
743 | Historical maximum power use | |
744 | ||
38fb56a2 | 745 | Unit: microWatt |
b04f2f7d | 746 | |
38fb56a2 DW |
747 | RO |
748 | ||
b04f2f7d MCC |
749 | `power[1-*]_input_lowest` |
750 | Historical minimum power use | |
751 | ||
38fb56a2 | 752 | Unit: microWatt |
b04f2f7d | 753 | |
38fb56a2 DW |
754 | RO |
755 | ||
b04f2f7d MCC |
756 | `power[1-*]_reset_history` |
757 | Reset input_highest, input_lowest, | |
38fb56a2 | 758 | average_highest and average_lowest. |
b04f2f7d | 759 | |
38fb56a2 | 760 | WO |
1da177e4 | 761 | |
b04f2f7d MCC |
762 | `power[1-*]_accuracy` |
763 | Accuracy of the power meter. | |
764 | ||
115a57c5 | 765 | Unit: Percent |
b04f2f7d | 766 | |
115a57c5 DW |
767 | RO |
768 | ||
b04f2f7d MCC |
769 | `power[1-*]_cap` |
770 | If power use rises above this limit, the | |
115a57c5 DW |
771 | system should take action to reduce power use. |
772 | A poll notification is sent to this file if the | |
b04f2f7d | 773 | cap is changed by the hardware. The `*_cap` |
115a57c5 DW |
774 | files only appear if the cap is known to be |
775 | enforced by hardware. | |
b04f2f7d | 776 | |
115a57c5 | 777 | Unit: microWatt |
b04f2f7d | 778 | |
115a57c5 DW |
779 | RW |
780 | ||
b04f2f7d MCC |
781 | `power[1-*]_cap_hyst` |
782 | Margin of hysteresis built around capping and | |
115a57c5 | 783 | notification. |
b04f2f7d | 784 | |
115a57c5 | 785 | Unit: microWatt |
b04f2f7d | 786 | |
115a57c5 DW |
787 | RW |
788 | ||
b04f2f7d MCC |
789 | `power[1-*]_cap_max` |
790 | Maximum cap that can be set. | |
791 | ||
115a57c5 | 792 | Unit: microWatt |
b04f2f7d | 793 | |
115a57c5 DW |
794 | RO |
795 | ||
b04f2f7d MCC |
796 | `power[1-*]_cap_min` |
797 | Minimum cap that can be set. | |
798 | ||
115a57c5 | 799 | Unit: microWatt |
b04f2f7d | 800 | |
115a57c5 DW |
801 | RO |
802 | ||
b04f2f7d MCC |
803 | `power[1-*]_max` |
804 | Maximum power. | |
805 | ||
581693b5 | 806 | Unit: microWatt |
b04f2f7d | 807 | |
581693b5 GR |
808 | RW |
809 | ||
b04f2f7d MCC |
810 | `power[1-*]_crit` |
811 | Critical maximum power. | |
812 | ||
581693b5 GR |
813 | If power rises to or above this limit, the |
814 | system is expected take drastic action to reduce | |
815 | power consumption, such as a system shutdown or | |
816 | a forced powerdown of some devices. | |
b04f2f7d | 817 | |
581693b5 | 818 | Unit: microWatt |
b04f2f7d | 819 | |
581693b5 GR |
820 | RW |
821 | ||
b04f2f7d MCC |
822 | `power[1-*]_enable` |
823 | Enable or disable the sensors. | |
824 | ||
fb41a710 SB |
825 | When disabled the sensor read will return |
826 | -ENODATA. | |
b04f2f7d MCC |
827 | |
828 | - 1: Enable | |
829 | - 0: Disable | |
830 | ||
fb41a710 SB |
831 | RW |
832 | ||
581693b5 GR |
833 | Also see the Alarms section for status flags associated with power readings. |
834 | ||
b04f2f7d MCC |
835 | ****** |
836 | Energy | |
837 | ****** | |
838 | ||
839 | `energy[1-*]_input` | |
840 | Cumulative energy use | |
ddedc658 | 841 | |
ddedc658 | 842 | Unit: microJoule |
b04f2f7d | 843 | |
ddedc658 DW |
844 | RO |
845 | ||
b04f2f7d MCC |
846 | `energy[1-*]_enable` |
847 | Enable or disable the sensors. | |
848 | ||
fb41a710 SB |
849 | When disabled the sensor read will return |
850 | -ENODATA. | |
b04f2f7d MCC |
851 | |
852 | - 1: Enable | |
853 | - 0: Disable | |
854 | ||
fb41a710 | 855 | RW |
ec199209 | 856 | |
b04f2f7d MCC |
857 | ******** |
858 | Humidity | |
859 | ******** | |
860 | ||
861 | `humidity[1-*]_input` | |
862 | Humidity | |
c6c2c163 | 863 | |
c6c2c163 | 864 | Unit: milli-percent (per cent mille, pcm) |
b04f2f7d | 865 | |
c6c2c163 GR |
866 | RO |
867 | ||
868 | ||
b04f2f7d MCC |
869 | `humidity[1-*]_enable` |
870 | Enable or disable the sensors | |
871 | ||
fb41a710 SB |
872 | When disabled the sensor read will return |
873 | -ENODATA. | |
b04f2f7d MCC |
874 | |
875 | - 1: Enable | |
876 | - 0: Disable | |
877 | ||
fb41a710 SB |
878 | RW |
879 | ||
b04f2f7d MCC |
880 | ****** |
881 | Alarms | |
882 | ****** | |
400b48ec JD |
883 | |
884 | Each channel or limit may have an associated alarm file, containing a | |
885 | boolean value. 1 means than an alarm condition exists, 0 means no alarm. | |
886 | ||
887 | Usually a given chip will either use channel-related alarms, or | |
888 | limit-related alarms, not both. The driver should just reflect the hardware | |
889 | implementation. | |
890 | ||
b04f2f7d MCC |
891 | +-------------------------------+-----------------------+ |
892 | | **`in[0-*]_alarm`, | Channel alarm | | |
893 | | `curr[1-*]_alarm`, | | | |
894 | | `power[1-*]_alarm`, | - 0: no alarm | | |
895 | | `fan[1-*]_alarm`, | - 1: alarm | | |
896 | | `temp[1-*]_alarm`** | | | |
897 | | | RO | | |
898 | +-------------------------------+-----------------------+ | |
899 | ||
900 | **OR** | |
901 | ||
902 | +-------------------------------+-----------------------+ | |
903 | | **`in[0-*]_min_alarm`, | Limit alarm | | |
904 | | `in[0-*]_max_alarm`, | | | |
905 | | `in[0-*]_lcrit_alarm`, | - 0: no alarm | | |
906 | | `in[0-*]_crit_alarm`, | - 1: alarm | | |
907 | | `curr[1-*]_min_alarm`, | | | |
908 | | `curr[1-*]_max_alarm`, | RO | | |
909 | | `curr[1-*]_lcrit_alarm`, | | | |
910 | | `curr[1-*]_crit_alarm`, | | | |
911 | | `power[1-*]_cap_alarm`, | | | |
912 | | `power[1-*]_max_alarm`, | | | |
913 | | `power[1-*]_crit_alarm`, | | | |
914 | | `fan[1-*]_min_alarm`, | | | |
915 | | `fan[1-*]_max_alarm`, | | | |
916 | | `temp[1-*]_min_alarm`, | | | |
917 | | `temp[1-*]_max_alarm`, | | | |
918 | | `temp[1-*]_lcrit_alarm`, | | | |
919 | | `temp[1-*]_crit_alarm`, | | | |
920 | | `temp[1-*]_emergency_alarm`** | | | |
921 | +-------------------------------+-----------------------+ | |
400b48ec JD |
922 | |
923 | Each input channel may have an associated fault file. This can be used | |
924 | to notify open diodes, unconnected fans etc. where the hardware | |
925 | supports it. When this boolean has value 1, the measurement for that | |
926 | channel should not be trusted. | |
927 | ||
b04f2f7d | 928 | `fan[1-*]_fault` / `temp[1-*]_fault` |
400b48ec | 929 | Input fault condition |
b04f2f7d MCC |
930 | |
931 | - 0: no fault occurred | |
932 | - 1: fault condition | |
933 | ||
057bc350 | 934 | RO |
400b48ec JD |
935 | |
936 | Some chips also offer the possibility to get beeped when an alarm occurs: | |
937 | ||
b04f2f7d MCC |
938 | `beep_enable` |
939 | Master beep enable | |
940 | ||
941 | - 0: no beeps | |
942 | - 1: beeps | |
943 | ||
057bc350 | 944 | RW |
400b48ec | 945 | |
b04f2f7d | 946 | `in[0-*]_beep`, `curr[1-*]_beep`, `fan[1-*]_beep`, `temp[1-*]_beep`, |
400b48ec | 947 | Channel beep |
b04f2f7d MCC |
948 | |
949 | - 0: disable | |
950 | - 1: enable | |
951 | ||
057bc350 | 952 | RW |
400b48ec JD |
953 | |
954 | In theory, a chip could provide per-limit beep masking, but no such chip | |
955 | was seen so far. | |
956 | ||
957 | Old drivers provided a different, non-standard interface to alarms and | |
958 | beeps. These interface files are deprecated, but will be kept around | |
959 | for compatibility reasons: | |
1da177e4 | 960 | |
b04f2f7d MCC |
961 | `alarms` |
962 | Alarm bitmask. | |
963 | ||
057bc350 | 964 | RO |
b04f2f7d | 965 | |
1da177e4 | 966 | Integer representation of one to four bytes. |
b04f2f7d | 967 | |
1da177e4 | 968 | A '1' bit means an alarm. |
b04f2f7d | 969 | |
1da177e4 LT |
970 | Chips should be programmed for 'comparator' mode so that |
971 | the alarm will 'come back' after you read the register | |
972 | if it is still valid. | |
b04f2f7d | 973 | |
1da177e4 LT |
974 | Generally a direct representation of a chip's internal |
975 | alarm registers; there is no standard for the position | |
400b48ec JD |
976 | of individual bits. For this reason, the use of this |
977 | interface file for new drivers is discouraged. Use | |
b04f2f7d | 978 | `individual *_alarm` and `*_fault` files instead. |
1da177e4 LT |
979 | Bits are defined in kernel/include/sensors.h. |
980 | ||
b04f2f7d MCC |
981 | `beep_mask` |
982 | Bitmask for beep. | |
400b48ec JD |
983 | Same format as 'alarms' with the same bit locations, |
984 | use discouraged for the same reason. Use individual | |
b04f2f7d | 985 | `*_beep` files instead. |
057bc350 | 986 | RW |
2ed42633 HG |
987 | |
988 | ||
b04f2f7d MCC |
989 | ******************* |
990 | Intrusion detection | |
991 | ******************* | |
ec199209 | 992 | |
b04f2f7d | 993 | `intrusion[0-*]_alarm` |
ec199209 | 994 | Chassis intrusion detection |
b04f2f7d MCC |
995 | |
996 | - 0: OK | |
997 | - 1: intrusion detected | |
998 | ||
ec199209 | 999 | RW |
b04f2f7d | 1000 | |
ec199209 JD |
1001 | Contrary to regular alarm flags which clear themselves |
1002 | automatically when read, this one sticks until cleared by | |
1003 | the user. This is done by writing 0 to the file. Writing | |
1004 | other values is unsupported. | |
1005 | ||
b04f2f7d | 1006 | `intrusion[0-*]_beep` |
ec199209 | 1007 | Chassis intrusion beep |
b04f2f7d | 1008 | |
ec199209 JD |
1009 | 0: disable |
1010 | 1: enable | |
b04f2f7d | 1011 | |
ec199209 JD |
1012 | RW |
1013 | ||
b04f2f7d MCC |
1014 | **************************** |
1015 | Average sample configuration | |
1016 | **************************** | |
bfe033a0 AKNPW |
1017 | |
1018 | Devices allowing for reading {in,power,curr,temp}_average values may export | |
1019 | attributes for controlling number of samples used to compute average. | |
1020 | ||
b04f2f7d MCC |
1021 | +--------------+---------------------------------------------------------------+ |
1022 | | samples | Sets number of average samples for all types of measurements. | | |
1023 | | | | | |
1024 | | | RW | | |
1025 | +--------------+---------------------------------------------------------------+ | |
1026 | | in_samples | Sets number of average samples for specific type of | | |
1027 | | power_samples| measurements. | | |
1028 | | curr_samples | | | |
1029 | | temp_samples | Note that on some devices it won't be possible to set all of | | |
1030 | | | them to different values so changing one might also change | | |
1031 | | | some others. | | |
1032 | | | | | |
1033 | | | RW | | |
1034 | +--------------+---------------------------------------------------------------+ | |
ec199209 | 1035 | |
2ed42633 HG |
1036 | sysfs attribute writes interpretation |
1037 | ------------------------------------- | |
1038 | ||
1039 | hwmon sysfs attributes always contain numbers, so the first thing to do is to | |
1040 | convert the input to a number, there are 2 ways todo this depending whether | |
b04f2f7d MCC |
1041 | the number can be negative or not:: |
1042 | ||
1043 | unsigned long u = simple_strtoul(buf, NULL, 10); | |
1044 | long s = simple_strtol(buf, NULL, 10); | |
2ed42633 HG |
1045 | |
1046 | With buf being the buffer with the user input being passed by the kernel. | |
1047 | Notice that we do not use the second argument of strto[u]l, and thus cannot | |
1048 | tell when 0 is returned, if this was really 0 or is caused by invalid input. | |
1049 | This is done deliberately as checking this everywhere would add a lot of | |
1050 | code to the kernel. | |
1051 | ||
1052 | Notice that it is important to always store the converted value in an | |
1053 | unsigned long or long, so that no wrap around can happen before any further | |
1054 | checking. | |
1055 | ||
1056 | After the input string is converted to an (unsigned) long, the value should be | |
1057 | checked if its acceptable. Be careful with further conversions on the value | |
1058 | before checking it for validity, as these conversions could still cause a wrap | |
1059 | around before the check. For example do not multiply the result, and only | |
1060 | add/subtract if it has been divided before the add/subtract. | |
1061 | ||
1062 | What to do if a value is found to be invalid, depends on the type of the | |
1063 | sysfs attribute that is being set. If it is a continuous setting like a | |
1064 | tempX_max or inX_max attribute, then the value should be clamped to its | |
c25fb816 GR |
1065 | limits using clamp_val(value, min_limit, max_limit). If it is not continuous |
1066 | like for example a tempX_type, then when an invalid value is written, | |
1067 | -EINVAL should be returned. | |
2ed42633 | 1068 | |
b04f2f7d | 1069 | Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees):: |
5fbea518 JD |
1070 | |
1071 | long v = simple_strtol(buf, NULL, 10) / 1000; | |
c25fb816 | 1072 | v = clamp_val(v, -128, 127); |
5fbea518 | 1073 | /* write v to register */ |
2ed42633 | 1074 | |
b04f2f7d | 1075 | Example2, fan divider setting, valid values 2, 4 and 8:: |
5fbea518 JD |
1076 | |
1077 | unsigned long v = simple_strtoul(buf, NULL, 10); | |
1078 | ||
1079 | switch (v) { | |
1080 | case 2: v = 1; break; | |
1081 | case 4: v = 2; break; | |
1082 | case 8: v = 3; break; | |
1083 | default: | |
1084 | return -EINVAL; | |
1085 | } | |
1086 | /* write v to register */ |