diff options
Diffstat (limited to 'Documentation/hwmon/sysfs-interface')
-rw-r--r-- | Documentation/hwmon/sysfs-interface | 274 |
1 files changed, 187 insertions, 87 deletions
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index a0d0ab24288e..d1d390aaf620 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
@@ -3,15 +3,15 @@ Naming and data format standards for sysfs files | |||
3 | 3 | ||
4 | The libsensors library offers an interface to the raw sensors data | 4 | The libsensors library offers an interface to the raw sensors data |
5 | through the sysfs interface. See libsensors documentation and source for | 5 | through the sysfs interface. See libsensors documentation and source for |
6 | more further information. As of writing this document, libsensors | 6 | further information. As of writing this document, libsensors |
7 | (from lm_sensors 2.8.3) is heavily chip-dependant. Adding or updating | 7 | (from lm_sensors 2.8.3) is heavily chip-dependent. Adding or updating |
8 | support for any given chip requires modifying the library's code. | 8 | support for any given chip requires modifying the library's code. |
9 | This is because libsensors was written for the procfs interface | 9 | This is because libsensors was written for the procfs interface |
10 | older kernel modules were using, which wasn't standardized enough. | 10 | older kernel modules were using, which wasn't standardized enough. |
11 | Recent versions of libsensors (from lm_sensors 2.8.2 and later) have | 11 | Recent versions of libsensors (from lm_sensors 2.8.2 and later) have |
12 | support for the sysfs interface, though. | 12 | support for the sysfs interface, though. |
13 | 13 | ||
14 | The new sysfs interface was designed to be as chip-independant as | 14 | The new sysfs interface was designed to be as chip-independent as |
15 | possible. | 15 | possible. |
16 | 16 | ||
17 | Note that motherboards vary widely in the connections to sensor chips. | 17 | Note that motherboards vary widely in the connections to sensor chips. |
@@ -24,7 +24,7 @@ range using external resistors. Since the values of these resistors | |||
24 | can change from motherboard to motherboard, the conversions cannot be | 24 | can change from motherboard to motherboard, the conversions cannot be |
25 | hard coded into the driver and have to be done in user space. | 25 | hard coded into the driver and have to be done in user space. |
26 | 26 | ||
27 | For this reason, even if we aim at a chip-independant libsensors, it will | 27 | For this reason, even if we aim at a chip-independent libsensors, it will |
28 | still require a configuration file (e.g. /etc/sensors.conf) for proper | 28 | still require a configuration file (e.g. /etc/sensors.conf) for proper |
29 | values conversion, labeling of inputs and hiding of unused inputs. | 29 | values conversion, labeling of inputs and hiding of unused inputs. |
30 | 30 | ||
@@ -39,15 +39,16 @@ If you are developing a userspace application please send us feedback on | |||
39 | this standard. | 39 | this standard. |
40 | 40 | ||
41 | Note that this standard isn't completely established yet, so it is subject | 41 | Note that this standard isn't completely established yet, so it is subject |
42 | to changes, even important ones. One more reason to use the library instead | 42 | to changes. If you are writing a new hardware monitoring driver those |
43 | of accessing sysfs files directly. | 43 | features can't seem to fit in this interface, please contact us with your |
44 | extension proposal. Keep in mind that backward compatibility must be | ||
45 | preserved. | ||
44 | 46 | ||
45 | Each chip gets its own directory in the sysfs /sys/devices tree. To | 47 | Each chip gets its own directory in the sysfs /sys/devices tree. To |
46 | find all sensor chips, it is easier to follow the symlinks from | 48 | find all sensor chips, it is easier to follow the device symlinks from |
47 | /sys/i2c/devices/ | 49 | /sys/class/hwmon/hwmon*. |
48 | 50 | ||
49 | All sysfs values are fixed point numbers. To get the true value of some | 51 | All sysfs values are fixed point numbers. |
50 | of the values, you should divide by the specified value. | ||
51 | 52 | ||
52 | There is only one value per file, unlike the older /proc specification. | 53 | There is only one value per file, unlike the older /proc specification. |
53 | The common scheme for files naming is: <type><number>_<item>. Usual | 54 | The common scheme for files naming is: <type><number>_<item>. Usual |
@@ -69,28 +70,40 @@ to cause an alarm) is chip-dependent. | |||
69 | 70 | ||
70 | ------------------------------------------------------------------------- | 71 | ------------------------------------------------------------------------- |
71 | 72 | ||
73 | [0-*] denotes any positive number starting from 0 | ||
74 | [1-*] denotes any positive number starting from 1 | ||
75 | RO read only value | ||
76 | RW read/write value | ||
77 | |||
78 | Read/write values may be read-only for some chips, depending on the | ||
79 | hardware implementation. | ||
80 | |||
81 | All entries are optional, and should only be created in a given driver | ||
82 | if the chip has the feature. | ||
83 | |||
72 | ************ | 84 | ************ |
73 | * Voltages * | 85 | * Voltages * |
74 | ************ | 86 | ************ |
75 | 87 | ||
76 | in[0-8]_min Voltage min value. | 88 | in[0-*]_min Voltage min value. |
77 | Unit: millivolt | 89 | Unit: millivolt |
78 | Read/Write | 90 | RW |
79 | 91 | ||
80 | in[0-8]_max Voltage max value. | 92 | in[0-*]_max Voltage max value. |
81 | Unit: millivolt | 93 | Unit: millivolt |
82 | Read/Write | 94 | RW |
83 | 95 | ||
84 | in[0-8]_input Voltage input value. | 96 | in[0-*]_input Voltage input value. |
85 | Unit: millivolt | 97 | Unit: millivolt |
86 | Read only | 98 | RO |
99 | Voltage measured on the chip pin. | ||
87 | Actual voltage depends on the scaling resistors on the | 100 | Actual voltage depends on the scaling resistors on the |
88 | motherboard, as recommended in the chip datasheet. | 101 | motherboard, as recommended in the chip datasheet. |
89 | This varies by chip and by motherboard. | 102 | This varies by chip and by motherboard. |
90 | Because of this variation, values are generally NOT scaled | 103 | Because of this variation, values are generally NOT scaled |
91 | by the chip driver, and must be done by the application. | 104 | by the chip driver, and must be done by the application. |
92 | However, some drivers (notably lm87 and via686a) | 105 | However, some drivers (notably lm87 and via686a) |
93 | do scale, with various degrees of success. | 106 | do scale, because of internal resistors built into a chip. |
94 | These drivers will output the actual voltage. | 107 | These drivers will output the actual voltage. |
95 | 108 | ||
96 | Typical usage: | 109 | Typical usage: |
@@ -104,58 +117,72 @@ in[0-8]_input Voltage input value. | |||
104 | in7_* varies | 117 | in7_* varies |
105 | in8_* varies | 118 | in8_* varies |
106 | 119 | ||
107 | cpu[0-1]_vid CPU core reference voltage. | 120 | cpu[0-*]_vid CPU core reference voltage. |
108 | Unit: millivolt | 121 | Unit: millivolt |
109 | Read only. | 122 | RO |
110 | Not always correct. | 123 | Not always correct. |
111 | 124 | ||
112 | vrm Voltage Regulator Module version number. | 125 | vrm Voltage Regulator Module version number. |
113 | Read only. | 126 | RW (but changing it should no more be necessary) |
114 | Two digit number, first is major version, second is | 127 | Originally the VRM standard version multiplied by 10, but now |
115 | minor version. | 128 | an arbitrary number, as not all standards have a version |
129 | number. | ||
116 | Affects the way the driver calculates the CPU core reference | 130 | Affects the way the driver calculates the CPU core reference |
117 | voltage from the vid pins. | 131 | voltage from the vid pins. |
118 | 132 | ||
133 | Also see the Alarms section for status flags associated with voltages. | ||
134 | |||
119 | 135 | ||
120 | ******** | 136 | ******** |
121 | * Fans * | 137 | * Fans * |
122 | ******** | 138 | ******** |
123 | 139 | ||
124 | fan[1-3]_min Fan minimum value | 140 | fan[1-*]_min Fan minimum value |
125 | Unit: revolution/min (RPM) | 141 | Unit: revolution/min (RPM) |
126 | Read/Write. | 142 | RW |
127 | 143 | ||
128 | fan[1-3]_input Fan input value. | 144 | fan[1-*]_input Fan input value. |
129 | Unit: revolution/min (RPM) | 145 | Unit: revolution/min (RPM) |
130 | Read only. | 146 | RO |
131 | 147 | ||
132 | fan[1-3]_div Fan divisor. | 148 | fan[1-*]_div Fan divisor. |
133 | Integer value in powers of two (1, 2, 4, 8, 16, 32, 64, 128). | 149 | Integer value in powers of two (1, 2, 4, 8, 16, 32, 64, 128). |
150 | RW | ||
134 | Some chips only support values 1, 2, 4 and 8. | 151 | Some chips only support values 1, 2, 4 and 8. |
135 | Note that this is actually an internal clock divisor, which | 152 | Note that this is actually an internal clock divisor, which |
136 | affects the measurable speed range, not the read value. | 153 | affects the measurable speed range, not the read value. |
137 | 154 | ||
155 | Also see the Alarms section for status flags associated with fans. | ||
156 | |||
157 | |||
138 | ******* | 158 | ******* |
139 | * PWM * | 159 | * PWM * |
140 | ******* | 160 | ******* |
141 | 161 | ||
142 | pwm[1-3] Pulse width modulation fan control. | 162 | pwm[1-*] Pulse width modulation fan control. |
143 | Integer value in the range 0 to 255 | 163 | Integer value in the range 0 to 255 |
144 | Read/Write | 164 | RW |
145 | 255 is max or 100%. | 165 | 255 is max or 100%. |
146 | 166 | ||
147 | pwm[1-3]_enable | 167 | pwm[1-*]_enable |
148 | Switch PWM on and off. | 168 | Switch PWM on and off. |
149 | Not always present even if fan*_pwm is. | 169 | Not always present even if fan*_pwm is. |
150 | 0 to turn off | 170 | 0: turn off |
151 | 1 to turn on in manual mode | 171 | 1: turn on in manual mode |
152 | 2 to turn on in automatic mode | 172 | 2+: turn on in automatic mode |
153 | Read/Write | 173 | Check individual chip documentation files for automatic mode details. |
174 | RW | ||
175 | |||
176 | pwm[1-*]_mode | ||
177 | 0: DC mode | ||
178 | 1: PWM mode | ||
179 | RW | ||
154 | 180 | ||
155 | pwm[1-*]_auto_channels_temp | 181 | pwm[1-*]_auto_channels_temp |
156 | Select which temperature channels affect this PWM output in | 182 | Select which temperature channels affect this PWM output in |
157 | auto mode. Bitfield, 1 is temp1, 2 is temp2, 4 is temp3 etc... | 183 | auto mode. Bitfield, 1 is temp1, 2 is temp2, 4 is temp3 etc... |
158 | Which values are possible depend on the chip used. | 184 | Which values are possible depend on the chip used. |
185 | RW | ||
159 | 186 | ||
160 | pwm[1-*]_auto_point[1-*]_pwm | 187 | pwm[1-*]_auto_point[1-*]_pwm |
161 | pwm[1-*]_auto_point[1-*]_temp | 188 | pwm[1-*]_auto_point[1-*]_temp |
@@ -163,6 +190,7 @@ pwm[1-*]_auto_point[1-*]_temp_hyst | |||
163 | Define the PWM vs temperature curve. Number of trip points is | 190 | Define the PWM vs temperature curve. Number of trip points is |
164 | chip-dependent. Use this for chips which associate trip points | 191 | chip-dependent. Use this for chips which associate trip points |
165 | to PWM output channels. | 192 | to PWM output channels. |
193 | RW | ||
166 | 194 | ||
167 | OR | 195 | OR |
168 | 196 | ||
@@ -172,50 +200,57 @@ temp[1-*]_auto_point[1-*]_temp_hyst | |||
172 | Define the PWM vs temperature curve. Number of trip points is | 200 | Define the PWM vs temperature curve. Number of trip points is |
173 | chip-dependent. Use this for chips which associate trip points | 201 | chip-dependent. Use this for chips which associate trip points |
174 | to temperature channels. | 202 | to temperature channels. |
203 | RW | ||
175 | 204 | ||
176 | 205 | ||
177 | **************** | 206 | **************** |
178 | * Temperatures * | 207 | * Temperatures * |
179 | **************** | 208 | **************** |
180 | 209 | ||
181 | temp[1-3]_type Sensor type selection. | 210 | temp[1-*]_type Sensor type selection. |
182 | Integers 1 to 4 or thermistor Beta value (typically 3435) | 211 | Integers 1 to 4 or thermistor Beta value (typically 3435) |
183 | Read/Write. | 212 | RW |
184 | 1: PII/Celeron Diode | 213 | 1: PII/Celeron Diode |
185 | 2: 3904 transistor | 214 | 2: 3904 transistor |
186 | 3: thermal diode | 215 | 3: thermal diode |
187 | 4: thermistor (default/unknown Beta) | 216 | 4: thermistor (default/unknown Beta) |
188 | Not all types are supported by all chips | 217 | Not all types are supported by all chips |
189 | 218 | ||
190 | temp[1-4]_max Temperature max value. | 219 | temp[1-*]_max Temperature max value. |
191 | Unit: millidegree Celcius | 220 | Unit: millidegree Celsius (or millivolt, see below) |
192 | Read/Write value. | 221 | RW |
193 | 222 | ||
194 | temp[1-3]_min Temperature min value. | 223 | temp[1-*]_min Temperature min value. |
195 | Unit: millidegree Celcius | 224 | Unit: millidegree Celsius |
196 | Read/Write value. | 225 | RW |
197 | 226 | ||
198 | temp[1-3]_max_hyst | 227 | temp[1-*]_max_hyst |
199 | Temperature hysteresis value for max limit. | 228 | Temperature hysteresis value for max limit. |
200 | Unit: millidegree Celcius | 229 | Unit: millidegree Celsius |
201 | Must be reported as an absolute temperature, NOT a delta | 230 | Must be reported as an absolute temperature, NOT a delta |
202 | from the max value. | 231 | from the max value. |
203 | Read/Write value. | 232 | RW |
204 | 233 | ||
205 | temp[1-4]_input Temperature input value. | 234 | temp[1-*]_input Temperature input value. |
206 | Unit: millidegree Celcius | 235 | Unit: millidegree Celsius |
207 | Read only value. | 236 | RO |
208 | 237 | ||
209 | temp[1-4]_crit Temperature critical value, typically greater than | 238 | temp[1-*]_crit Temperature critical value, typically greater than |
210 | corresponding temp_max values. | 239 | corresponding temp_max values. |
211 | Unit: millidegree Celcius | 240 | Unit: millidegree Celsius |
212 | Read/Write value. | 241 | RW |
213 | 242 | ||
214 | temp[1-2]_crit_hyst | 243 | temp[1-*]_crit_hyst |
215 | Temperature hysteresis value for critical limit. | 244 | Temperature hysteresis value for critical limit. |
216 | Unit: millidegree Celcius | 245 | Unit: millidegree Celsius |
217 | Must be reported as an absolute temperature, NOT a delta | 246 | Must be reported as an absolute temperature, NOT a delta |
218 | from the critical value. | 247 | from the critical value. |
248 | RW | ||
249 | |||
250 | temp[1-4]_offset | ||
251 | Temperature offset which is added to the temperature reading | ||
252 | by the chip. | ||
253 | Unit: millidegree Celsius | ||
219 | Read/Write value. | 254 | Read/Write value. |
220 | 255 | ||
221 | If there are multiple temperature sensors, temp1_* is | 256 | If there are multiple temperature sensors, temp1_* is |
@@ -225,6 +260,17 @@ temp[1-2]_crit_hyst | |||
225 | itself, for example the thermal diode inside the CPU or | 260 | itself, for example the thermal diode inside the CPU or |
226 | a thermistor nearby. | 261 | a thermistor nearby. |
227 | 262 | ||
263 | Some chips measure temperature using external thermistors and an ADC, and | ||
264 | report the temperature measurement as a voltage. Converting this voltage | ||
265 | back to a temperature (or the other way around for limits) requires | ||
266 | mathematical functions not available in the kernel, so the conversion | ||
267 | must occur in user space. For these chips, all temp* files described | ||
268 | above should contain values expressed in millivolt instead of millidegree | ||
269 | Celsius. In other words, such temperature channels are handled as voltage | ||
270 | channels by the driver. | ||
271 | |||
272 | Also see the Alarms section for status flags associated with temperatures. | ||
273 | |||
228 | 274 | ||
229 | ************ | 275 | ************ |
230 | * Currents * | 276 | * Currents * |
@@ -233,25 +279,88 @@ temp[1-2]_crit_hyst | |||
233 | Note that no known chip provides current measurements as of writing, | 279 | Note that no known chip provides current measurements as of writing, |
234 | so this part is theoretical, so to say. | 280 | so this part is theoretical, so to say. |
235 | 281 | ||
236 | curr[1-n]_max Current max value | 282 | curr[1-*]_max Current max value |
237 | Unit: milliampere | 283 | Unit: milliampere |
238 | Read/Write. | 284 | RW |
239 | 285 | ||
240 | curr[1-n]_min Current min value. | 286 | curr[1-*]_min Current min value. |
241 | Unit: milliampere | 287 | Unit: milliampere |
242 | Read/Write. | 288 | RW |
243 | 289 | ||
244 | curr[1-n]_input Current input value | 290 | curr[1-*]_input Current input value |
245 | Unit: milliampere | 291 | Unit: milliampere |
246 | Read only. | 292 | RO |
247 | 293 | ||
248 | 294 | ||
249 | ********* | 295 | ********** |
250 | * Other * | 296 | * Alarms * |
251 | ********* | 297 | ********** |
298 | |||
299 | Each channel or limit may have an associated alarm file, containing a | ||
300 | boolean value. 1 means than an alarm condition exists, 0 means no alarm. | ||
301 | |||
302 | Usually a given chip will either use channel-related alarms, or | ||
303 | limit-related alarms, not both. The driver should just reflect the hardware | ||
304 | implementation. | ||
305 | |||
306 | in[0-*]_alarm | ||
307 | fan[1-*]_alarm | ||
308 | temp[1-*]_alarm | ||
309 | Channel alarm | ||
310 | 0: no alarm | ||
311 | 1: alarm | ||
312 | RO | ||
313 | |||
314 | OR | ||
315 | |||
316 | in[0-*]_min_alarm | ||
317 | in[0-*]_max_alarm | ||
318 | fan[1-*]_min_alarm | ||
319 | temp[1-*]_min_alarm | ||
320 | temp[1-*]_max_alarm | ||
321 | temp[1-*]_crit_alarm | ||
322 | Limit alarm | ||
323 | 0: no alarm | ||
324 | 1: alarm | ||
325 | RO | ||
326 | |||
327 | Each input channel may have an associated fault file. This can be used | ||
328 | to notify open diodes, unconnected fans etc. where the hardware | ||
329 | supports it. When this boolean has value 1, the measurement for that | ||
330 | channel should not be trusted. | ||
331 | |||
332 | in[0-*]_input_fault | ||
333 | fan[1-*]_input_fault | ||
334 | temp[1-*]_input_fault | ||
335 | Input fault condition | ||
336 | 0: no fault occured | ||
337 | 1: fault condition | ||
338 | RO | ||
339 | |||
340 | Some chips also offer the possibility to get beeped when an alarm occurs: | ||
341 | |||
342 | beep_enable Master beep enable | ||
343 | 0: no beeps | ||
344 | 1: beeps | ||
345 | RW | ||
346 | |||
347 | in[0-*]_beep | ||
348 | fan[1-*]_beep | ||
349 | temp[1-*]_beep | ||
350 | Channel beep | ||
351 | 0: disable | ||
352 | 1: enable | ||
353 | RW | ||
354 | |||
355 | In theory, a chip could provide per-limit beep masking, but no such chip | ||
356 | was seen so far. | ||
357 | |||
358 | Old drivers provided a different, non-standard interface to alarms and | ||
359 | beeps. These interface files are deprecated, but will be kept around | ||
360 | for compatibility reasons: | ||
252 | 361 | ||
253 | alarms Alarm bitmask. | 362 | alarms Alarm bitmask. |
254 | Read only. | 363 | RO |
255 | Integer representation of one to four bytes. | 364 | Integer representation of one to four bytes. |
256 | A '1' bit means an alarm. | 365 | A '1' bit means an alarm. |
257 | Chips should be programmed for 'comparator' mode so that | 366 | Chips should be programmed for 'comparator' mode so that |
@@ -259,35 +368,26 @@ alarms Alarm bitmask. | |||
259 | if it is still valid. | 368 | if it is still valid. |
260 | Generally a direct representation of a chip's internal | 369 | Generally a direct representation of a chip's internal |
261 | alarm registers; there is no standard for the position | 370 | alarm registers; there is no standard for the position |
262 | of individual bits. | 371 | of individual bits. For this reason, the use of this |
372 | interface file for new drivers is discouraged. Use | ||
373 | individual *_alarm and *_fault files instead. | ||
263 | Bits are defined in kernel/include/sensors.h. | 374 | Bits are defined in kernel/include/sensors.h. |
264 | 375 | ||
265 | alarms_in Alarm bitmask relative to in (voltage) channels | 376 | beep_mask Bitmask for beep. |
266 | Read only | 377 | Same format as 'alarms' with the same bit locations, |
267 | A '1' bit means an alarm, LSB corresponds to in0 and so on | 378 | use discouraged for the same reason. Use individual |
268 | Prefered to 'alarms' for newer chips | 379 | *_beep files instead. |
269 | 380 | RW | |
270 | alarms_fan Alarm bitmask relative to fan channels | ||
271 | Read only | ||
272 | A '1' bit means an alarm, LSB corresponds to fan1 and so on | ||
273 | Prefered to 'alarms' for newer chips | ||
274 | |||
275 | alarms_temp Alarm bitmask relative to temp (temperature) channels | ||
276 | Read only | ||
277 | A '1' bit means an alarm, LSB corresponds to temp1 and so on | ||
278 | Prefered to 'alarms' for newer chips | ||
279 | 381 | ||
280 | beep_enable Beep/interrupt enable | ||
281 | 0 to disable. | ||
282 | 1 to enable. | ||
283 | Read/Write | ||
284 | 382 | ||
285 | beep_mask Bitmask for beep. | 383 | ********* |
286 | Same format as 'alarms' with the same bit locations. | 384 | * Other * |
287 | Read/Write | 385 | ********* |
288 | 386 | ||
289 | eeprom Raw EEPROM data in binary form. | 387 | eeprom Raw EEPROM data in binary form. |
290 | Read only. | 388 | RO |
291 | 389 | ||
292 | pec Enable or disable PEC (SMBus only) | 390 | pec Enable or disable PEC (SMBus only) |
293 | Read/Write | 391 | 0: disable |
392 | 1: enable | ||
393 | RW | ||