lm sensors sysfs file structure

Greg KH greg at kroah.com
Thu Mar 27 20:42:48 CET 2003


Ok, I've modified the /proc file document to reflect the proposed sysfs
file changes and included it below.

Any comments?  Any objections?

thanks,

greg k-h

-------------- next part --------------
Naming and data format standards for sysfs files
------------------------------------------------

The libsensors library offers an interface to the raw sensors data
through the sysfs interface. See libsensors documentation and source for
more further information.

An alternative method that some programs use is to access the sysfs
files directly. This document briefly describes the standards that the
drivers follow, so that an application program can scan for entries and
access this data in a simple and consistent way.

If you are developing a userspace application please send us feedback on
this standard.

Note that motherboards vary widely in the connections to sensor chips.
There is no standard that ensures, for example, that the second
temperature sensor is connected to the CPU, or that the second fan is on
the CPU. Therefore, programs must provide a facility for the user to
label or bind /proc entries for display.  Sensor chips often have unused
inputs that should be ignored by user programs.

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
/sys/i2c/devices/

All sysfs values are fixed point numbers.  To get the true value of some
of the values, you should divide by the specified value.

There is only one value per file, unlike the older /proc specification.

Alarms are direct indications read from the chips. The drivers do NOT
make comparisons of readings to thresholds. This allows violations
between readings to be caught and alarmed. The exact definition of an
alarm (for example, whether a threshold must be met or must be exceeded
to cause an alarm) is chip-dependent.


-------------------------------------------------------------------------

sysfs entries are as follows:


Entry		Function
-----		--------
alarms		Alarm bitmask.
		Read only.
		Integer representation of one to four bytes.
		A '1' bit means an alarm.
		Chips should be programmed for 'comparator' mode so that
		the alarm will 'come back' after you read the register
		if it is still valid.
		Generally a direct representation of a chip's internal
		alarm registers; there is no standard for the position
		of individual bits.
		Bits are defined in kernel/include/sensors.h.

beep_enable	Beep/interrupt enable
		0 to disable.
		1 to enable.
		Read/Write

beep_mask	Bitmask for beep.
		Same format as 'alarms' with the same bit locations.
		Read only.

curr_max[1-n]	Current max value
		Fixed point XXXX, divide by 100 to get Amps.
		Read/Write.

curr_min[1-n]	Current min or hysteresis value.
		Preferably a hysteresis value, reported as a absolute
		current, NOT a delta from the max value.
		Fixed point XXXX, divide by 100 to get Amps.
		Read/Write.

curr_input[1-n]	Current input value
		Fixed point XXXX, divide by 100 to get Amps.
		Read only.
		
fan_min[1-3]	Fan minimum value
		Integer value indicating RPM
		Read/Write.

fan_input[1-3]	Fan input value.
		Integer value indicating RPM
		Read only.

fan_div[1-3]	Fan divisor.
		Integers in powers of two (1,2,4,8,16,32,64,128).
		Some chips only support values 1,2,4,8.
		See doc/fan-divisors for details.

in_min[0-8]	Voltage min value.
		Fixed point value in form XXX.  Divide by 100 to get
		Volts.
		Read/Write
		
in_max[0-8]	Voltage max value.
		Fixed point value in form XXX.  Divide by 100 to get
		Volts.
		Read/Write
		
in_input[0-8]	Voltage input value.
		Fixed point value in form XXX.  Divide by 100 to get
		Volts.
		Read only
		Actual voltage depends on the scaling resistors on the
		motherboard, as recommended in the chip datasheet.
		This varies by chip and by motherboard.
		Because of this variation, values are generally NOT scaled
		by the chip driver, and must be done by the application.
		However, some drivers (notably lm87 and via686a)
		do scale, with various degrees of success.
		These drivers will output the actual voltage.
		First two values are read/write and third is read only.
		Typical usage:
			in_*0	CPU #1 voltage (not scaled)
			in_*1	CPU #1 voltage (not scaled)
			in_*2	3.3V nominal (not scaled)
			in_*3	5.0V nominal (scaled)
			in_*4	12.0V nominal (scaled)
			in_*5	-12.0V nominal (scaled)
			in_*6	-5.0V nominal (scaled)
			in_*7	varies
			in_*8	varies

pwn[1-3]	Pulse width modulation fan control.
		Integer 0 - 255
		Read/Write
		255 is max or 100%.
		Corresponds to the fans 1-3.

pwn_enable[1-3] pwn enable
		not always present even if pwn* is.
		0 to turn off
		1 to turn on
		Read/Write

sensor[1-3]	Sensor type selection.
		Integers 1,2,3, or thermistor Beta value (3435)
		Read/Write.

temp_max[1-3]	Temperature max value.
		Fixed point value in form XXXXX and should be divided by
		100 to get degrees Celsius.
		Read/Write value.

temp_min[1-3]	Temperature min or hysteresis value.
		Fixed point value in form XXXXX and should be divided by
		100 to get degrees Celsius.  This is preferably a
		hysteresis value, reported as a absolute temperature,
		NOT a delta from the max value.
		Read/Write value.

temp_input[1-3] Temperature input value.
		Read only value.

		If there are multiple temperature sensors, temp_*1 is
		generally the sensor inside the chip itself, generally
		reported as "motherboard temperature".  temp_*2 and
		temp_*3 are generally sensors external to the chip
		itself, for example the thermal diode inside the CPU or
		a thermistor nearby.

vid		CPU core voltage.
		Read only.
		Fixed point value in form XXXX corresponding to CPU core
		voltage as told to the sensor chip.  Divide by 1000 to
		get Volts.  Not always correct.

vrm		Voltage Regulator Module version number. 
		Read only.
		Two digit number (XX), first is major version, second is
		minor version.
		Affects the way the driver calculates the core voltage from
		the vid pins. See doc/vid for details.


More information about the lm-sensors mailing list