Kernel driver vt1211

Supported chips:

  • VIA VT1211

    Prefix: ‘vt1211’

    Addresses scanned: none, address read from Super-I/O config space

    Datasheet: Provided by VIA upon request and under NDA

Authors: Juerg Haefliger <juergh@gmail.com>

This driver is based on the driver for kernel 2.4 by Mark D. Studebaker andits port to kernel 2.6 by Lars Ekman.

Thanks to Joseph Chan and Fiona Gatt from VIA for providing documentation andtechnical support.

Module Parameters

  • uch_config: int
    Override the BIOS default universal channel (UCH)configuration for channels 1-5.Legal values are in the range of 0-31. Bit 0 maps toUCH1, bit 1 maps to UCH2 and so on. Setting a bit to 1enables the thermal input of that particular UCH andsetting a bit to 0 enables the voltage input.
  • int_mode: int
    Override the BIOS default temperature interrupt mode.The only possible value is 0 which forces interruptmode 0. In this mode, any pending interrupt is clearedwhen the status register is read but is regenerated aslong as the temperature stays above the hysteresislimit.

Be aware that overriding BIOS defaults might cause some unwanted side effects!

Description

The VIA VT1211 Super-I/O chip includes complete hardware monitoringcapabilities. It monitors 2 dedicated temperature sensor inputs (temp1 andtemp2), 1 dedicated voltage (in5) and 2 fans. Additionally, the chipimplements 5 universal input channels (UCH1-5) that can be individuallyprogrammed to either monitor a voltage or a temperature.

This chip also provides manual and automatic control of fan speeds (accordingto the datasheet). The driver only supports automatic control since the manualmode doesn’t seem to work as advertised in the datasheet. In fact I couldn’tget manual mode to work at all! Be aware that automatic mode hasn’t beentested very well (due to the fact that my EPIA M10000 doesn’t have the fansconnected to the PWM outputs of the VT1211 :-().

The following table shows the relationship between the vt1211 inputs and thesysfs nodes.

SensorVoltage ModeTemp ModeDefault Use (from the datasheet)
Reading 1 temp1Intel thermal diode
Reading 3 temp2Internal thermal diode
UCH1/Reading2in0temp3NTC type thermistor
UCH2in1temp4+2.5V
UCH3in2temp5VccP (processor core)
UCH4in3temp6+5V
UCH5in4temp7+12V
+3.3Vin5 Internal VCC (+3.3V)

Voltage Monitoring

Voltages are sampled by an 8-bit ADC with a LSB of ~10mV. The supported inputrange is thus from 0 to 2.60V. Voltage values outside of this range needexternal scaling resistors. This external scaling needs to be compensated forvia compute lines in sensors.conf, like:

compute inx @*(1+R1/R2), @/(1+R1/R2)

The board level scaling resistors according to VIA’s recommendation are asfollows. And this is of course totally dependent on the actual boardimplementation :-) You will have to find documentation for your ownmotherboard and edit sensors.conf accordingly.

VoltageR1R2DividerRaw Value
+2.5V2K10K1.22083 mV
VccP1.01400 mV[1]
+5V14K10K2.42083 mV
+12V47K10K5.72105 mV
+3.3V (int)2K3.4K1.5883300 mV[2]
+3.3V (ext)6.8K10K1.681964 mV
[1]Depending on the CPU (1.4V is for a VIA C3 Nehemiah).
[2]R1 and R2 for 3.3V (int) are internal to the VT1211 chip and the driverperforms the scaling and returns the properly scaled voltage value.

Each measured voltage has an associated low and high limit which triggers analarm when crossed.

Temperature Monitoring

Temperatures are reported in millidegree Celsius. Each measured temperaturehas a high limit which triggers an alarm if crossed. There is an associatedhysteresis value with each temperature below which the temperature has to dropbefore the alarm is cleared (this is only true for interrupt mode 0). Theinterrupt mode can be forced to 0 in case the BIOS doesn’t do itautomatically. See the ‘Module Parameters’ section for details.

