diff options
-rw-r--r-- | Documentation/hwmon/sysfs-interface | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index bc59a5113d17..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 |
@@ -77,6 +78,9 @@ RW read/write value | |||
77 | Read/write values may be read-only for some chips, depending on the | 78 | Read/write values may be read-only for some chips, depending on the |
78 | hardware implementation. | 79 | hardware implementation. |
79 | 80 | ||
81 | All entries are optional, and should only be created in a given driver | ||
82 | if the chip has the feature. | ||
83 | |||
80 | ************ | 84 | ************ |
81 | * Voltages * | 85 | * Voltages * |
82 | ************ | 86 | ************ |
@@ -213,32 +217,32 @@ temp[1-*]_type Sensor type selection. | |||
213 | Not all types are supported by all chips | 217 | Not all types are supported by all chips |
214 | 218 | ||
215 | temp[1-*]_max Temperature max value. | 219 | temp[1-*]_max Temperature max value. |
216 | Unit: millidegree Celcius | 220 | Unit: millidegree Celsius (or millivolt, see below) |
217 | RW | 221 | RW |
218 | 222 | ||
219 | temp[1-*]_min Temperature min value. | 223 | temp[1-*]_min Temperature min value. |
220 | Unit: millidegree Celcius | 224 | Unit: millidegree Celsius |
221 | RW | 225 | RW |
222 | 226 | ||
223 | temp[1-*]_max_hyst | 227 | temp[1-*]_max_hyst |
224 | Temperature hysteresis value for max limit. | 228 | Temperature hysteresis value for max limit. |
225 | Unit: millidegree Celcius | 229 | Unit: millidegree Celsius |
226 | Must be reported as an absolute temperature, NOT a delta | 230 | Must be reported as an absolute temperature, NOT a delta |
227 | from the max value. | 231 | from the max value. |
228 | RW | 232 | RW |
229 | 233 | ||
230 | temp[1-*]_input Temperature input value. | 234 | temp[1-*]_input Temperature input value. |
231 | Unit: millidegree Celcius | 235 | Unit: millidegree Celsius |
232 | RO | 236 | RO |
233 | 237 | ||
234 | temp[1-*]_crit Temperature critical value, typically greater than | 238 | temp[1-*]_crit Temperature critical value, typically greater than |
235 | corresponding temp_max values. | 239 | corresponding temp_max values. |
236 | Unit: millidegree Celcius | 240 | Unit: millidegree Celsius |
237 | RW | 241 | RW |
238 | 242 | ||
239 | temp[1-*]_crit_hyst | 243 | temp[1-*]_crit_hyst |
240 | Temperature hysteresis value for critical limit. | 244 | Temperature hysteresis value for critical limit. |
241 | Unit: millidegree Celcius | 245 | Unit: millidegree Celsius |
242 | Must be reported as an absolute temperature, NOT a delta | 246 | Must be reported as an absolute temperature, NOT a delta |
243 | from the critical value. | 247 | from the critical value. |
244 | RW | 248 | RW |
@@ -256,6 +260,15 @@ temp[1-4]_offset | |||
256 | itself, for example the thermal diode inside the CPU or | 260 | itself, for example the thermal diode inside the CPU or |
257 | a thermistor nearby. | 261 | a thermistor nearby. |
258 | 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 | |||
259 | Also see the Alarms section for status flags associated with temperatures. | 272 | Also see the Alarms section for status flags associated with temperatures. |
260 | 273 | ||
261 | 274 | ||