atbredband
.net)
The vt1211
is a sensor chip used for instance on the EPIA-CL
Mini-ITX board which I have. The board has a fan-less VIA-eden
processor, and I have not connected the fan in the box. I am
worried about the temperature, so I want to monitor it.
The driver for vt1211
has not been ported to kernel version
2.6 by the
lm_sensors
project yet. The port has been listed as in progress
for
several months so I decided to port it myself and hopefully
give something back to the open source community.
vt1211.cfile is not altered at all, just a new kernel patch.
show_temp_hystthat Simon found, he also sent a new
sensors.conf. Made a note about
i2c-isa.ko.
Conversion Confusionparagraph was added. This is important so please read it.
Patches and packageschapter with useful related items provided by Stefan Plattner.
Here it is (there is also a kernel-patch further below);
Download it to you work directory and build it with;
echo "obj-m := vt1211.o" > Makefile make -C /path/to/your/kernel2.6/source/dir SUBDIRS=$PWD modules
Read the Documentation/kbuild/modules.txt
in your kernel
directory for more info about how to build modules.
Install it with the usual module-init-tools;
insmod i2c-sensor.ko insmod vt1211.ko
The example is my commands. You may use modprobe
, or require
more or less modules to be loaded before vt1211.ko.
i2c-isa.komodule is required, else the
0-6000directories will be missing. It seems like
modprobecan miss this. A user had this problem on Fedora Core 3 test2.
Check the result by examining the /sys files;
# cd /sys/devices/platform/i2c-0/0-6000/ # ls alarms fan2_pwm in4_max temp3_input detach_state fan2_pwm_enable in4_min temp3_max fan1_div in0_ref in5_input temp3_max_hyst fan1_input in2_input in5_max temp4_input fan1_min in2_max in5_min temp4_max fan1_pwm in2_min name temp4_max_hyst fan1_pwm_enable in3_input power vrm fan2_div in3_max temp2_input fan2_input in3_min temp2_max fan2_min in4_input temp2_max_hyst # cat temp3_input in?_input 99250 1190 1900 2090 2020
The i2c-0/0-6000
is an address and may differ on your
system. The example shows raw un-converted register
values. These will be converted to readable values by some
program like sensors
. Or you can check the formulas in
sensors.conf
and convert them yourself;
# compute temp3 (@ - 65) / 0.9686, (@ * 0.9686) + 65 echo "scale=2; (99.250-65)/0.9686" | bc -q 35.36
So the register value 99250 is converted to 35.36 degree
Celsius. The example uses bc
for the computation. Note that
the value from the driver is divided by the multiplier
(described below).
The possibility to configure some sensors to either temp or
voltage ( in
) has been removed. Instead the configuration has
been setup like the default in /etc/sensors.conf
;
label in2 "VCore1" label in3 "+5V" label in4 "+12V" label in5 "+3.3V" label temp2 "MB1 Temp" label temp3 "Proc Temp" label temp4 "MB2 Temp"
The driver can be compiled with an option (ALL_SENSORS) that
enables all sensor files. This also adds the non-standard
uch_config
file for configuring the sensors.
Stefan Plattner has provided alternative ways of installing the vt1211 driver. These are easier than the instruction above for most Linux users.
First the vt1211 driver as a patch to the kernel instead of a stand-alone module.
And a ready to use debian package of kernel 2.6.8 with all the relevant epia patches plus supermount is available here.
My thanks to Stefan for providing these packages.
On request I have made a kernel path for the 2.6.10 kernel. The module is not altered at all;
When I made the port i read these documents in the
Documentation/i2c/
directory in the kernel source;
The examples below is taken from kernel 2.6.8.1. In the
porting-clients
you can read;
"Use the file names specified in Documentation/i2c/sysfs-interface for the individual files. Also convert the units these files read and write to the specified ones."
The units
in sysfs-interface
is for instance instance;
temp[1-4]_input Temperature input value. Unit: millidegree Celcius Read only value.
From this I concluded that the conversions should be done
inside the driver. This is also done in the other VIA driver,
the via686a.c
. But I was wrong ...
I got a mail from Simon who owns a new EPIA-M 10000N board. On his board the register conversions are different. For instance;
temp3 (@*@*0.0046)-(@*0.088)-0.748, (@*0.9686)+65
Here is the sensors.conf
for the EPIA-M 10000N board from
Simon;
Here is another contributed sensors.conf
for the EPIA-M
10000N, found at VIAARENA about 12 month ago (Oct 2003);
For other (older) boards the sensors.conf
in the lm_sensors
package will probably do nicely.
Reading the sysfs-interface
again more carefully I found;
... the conversions cannot be 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 still require a configuration file (e.g. /etc/sensors.conf) for proper values conversion, labeling of inputs and hiding of unused inputs.
So the register values should not be converted by the driver. But the register values should still be multiplied by a factor inside the driver.
Multiplier | 2.4 kernel | 2.6 kernel |
---|---|---|
TEMP_MULTIPLIER | 10 | 1000 |
IN_MULTIPLIER (volt) | 1(?) | 10(?) |
The IN_MULTIPLIER I think is incorrect in my 2.4 version (from
lm_sensors-2.8.5) it should be 10 to fit the sensors.conf
formulas. Further I think the the value should really be 1000
in the 2.6 version. Here is an example with IN_MULTIPLIER=10;
# compute in4 ((@ * 100) - 3) / (0.1754 * 95.8), ... > cat /sys/devices/platform/i2c-0/0-6000/in4_input 2080 > echo "((2080*100)-3)/(0.1754*95.8)" | bc -q 12378
This is the 12V in milli-volt, so it looks OK. But the formula contains (@*100) which no other sensor-chip driver has. So I really think that IN_MULTIPLIER=1000 should be used, and the formula should be;
compute in4 (@ - 3) / (0.1754 * 95.8),
As you might understand I am a bit confused about this, but is is clear that the conversion should not be done by the driver. So The internal register conversion is disabled by default, but can be re-enabled. The register multipliers are macros and easy to alter.
It shouldn't be very hard to alter the driver and the translation files (e.g /etc/sensors.conf) to get correct values, but if anybody knows the correct way, please let me know.
I know there are tools for reading the sensors, but I have only
tested this by printing the files under /sys. My Mini-ITX
system is a primitive diskless system so installing tools
(especially perl
based) requires too much job.
I have tried to compare the CPU temperature and the voltages
towards the PC Health Status
menu on the BIOS screen. The
voltage values are about the same. The CPU temperature from
the vt1211 module seems a bit (~4 degrees) higher than the
BIOS value. I do not know why or which is most correct, but I
think its the same if you run the original 2.4 version of the
module.
The fan_pwm is supposed to control the fan speed. I connected the fan in my system but could not control it. I read something on the viaarena forum that the fan on my board is connected to 12V always, so this is not necessarily a fault. I think the value is written ok by the driver, but the HW refuses to accept it. Example;
# echo 1 > fan2_pwm_enable # echo 50 > fan2_pwm; cat fan2_pwm 50 # cat fan2_pwm 255
The value 50
seems to be written, but when the HW value is
re-read by the driver it is back to 255 (100% fan speed).
The thermistor sensors (temp2 and temp4) are not used on my
board so I can not test them. The translation formula is again
taken from /etc/sensors.conf
and seems a bit simplified
compared to via686a.
Most other values I have just tried to read and write. No
alarms tested. Some things like the vrm
I do not understand,
so I can't test them.
Generated: Fri Dec 31 12:16:33 2004