提交 740e06a8 编写于 作者: J Jean Delvare 提交者: Greg Kroah-Hartman

[PATCH] hwmon: Sysfs interface documentation update, 2 of 2, take 2

Reword and complete certain parts of the hwmon sysfs-interface
documentation file. Hopefully this will make things clearer for new
driver authors.
Signed-off-by: NJean Delvare <khali@linux-fr.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 057bc350
...@@ -3,15 +3,15 @@ Naming and data format standards for sysfs files ...@@ -3,15 +3,15 @@ Naming and data format standards for sysfs files
The libsensors library offers an interface to the raw sensors data The libsensors library offers an interface to the raw sensors data
through the sysfs interface. See libsensors documentation and source for through the sysfs interface. See libsensors documentation and source for
more further information. As of writing this document, libsensors further information. As of writing this document, libsensors
(from lm_sensors 2.8.3) is heavily chip-dependant. Adding or updating (from lm_sensors 2.8.3) is heavily chip-dependent. Adding or updating
support for any given chip requires modifying the library's code. support for any given chip requires modifying the library's code.
This is because libsensors was written for the procfs interface This is because libsensors was written for the procfs interface
older kernel modules were using, which wasn't standardized enough. older kernel modules were using, which wasn't standardized enough.
Recent versions of libsensors (from lm_sensors 2.8.2 and later) have Recent versions of libsensors (from lm_sensors 2.8.2 and later) have
support for the sysfs interface, though. support for the sysfs interface, though.
The new sysfs interface was designed to be as chip-independant as The new sysfs interface was designed to be as chip-independent as
possible. possible.
Note that motherboards vary widely in the connections to sensor chips. 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,7 +24,7 @@ range using external resistors. Since the values of these resistors
can change from motherboard to motherboard, the conversions cannot be can change from motherboard to motherboard, the conversions cannot be
hard coded into the driver and have to be done in user space. hard coded into the driver and have to be done in user space.
For this reason, even if we aim at a chip-independant libsensors, it will For this reason, even if we aim at a chip-independent libsensors, it will
still require a configuration file (e.g. /etc/sensors.conf) for proper still require a configuration file (e.g. /etc/sensors.conf) for proper
values conversion, labeling of inputs and hiding of unused inputs. values conversion, labeling of inputs and hiding of unused inputs.
...@@ -39,15 +39,16 @@ If you are developing a userspace application please send us feedback on ...@@ -39,15 +39,16 @@ If you are developing a userspace application please send us feedback on
this standard. this standard.
Note that this standard isn't completely established yet, so it is subject Note that this standard isn't completely established yet, so it is subject
to changes, even important ones. One more reason to use the library instead to changes. If you are writing a new hardware monitoring driver those
of accessing sysfs files directly. features can't seem to fit in this interface, please contact us with your
extension proposal. Keep in mind that backward compatibility must be
preserved.
Each chip gets its own directory in the sysfs /sys/devices tree. To Each chip gets its own directory in the sysfs /sys/devices tree. To
find all sensor chips, it is easier to follow the symlinks from find all sensor chips, it is easier to follow the device symlinks from
/sys/i2c/devices/ /sys/class/hwmon/hwmon*.
All sysfs values are fixed point numbers. To get the true value of some All sysfs values are fixed point numbers.
of the values, you should divide by the specified value.
There is only one value per file, unlike the older /proc specification. There is only one value per file, unlike the older /proc specification.
The common scheme for files naming is: <type><number>_<item>. Usual The common scheme for files naming is: <type><number>_<item>. Usual
...@@ -77,6 +78,9 @@ RW read/write value ...@@ -77,6 +78,9 @@ RW read/write value
Read/write values may be read-only for some chips, depending on the Read/write values may be read-only for some chips, depending on the
hardware implementation. hardware implementation.
All entries are optional, and should only be created in a given driver
if the chip has the feature.
************ ************
* Voltages * * Voltages *
************ ************
...@@ -213,32 +217,32 @@ temp[1-*]_type Sensor type selection. ...@@ -213,32 +217,32 @@ temp[1-*]_type Sensor type selection.
Not all types are supported by all chips Not all types are supported by all chips
temp[1-*]_max Temperature max value. temp[1-*]_max Temperature max value.
Unit: millidegree Celcius Unit: millidegree Celsius (or millivolt, see below)
RW RW
temp[1-*]_min Temperature min value. temp[1-*]_min Temperature min value.
Unit: millidegree Celcius Unit: millidegree Celsius
RW RW
temp[1-*]_max_hyst temp[1-*]_max_hyst
Temperature hysteresis value for max limit. Temperature hysteresis value for max limit.
Unit: millidegree Celcius Unit: millidegree Celsius
Must be reported as an absolute temperature, NOT a delta Must be reported as an absolute temperature, NOT a delta
from the max value. from the max value.
RW RW
temp[1-*]_input Temperature input value. temp[1-*]_input Temperature input value.
Unit: millidegree Celcius Unit: millidegree Celsius
RO RO
temp[1-*]_crit Temperature critical value, typically greater than temp[1-*]_crit Temperature critical value, typically greater than
corresponding temp_max values. corresponding temp_max values.
Unit: millidegree Celcius Unit: millidegree Celsius
RW RW
temp[1-*]_crit_hyst temp[1-*]_crit_hyst
Temperature hysteresis value for critical limit. Temperature hysteresis value for critical limit.
Unit: millidegree Celcius Unit: millidegree Celsius
Must be reported as an absolute temperature, NOT a delta Must be reported as an absolute temperature, NOT a delta
from the critical value. from the critical value.
RW RW
...@@ -256,6 +260,15 @@ temp[1-4]_offset ...@@ -256,6 +260,15 @@ temp[1-4]_offset
itself, for example the thermal diode inside the CPU or itself, for example the thermal diode inside the CPU or
a thermistor nearby. a thermistor nearby.
Some chips measure temperature using external thermistors and an ADC, and
report the temperature measurement as a voltage. Converting this voltage
back to a temperature (or the other way around for limits) requires
mathematical functions not available in the kernel, so the conversion
must occur in user space. For these chips, all temp* files described
above should contain values expressed in millivolt instead of millidegree
Celsius. In other words, such temperature channels are handled as voltage
channels by the driver.
Also see the Alarms section for status flags associated with temperatures. Also see the Alarms section for status flags associated with temperatures.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册