All temperature channels except temp2 are external. Temp2 is the VT1211internal thermal diode and the driver does all the scaling for temp2 andreturns the temperature in millidegree Celsius. For the external channelstemp1 and temp3-temp7, scaling depends on the board implementation and needsto be performed in userspace via sensors.conf.

Temp1 is an Intel-type thermal diode which requires the following formula toconvert between sysfs readings and real temperatures:

compute temp1 (@-Offset)/Gain, (@*Gain)+Offset

According to the VIA VT1211 BIOS porting guide, the following gain and offsetvalues should be used:

Diode TypeOffsetGain
Intel CPU88.63865.0000.95280.9686[3]
VIA C3 Ezra83.8690.9528
VIA C3 Ezra-T73.8690.9528
[3]This is the formula from the lm_sensors 2.10.0 sensors.conf file. I don’tknow where it comes from or how it was derived, it’s just listed here forcompleteness.

Temp3-temp7 support NTC thermistors. For these channels, the driver returnsthe voltages as seen at the individual pins of UCH1-UCH5. The voltage at thepin (Vpin) is formed by a voltage divider made of the thermistor (Rth) and ascaling resistor (Rs):

Vpin = 2200 * Rth / (Rs + Rth)   (2200 is the ADC max limit of 2200 mV)

The equation for the thermistor is as follows (google it if you want to knowmore about it):

Rth = Ro * exp(B * (1 / T - 1 / To))   (To is 298.15K (25C) and Ro is the                                        nominal resistance at 25C)

Mingling the above two equations and assuming Rs = Ro and B = 3435 yields thefollowing formula for sensors.conf:

compute tempx 1 / (1 / 298.15 - (` (2200 / @ - 1)) / 3435) - 273.15,              2200 / (1 + (^ (3435 / 298.15 - 3435 / (273.15 + @))))

Fan Speed Control

The VT1211 provides 2 programmable PWM outputs to control the speeds of 2fans. Writing a 2 to any of the two pwm[1-2]_enable sysfs nodes will put thePWM controller in automatic mode. There is only a single controller thatcontrols both PWM outputs but each PWM output can be individually enabled anddisabled.

Each PWM has 4 associated distinct output duty-cycles: full, high, low andoff. Full and off are internally hard-wired to 255 (100%) and 0 (0%),respectively. High and low can be programmed viapwm[1-2]_auto_point[2-3]_pwm. Each PWM output can be associated with adifferent thermal input but - and here’s the weird part - only one set ofthermal thresholds exist that controls both PWMs output duty-cycles. Thethermal thresholds are accessible via pwm[1-2]_auto_point[1-4]_temp. Notethat even though there are 2 sets of 4 auto points each, they map to the sameregisters in the VT1211 and programming one set is sufficient (actually onlythe first set pwm1_auto_point[1-4]_temp is writable, the second set isread-only).

PWM Auto PointPWM Output Duty-Cycle
pwm[1-2]_auto_point4_pwmfull speed duty-cycle (hard-wired to 255)
pwm[1-2]_auto_point3_pwmhigh speed duty-cycle
pwm[1-2]_auto_point2_pwmlow speed duty-cycle
pwm[1-2]_auto_point1_pwmoff duty-cycle (hard-wired to 0)
Temp Auto PointThermal Threshold
pwm[1-2]_auto_point4_tempfull speed temp
pwm[1-2]_auto_point3_temphigh speed temp
pwm[1-2]_auto_point2_templow speed temp
pwm[1-2]_auto_point1_tempoff temp

Long story short, the controller implements the following algorithm to set thePWM output duty-cycle based on the input temperature:

Thermal ThresholdOutput Duty-Cycle(Rising Temp)Output Duty-Cycle(Falling Temp)
full speed duty-cyclefull speed duty-cycle
full speed temp  
high speed duty-cyclefull speed duty-cycle
high speed temp  
low speed duty-cyclehigh speed duty-cycle
low speed temp  
off duty-cyclelow speed duty-cycle
off temp