1*7ebd8b66SMauro Carvalho ChehabKernel driver vt1211 2*7ebd8b66SMauro Carvalho Chehab==================== 3*7ebd8b66SMauro Carvalho Chehab 4*7ebd8b66SMauro Carvalho ChehabSupported chips: 5*7ebd8b66SMauro Carvalho Chehab 6*7ebd8b66SMauro Carvalho Chehab * VIA VT1211 7*7ebd8b66SMauro Carvalho Chehab 8*7ebd8b66SMauro Carvalho Chehab Prefix: 'vt1211' 9*7ebd8b66SMauro Carvalho Chehab 10*7ebd8b66SMauro Carvalho Chehab Addresses scanned: none, address read from Super-I/O config space 11*7ebd8b66SMauro Carvalho Chehab 12*7ebd8b66SMauro Carvalho Chehab Datasheet: Provided by VIA upon request and under NDA 13*7ebd8b66SMauro Carvalho Chehab 14*7ebd8b66SMauro Carvalho ChehabAuthors: Juerg Haefliger <juergh@gmail.com> 15*7ebd8b66SMauro Carvalho Chehab 16*7ebd8b66SMauro Carvalho ChehabThis driver is based on the driver for kernel 2.4 by Mark D. Studebaker and 17*7ebd8b66SMauro Carvalho Chehabits port to kernel 2.6 by Lars Ekman. 18*7ebd8b66SMauro Carvalho Chehab 19*7ebd8b66SMauro Carvalho ChehabThanks to Joseph Chan and Fiona Gatt from VIA for providing documentation and 20*7ebd8b66SMauro Carvalho Chehabtechnical support. 21*7ebd8b66SMauro Carvalho Chehab 22*7ebd8b66SMauro Carvalho Chehab 23*7ebd8b66SMauro Carvalho ChehabModule Parameters 24*7ebd8b66SMauro Carvalho Chehab----------------- 25*7ebd8b66SMauro Carvalho Chehab 26*7ebd8b66SMauro Carvalho Chehab 27*7ebd8b66SMauro Carvalho Chehab* uch_config: int 28*7ebd8b66SMauro Carvalho Chehab Override the BIOS default universal channel (UCH) 29*7ebd8b66SMauro Carvalho Chehab configuration for channels 1-5. 30*7ebd8b66SMauro Carvalho Chehab Legal values are in the range of 0-31. Bit 0 maps to 31*7ebd8b66SMauro Carvalho Chehab UCH1, bit 1 maps to UCH2 and so on. Setting a bit to 1 32*7ebd8b66SMauro Carvalho Chehab enables the thermal input of that particular UCH and 33*7ebd8b66SMauro Carvalho Chehab setting a bit to 0 enables the voltage input. 34*7ebd8b66SMauro Carvalho Chehab 35*7ebd8b66SMauro Carvalho Chehab* int_mode: int 36*7ebd8b66SMauro Carvalho Chehab Override the BIOS default temperature interrupt mode. 37*7ebd8b66SMauro Carvalho Chehab The only possible value is 0 which forces interrupt 38*7ebd8b66SMauro Carvalho Chehab mode 0. In this mode, any pending interrupt is cleared 39*7ebd8b66SMauro Carvalho Chehab when the status register is read but is regenerated as 40*7ebd8b66SMauro Carvalho Chehab long as the temperature stays above the hysteresis 41*7ebd8b66SMauro Carvalho Chehab limit. 42*7ebd8b66SMauro Carvalho Chehab 43*7ebd8b66SMauro Carvalho ChehabBe aware that overriding BIOS defaults might cause some unwanted side effects! 44*7ebd8b66SMauro Carvalho Chehab 45*7ebd8b66SMauro Carvalho Chehab 46*7ebd8b66SMauro Carvalho ChehabDescription 47*7ebd8b66SMauro Carvalho Chehab----------- 48*7ebd8b66SMauro Carvalho Chehab 49*7ebd8b66SMauro Carvalho ChehabThe VIA VT1211 Super-I/O chip includes complete hardware monitoring 50*7ebd8b66SMauro Carvalho Chehabcapabilities. It monitors 2 dedicated temperature sensor inputs (temp1 and 51*7ebd8b66SMauro Carvalho Chehabtemp2), 1 dedicated voltage (in5) and 2 fans. Additionally, the chip 52*7ebd8b66SMauro Carvalho Chehabimplements 5 universal input channels (UCH1-5) that can be individually 53*7ebd8b66SMauro Carvalho Chehabprogrammed to either monitor a voltage or a temperature. 54*7ebd8b66SMauro Carvalho Chehab 55*7ebd8b66SMauro Carvalho ChehabThis chip also provides manual and automatic control of fan speeds (according 56*7ebd8b66SMauro Carvalho Chehabto the datasheet). The driver only supports automatic control since the manual 57*7ebd8b66SMauro Carvalho Chehabmode doesn't seem to work as advertised in the datasheet. In fact I couldn't 58*7ebd8b66SMauro Carvalho Chehabget manual mode to work at all! Be aware that automatic mode hasn't been 59*7ebd8b66SMauro Carvalho Chehabtested very well (due to the fact that my EPIA M10000 doesn't have the fans 60*7ebd8b66SMauro Carvalho Chehabconnected to the PWM outputs of the VT1211 :-(). 61*7ebd8b66SMauro Carvalho Chehab 62*7ebd8b66SMauro Carvalho ChehabThe following table shows the relationship between the vt1211 inputs and the 63*7ebd8b66SMauro Carvalho Chehabsysfs nodes. 64*7ebd8b66SMauro Carvalho Chehab 65*7ebd8b66SMauro Carvalho Chehab=============== ============== =========== ================================ 66*7ebd8b66SMauro Carvalho ChehabSensor Voltage Mode Temp Mode Default Use (from the datasheet) 67*7ebd8b66SMauro Carvalho Chehab=============== ============== =========== ================================ 68*7ebd8b66SMauro Carvalho ChehabReading 1 temp1 Intel thermal diode 69*7ebd8b66SMauro Carvalho ChehabReading 3 temp2 Internal thermal diode 70*7ebd8b66SMauro Carvalho ChehabUCH1/Reading2 in0 temp3 NTC type thermistor 71*7ebd8b66SMauro Carvalho ChehabUCH2 in1 temp4 +2.5V 72*7ebd8b66SMauro Carvalho ChehabUCH3 in2 temp5 VccP (processor core) 73*7ebd8b66SMauro Carvalho ChehabUCH4 in3 temp6 +5V 74*7ebd8b66SMauro Carvalho ChehabUCH5 in4 temp7 +12V 75*7ebd8b66SMauro Carvalho Chehab+3.3V in5 Internal VCC (+3.3V) 76*7ebd8b66SMauro Carvalho Chehab=============== ============== =========== ================================ 77*7ebd8b66SMauro Carvalho Chehab 78*7ebd8b66SMauro Carvalho Chehab 79*7ebd8b66SMauro Carvalho ChehabVoltage Monitoring 80*7ebd8b66SMauro Carvalho Chehab------------------ 81*7ebd8b66SMauro Carvalho Chehab 82*7ebd8b66SMauro Carvalho ChehabVoltages are sampled by an 8-bit ADC with a LSB of ~10mV. The supported input 83*7ebd8b66SMauro Carvalho Chehabrange is thus from 0 to 2.60V. Voltage values outside of this range need 84*7ebd8b66SMauro Carvalho Chehabexternal scaling resistors. This external scaling needs to be compensated for 85*7ebd8b66SMauro Carvalho Chehabvia compute lines in sensors.conf, like: 86*7ebd8b66SMauro Carvalho Chehab 87*7ebd8b66SMauro Carvalho Chehabcompute inx @*(1+R1/R2), @/(1+R1/R2) 88*7ebd8b66SMauro Carvalho Chehab 89*7ebd8b66SMauro Carvalho ChehabThe board level scaling resistors according to VIA's recommendation are as 90*7ebd8b66SMauro Carvalho Chehabfollows. And this is of course totally dependent on the actual board 91*7ebd8b66SMauro Carvalho Chehabimplementation :-) You will have to find documentation for your own 92*7ebd8b66SMauro Carvalho Chehabmotherboard and edit sensors.conf accordingly. 93*7ebd8b66SMauro Carvalho Chehab 94*7ebd8b66SMauro Carvalho Chehab============= ====== ====== ========= ============ 95*7ebd8b66SMauro Carvalho Chehab Expected 96*7ebd8b66SMauro Carvalho ChehabVoltage R1 R2 Divider Raw Value 97*7ebd8b66SMauro Carvalho Chehab============= ====== ====== ========= ============ 98*7ebd8b66SMauro Carvalho Chehab+2.5V 2K 10K 1.2 2083 mV 99*7ebd8b66SMauro Carvalho ChehabVccP --- --- 1.0 1400 mV [1]_ 100*7ebd8b66SMauro Carvalho Chehab+5V 14K 10K 2.4 2083 mV 101*7ebd8b66SMauro Carvalho Chehab+12V 47K 10K 5.7 2105 mV 102*7ebd8b66SMauro Carvalho Chehab+3.3V (int) 2K 3.4K 1.588 3300 mV [2]_ 103*7ebd8b66SMauro Carvalho Chehab+3.3V (ext) 6.8K 10K 1.68 1964 mV 104*7ebd8b66SMauro Carvalho Chehab============= ====== ====== ========= ============ 105*7ebd8b66SMauro Carvalho Chehab 106*7ebd8b66SMauro Carvalho Chehab.. [1] Depending on the CPU (1.4V is for a VIA C3 Nehemiah). 107*7ebd8b66SMauro Carvalho Chehab 108*7ebd8b66SMauro Carvalho Chehab.. [2] R1 and R2 for 3.3V (int) are internal to the VT1211 chip and the driver 109*7ebd8b66SMauro Carvalho Chehab performs the scaling and returns the properly scaled voltage value. 110*7ebd8b66SMauro Carvalho Chehab 111*7ebd8b66SMauro Carvalho ChehabEach measured voltage has an associated low and high limit which triggers an 112*7ebd8b66SMauro Carvalho Chehabalarm when crossed. 113*7ebd8b66SMauro Carvalho Chehab 114*7ebd8b66SMauro Carvalho Chehab 115*7ebd8b66SMauro Carvalho ChehabTemperature Monitoring 116*7ebd8b66SMauro Carvalho Chehab---------------------- 117*7ebd8b66SMauro Carvalho Chehab 118*7ebd8b66SMauro Carvalho ChehabTemperatures are reported in millidegree Celsius. Each measured temperature 119*7ebd8b66SMauro Carvalho Chehabhas a high limit which triggers an alarm if crossed. There is an associated 120*7ebd8b66SMauro Carvalho Chehabhysteresis value with each temperature below which the temperature has to drop 121*7ebd8b66SMauro Carvalho Chehabbefore the alarm is cleared (this is only true for interrupt mode 0). The 122*7ebd8b66SMauro Carvalho Chehabinterrupt mode can be forced to 0 in case the BIOS doesn't do it 123*7ebd8b66SMauro Carvalho Chehabautomatically. See the 'Module Parameters' section for details. 124*7ebd8b66SMauro Carvalho Chehab 125*7ebd8b66SMauro Carvalho ChehabAll temperature channels except temp2 are external. Temp2 is the VT1211 126*7ebd8b66SMauro Carvalho Chehabinternal thermal diode and the driver does all the scaling for temp2 and 127*7ebd8b66SMauro Carvalho Chehabreturns the temperature in millidegree Celsius. For the external channels 128*7ebd8b66SMauro Carvalho Chehabtemp1 and temp3-temp7, scaling depends on the board implementation and needs 129*7ebd8b66SMauro Carvalho Chehabto be performed in userspace via sensors.conf. 130*7ebd8b66SMauro Carvalho Chehab 131*7ebd8b66SMauro Carvalho ChehabTemp1 is an Intel-type thermal diode which requires the following formula to 132*7ebd8b66SMauro Carvalho Chehabconvert between sysfs readings and real temperatures: 133*7ebd8b66SMauro Carvalho Chehab 134*7ebd8b66SMauro Carvalho Chehabcompute temp1 (@-Offset)/Gain, (@*Gain)+Offset 135*7ebd8b66SMauro Carvalho Chehab 136*7ebd8b66SMauro Carvalho ChehabAccording to the VIA VT1211 BIOS porting guide, the following gain and offset 137*7ebd8b66SMauro Carvalho Chehabvalues should be used: 138*7ebd8b66SMauro Carvalho Chehab 139*7ebd8b66SMauro Carvalho Chehab=============== ======== =========== 140*7ebd8b66SMauro Carvalho ChehabDiode Type Offset Gain 141*7ebd8b66SMauro Carvalho Chehab=============== ======== =========== 142*7ebd8b66SMauro Carvalho ChehabIntel CPU 88.638 0.9528 143*7ebd8b66SMauro Carvalho Chehab 65.000 0.9686 [3]_ 144*7ebd8b66SMauro Carvalho ChehabVIA C3 Ezra 83.869 0.9528 145*7ebd8b66SMauro Carvalho ChehabVIA C3 Ezra-T 73.869 0.9528 146*7ebd8b66SMauro Carvalho Chehab=============== ======== =========== 147*7ebd8b66SMauro Carvalho Chehab 148*7ebd8b66SMauro Carvalho Chehab.. [3] This is the formula from the lm_sensors 2.10.0 sensors.conf file. I don't 149*7ebd8b66SMauro Carvalho Chehab know where it comes from or how it was derived, it's just listed here for 150*7ebd8b66SMauro Carvalho Chehab completeness. 151*7ebd8b66SMauro Carvalho Chehab 152*7ebd8b66SMauro Carvalho ChehabTemp3-temp7 support NTC thermistors. For these channels, the driver returns 153*7ebd8b66SMauro Carvalho Chehabthe voltages as seen at the individual pins of UCH1-UCH5. The voltage at the 154*7ebd8b66SMauro Carvalho Chehabpin (Vpin) is formed by a voltage divider made of the thermistor (Rth) and a 155*7ebd8b66SMauro Carvalho Chehabscaling resistor (Rs):: 156*7ebd8b66SMauro Carvalho Chehab 157*7ebd8b66SMauro Carvalho Chehab Vpin = 2200 * Rth / (Rs + Rth) (2200 is the ADC max limit of 2200 mV) 158*7ebd8b66SMauro Carvalho Chehab 159*7ebd8b66SMauro Carvalho ChehabThe equation for the thermistor is as follows (google it if you want to know 160*7ebd8b66SMauro Carvalho Chehabmore about it):: 161*7ebd8b66SMauro Carvalho Chehab 162*7ebd8b66SMauro Carvalho Chehab Rth = Ro * exp(B * (1 / T - 1 / To)) (To is 298.15K (25C) and Ro is the 163*7ebd8b66SMauro Carvalho Chehab nominal resistance at 25C) 164*7ebd8b66SMauro Carvalho Chehab 165*7ebd8b66SMauro Carvalho ChehabMingling the above two equations and assuming Rs = Ro and B = 3435 yields the 166*7ebd8b66SMauro Carvalho Chehabfollowing formula for sensors.conf:: 167*7ebd8b66SMauro Carvalho Chehab 168*7ebd8b66SMauro Carvalho Chehab compute tempx 1 / (1 / 298.15 - (` (2200 / @ - 1)) / 3435) - 273.15, 169*7ebd8b66SMauro Carvalho Chehab 2200 / (1 + (^ (3435 / 298.15 - 3435 / (273.15 + @)))) 170*7ebd8b66SMauro Carvalho Chehab 171*7ebd8b66SMauro Carvalho Chehab 172*7ebd8b66SMauro Carvalho ChehabFan Speed Control 173*7ebd8b66SMauro Carvalho Chehab----------------- 174*7ebd8b66SMauro Carvalho Chehab 175*7ebd8b66SMauro Carvalho ChehabThe VT1211 provides 2 programmable PWM outputs to control the speeds of 2 176*7ebd8b66SMauro Carvalho Chehabfans. Writing a 2 to any of the two pwm[1-2]_enable sysfs nodes will put the 177*7ebd8b66SMauro Carvalho ChehabPWM controller in automatic mode. There is only a single controller that 178*7ebd8b66SMauro Carvalho Chehabcontrols both PWM outputs but each PWM output can be individually enabled and 179*7ebd8b66SMauro Carvalho Chehabdisabled. 180*7ebd8b66SMauro Carvalho Chehab 181*7ebd8b66SMauro Carvalho ChehabEach PWM has 4 associated distinct output duty-cycles: full, high, low and 182*7ebd8b66SMauro Carvalho Chehaboff. Full and off are internally hard-wired to 255 (100%) and 0 (0%), 183*7ebd8b66SMauro Carvalho Chehabrespectively. High and low can be programmed via 184*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point[2-3]_pwm. Each PWM output can be associated with a 185*7ebd8b66SMauro Carvalho Chehabdifferent thermal input but - and here's the weird part - only one set of 186*7ebd8b66SMauro Carvalho Chehabthermal thresholds exist that controls both PWMs output duty-cycles. The 187*7ebd8b66SMauro Carvalho Chehabthermal thresholds are accessible via pwm[1-2]_auto_point[1-4]_temp. Note 188*7ebd8b66SMauro Carvalho Chehabthat even though there are 2 sets of 4 auto points each, they map to the same 189*7ebd8b66SMauro Carvalho Chehabregisters in the VT1211 and programming one set is sufficient (actually only 190*7ebd8b66SMauro Carvalho Chehabthe first set pwm1_auto_point[1-4]_temp is writable, the second set is 191*7ebd8b66SMauro Carvalho Chehabread-only). 192*7ebd8b66SMauro Carvalho Chehab 193*7ebd8b66SMauro Carvalho Chehab========================== ========================================= 194*7ebd8b66SMauro Carvalho ChehabPWM Auto Point PWM Output Duty-Cycle 195*7ebd8b66SMauro Carvalho Chehab========================== ========================================= 196*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point4_pwm full speed duty-cycle (hard-wired to 255) 197*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point3_pwm high speed duty-cycle 198*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point2_pwm low speed duty-cycle 199*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point1_pwm off duty-cycle (hard-wired to 0) 200*7ebd8b66SMauro Carvalho Chehab========================== ========================================= 201*7ebd8b66SMauro Carvalho Chehab 202*7ebd8b66SMauro Carvalho Chehab========================== ================= 203*7ebd8b66SMauro Carvalho ChehabTemp Auto Point Thermal Threshold 204*7ebd8b66SMauro Carvalho Chehab========================== ================= 205*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point4_temp full speed temp 206*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point3_temp high speed temp 207*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point2_temp low speed temp 208*7ebd8b66SMauro Carvalho Chehabpwm[1-2]_auto_point1_temp off temp 209*7ebd8b66SMauro Carvalho Chehab========================== ================= 210*7ebd8b66SMauro Carvalho Chehab 211*7ebd8b66SMauro Carvalho ChehabLong story short, the controller implements the following algorithm to set the 212*7ebd8b66SMauro Carvalho ChehabPWM output duty-cycle based on the input temperature: 213*7ebd8b66SMauro Carvalho Chehab 214*7ebd8b66SMauro Carvalho Chehab=================== ======================= ======================== 215*7ebd8b66SMauro Carvalho ChehabThermal Threshold Output Duty-Cycle Output Duty-Cycle 216*7ebd8b66SMauro Carvalho Chehab (Rising Temp) (Falling Temp) 217*7ebd8b66SMauro Carvalho Chehab=================== ======================= ======================== 218*7ebd8b66SMauro Carvalho Chehab- full speed duty-cycle full speed duty-cycle 219*7ebd8b66SMauro Carvalho Chehabfull speed temp 220*7ebd8b66SMauro Carvalho Chehab- high speed duty-cycle full speed duty-cycle 221*7ebd8b66SMauro Carvalho Chehabhigh speed temp 222*7ebd8b66SMauro Carvalho Chehab- low speed duty-cycle high speed duty-cycle 223*7ebd8b66SMauro Carvalho Chehablow speed temp 224*7ebd8b66SMauro Carvalho Chehab- off duty-cycle low speed duty-cycle 225*7ebd8b66SMauro Carvalho Chehaboff temp 226*7ebd8b66SMauro Carvalho Chehab=================== ======================= ======================== 227