Back to home page

OSCL-LXR

 
 

    


0001 Kernel driver w83781d
0002 =====================
0003 
0004 Supported chips:
0005 
0006   * Winbond W83781D
0007 
0008     Prefix: 'w83781d'
0009 
0010     Addresses scanned: I2C 0x28 - 0x2f, ISA 0x290 (8 I/O ports)
0011 
0012     Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83781d.pdf
0013 
0014   * Winbond W83782D
0015 
0016     Prefix: 'w83782d'
0017 
0018     Addresses scanned: I2C 0x28 - 0x2f, ISA 0x290 (8 I/O ports)
0019 
0020     Datasheet: https://www.winbond.com
0021 
0022   * Winbond W83783S
0023 
0024     Prefix: 'w83783s'
0025 
0026     Addresses scanned: I2C 0x2d
0027 
0028     Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/w83783s.pdf
0029 
0030   * Asus AS99127F
0031 
0032     Prefix: 'as99127f'
0033 
0034     Addresses scanned: I2C 0x28 - 0x2f
0035 
0036     Datasheet: Unavailable from Asus
0037 
0038 
0039 
0040 Authors:
0041 
0042       - Frodo Looijaard <frodol@dds.nl>,
0043       - Philip Edelbrock <phil@netroedge.com>,
0044       - Mark Studebaker <mdsxyz123@yahoo.com>
0045 
0046 Module parameters
0047 -----------------
0048 
0049 * init int
0050     (default 1)
0051 
0052     Use 'init=0' to bypass initializing the chip.
0053     Try this if your computer crashes when you load the module.
0054 
0055 * reset int
0056     (default 0)
0057     The driver used to reset the chip on load, but does no more. Use
0058     'reset=1' to restore the old behavior. Report if you need to do this.
0059 
0060 force_subclients=bus,caddr,saddr,saddr
0061   This is used to force the i2c addresses for subclients of
0062   a certain chip. Typical usage is `force_subclients=0,0x2d,0x4a,0x4b`
0063   to force the subclients of chip 0x2d on bus 0 to i2c addresses
0064   0x4a and 0x4b. This parameter is useful for certain Tyan boards.
0065 
0066 Description
0067 -----------
0068 
0069 This driver implements support for the Winbond W83781D, W83782D, W83783S
0070 chips, and the Asus AS99127F chips. We will refer to them collectively as
0071 W8378* chips.
0072 
0073 There is quite some difference between these chips, but they are similar
0074 enough that it was sensible to put them together in one driver.
0075 The Asus chips are similar to an I2C-only W83782D.
0076 
0077 +----------+---------+--------+-------+-------+---------+--------+------+-----+
0078 | Chip     | #vin    | #fanin | #pwm  | #temp | wchipid | vendid | i2c  | ISA |
0079 +----------+---------+--------+-------+-------+---------+--------+------+-----+
0080 | as99127f | 7       | 3      | 0     | 3     | 0x31    | 0x12c3 | yes  |  no |
0081 +----------+---------+--------+-------+-------+---------+--------+------+-----+
0082 | as99127f rev.2 (type_name = as99127f)       | 0x31    | 0x5ca3 | yes  |  no |
0083 +----------+---------+--------+-------+-------+---------+--------+------+-----+
0084 | w83781d  | 7       | 3      | 0     | 3     | 0x10-1  | 0x5ca3 | yes  | yes |
0085 +----------+---------+--------+-------+-------+---------+--------+------+-----+
0086 | w83782d  | 9       | 3      | 2-4   | 3     | 0x30    | 0x5ca3 | yes  | yes |
0087 +----------+---------+--------+-------+-------+---------+--------+------+-----+
0088 | w83783s  | 5-6     | 3      | 2     |  1-2  | 0x40    | 0x5ca3 | yes  |  no |
0089 +----------+---------+--------+-------+-------+---------+--------+------+-----+
0090 
0091 Detection of these chips can sometimes be foiled because they can be in
0092 an internal state that allows no clean access. If you know the address
0093 of the chip, use a 'force' parameter; this will put them into a more
0094 well-behaved state first.
0095 
0096 The W8378* implements temperature sensors (three on the W83781D and W83782D,
0097 two on the W83783S), three fan rotation speed sensors, voltage sensors
0098 (seven on the W83781D, nine on the W83782D and six on the W83783S), VID
0099 lines, alarms with beep warnings, and some miscellaneous stuff.
0100 
0101 Temperatures are measured in degrees Celsius. There is always one main
0102 temperature sensor, and one (W83783S) or two (W83781D and W83782D) other
0103 sensors. An alarm is triggered for the main sensor once when the
0104 Overtemperature Shutdown limit is crossed; it is triggered again as soon as
0105 it drops below the Hysteresis value. A more useful behavior
0106 can be found by setting the Hysteresis value to +127 degrees Celsius; in
0107 this case, alarms are issued during all the time when the actual temperature
0108 is above the Overtemperature Shutdown value. The driver sets the
0109 hysteresis value for temp1 to 127 at initialization.
0110 
0111 For the other temperature sensor(s), an alarm is triggered when the
0112 temperature gets higher then the Overtemperature Shutdown value; it stays
0113 on until the temperature falls below the Hysteresis value. But on the
0114 W83781D, there is only one alarm that functions for both other sensors!
0115 Temperatures are guaranteed within a range of -55 to +125 degrees. The
0116 main temperature sensors has a resolution of 1 degree; the other sensor(s)
0117 of 0.5 degree.
0118 
0119 Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
0120 triggered if the rotation speed has dropped below a programmable limit. Fan
0121 readings can be divided by a programmable divider (1, 2, 4 or 8 for the
0122 W83781D; 1, 2, 4, 8, 16, 32, 64 or 128 for the others) to give
0123 the readings more range or accuracy. Not all RPM values can accurately
0124 be represented, so some rounding is done. With a divider of 2, the lowest
0125 representable value is around 2600 RPM.
0126 
0127 Voltage sensors (also known as IN sensors) report their values in volts.
0128 An alarm is triggered if the voltage has crossed a programmable minimum
0129 or maximum limit. Note that minimum in this case always means 'closest to
0130 zero'; this is important for negative voltage measurements. All voltage
0131 inputs can measure voltages between 0 and 4.08 volts, with a resolution
0132 of 0.016 volt.
0133 
0134 The VID lines encode the core voltage value: the voltage level your processor
0135 should work with. This is hardcoded by the mainboard and/or processor itself.
0136 It is a value in volts. When it is unconnected, you will often find the
0137 value 3.50 V here.
0138 
0139 The W83782D and W83783S temperature conversion machine understands about
0140 several kinds of temperature probes. You can program the so-called
0141 beta value in the sensor files. '1' is the PII/Celeron diode, '2' is the
0142 TN3904 transistor, and 3435 the default thermistor value. Other values
0143 are (not yet) supported.
0144 
0145 In addition to the alarms described above, there is a CHAS alarm on the
0146 chips which triggers if your computer case is open.
0147 
0148 When an alarm goes off, you can be warned by a beeping signal through
0149 your computer speaker. It is possible to enable all beeping globally,
0150 or only the beeping for some alarms.
0151 
0152 Individual alarm and beep bits:
0153 
0154 ======== ==========================
0155 0x000001 in0
0156 0x000002 in1
0157 0x000004 in2
0158 0x000008 in3
0159 0x000010 temp1
0160 0x000020 temp2 (+temp3 on W83781D)
0161 0x000040 fan1
0162 0x000080 fan2
0163 0x000100 in4
0164 0x000200 in5
0165 0x000400 in6
0166 0x000800 fan3
0167 0x001000 chassis
0168 0x002000 temp3 (W83782D only)
0169 0x010000 in7 (W83782D only)
0170 0x020000 in8 (W83782D only)
0171 ======== ==========================
0172 
0173 If an alarm triggers, it will remain triggered until the hardware register
0174 is read at least once. This means that the cause for the alarm may
0175 already have disappeared! Note that in the current implementation, all
0176 hardware registers are read whenever any data is read (unless it is less
0177 than 1.5 seconds since the last update). This means that you can easily
0178 miss once-only alarms.
0179 
0180 The chips only update values each 1.5 seconds; reading them more often
0181 will do no harm, but will return 'old' values.
0182 
0183 AS99127F PROBLEMS
0184 -----------------
0185 The as99127f support was developed without the benefit of a datasheet.
0186 In most cases it is treated as a w83781d (although revision 2 of the
0187 AS99127F looks more like a w83782d).
0188 This support will be BETA until a datasheet is released.
0189 One user has reported problems with fans stopping
0190 occasionally.
0191 
0192 Note that the individual beep bits are inverted from the other chips.
0193 The driver now takes care of this so that user-space applications
0194 don't have to know about it.
0195 
0196 Known problems:
0197         - Problems with diode/thermistor settings (supported?)
0198         - One user reports fans stopping under high server load.
0199         - Revision 2 seems to have 2 PWM registers but we don't know
0200           how to handle them. More details below.
0201 
0202 These will not be fixed unless we get a datasheet.
0203 If you have problems, please lobby Asus to release a datasheet.
0204 Unfortunately several others have without success.
0205 Please do not send mail to us asking for better as99127f support.
0206 We have done the best we can without a datasheet.
0207 Please do not send mail to the author or the sensors group asking for
0208 a datasheet or ideas on how to convince Asus. We can't help.
0209 
0210 
0211 NOTES
0212 -----
0213   783s has no in1 so that in[2-6] are compatible with the 781d/782d.
0214 
0215   783s pin is programmable for -5V or temp1; defaults to -5V,
0216   no control in driver so temp1 doesn't work.
0217 
0218   782d and 783s datasheets differ on which is pwm1 and which is pwm2.
0219   We chose to follow 782d.
0220 
0221   782d and 783s pin is programmable for fan3 input or pwm2 output;
0222   defaults to fan3 input.
0223   If pwm2 is enabled (with echo 255 1 > pwm2), then
0224   fan3 will report 0.
0225 
0226   782d has pwm1-2 for ISA, pwm1-4 for i2c. (pwm3-4 share pins with
0227   the ISA pins)
0228 
0229 Data sheet updates
0230 ------------------
0231         - PWM clock registers:
0232                 * 000: master /  512
0233                 * 001: master / 1024
0234                 * 010: master / 2048
0235                 * 011: master / 4096
0236                 * 100: master / 8192
0237 
0238 
0239 Answers from Winbond tech support
0240 ---------------------------------
0241 
0242 ::
0243 
0244   >
0245   > 1) In the W83781D data sheet section 7.2 last paragraph, it talks about
0246   >    reprogramming the R-T table if the Beta of the thermistor is not
0247   >    3435K. The R-T table is described briefly in section 8.20.
0248   >    What formulas do I use to program a new R-T table for a given Beta?
0249   >
0250 
0251   We are sorry that the calculation for R-T table value is
0252   confidential. If you have another Beta value of thermistor, we can help
0253   to calculate the R-T table for you. But you should give us real R-T
0254   Table which can be gotten by thermistor vendor. Therefore we will calculate
0255   them and obtain 32-byte data, and you can fill the 32-byte data to the
0256   register in Bank0.CR51 of W83781D.
0257 
0258 
0259   > 2) In the W83782D data sheet, it mentions that pins 38, 39, and 40 are
0260   >    programmable to be either thermistor or Pentium II diode inputs.
0261   >    How do I program them for diode inputs? I can't find any register
0262   >    to program these to be diode inputs.
0263 
0264   You may program Bank0 CR[5Dh] and CR[59h] registers.
0265 
0266   =============================== =============== ============== ============
0267         CR[5Dh]                 bit 1(VTIN1)    bit 2(VTIN2)   bit 3(VTIN3)
0268 
0269                 thermistor                0              0              0
0270         diode                     1              1              1
0271 
0272 
0273   (error) CR[59h]               bit 4(VTIN1)    bit 2(VTIN2)   bit 3(VTIN3)
0274   (right) CR[59h]               bit 4(VTIN1)    bit 5(VTIN2)   bit 6(VTIN3)
0275 
0276         PII thermal diode         1              1              1
0277         2N3904  diode             0              0              0
0278   =============================== =============== ============== ============
0279 
0280 
0281 Asus Clones
0282 -----------
0283 
0284 We have no datasheets for the Asus clones (AS99127F and ASB100 Bach).
0285 Here are some very useful information that were given to us by Alex Van
0286 Kaam about how to detect these chips, and how to read their values. He
0287 also gives advice for another Asus chipset, the Mozart-2 (which we
0288 don't support yet). Thanks Alex!
0289 
0290 I reworded some parts and added personal comments.
0291 
0292 Detection
0293 ^^^^^^^^^
0294 
0295 AS99127F rev.1, AS99127F rev.2 and ASB100:
0296 - I2C address range: 0x29 - 0x2F
0297 - If register 0x58 holds 0x31 then we have an Asus (either ASB100 or AS99127F)
0298 - Which one depends on register 0x4F (manufacturer ID):
0299 
0300   - 0x06 or 0x94: ASB100
0301   - 0x12 or 0xC3: AS99127F rev.1
0302   - 0x5C or 0xA3: AS99127F rev.2
0303 
0304   Note that 0x5CA3 is Winbond's ID (WEC), which let us think Asus get their
0305   AS99127F rev.2 direct from Winbond. The other codes mean ATT and DVC,
0306   respectively. ATT could stand for Asustek something (although it would be
0307   very badly chosen IMHO), I don't know what DVC could stand for. Maybe
0308   these codes simply aren't meant to be decoded that way.
0309 
0310 Mozart-2:
0311 - I2C address: 0x77
0312 - If register 0x58 holds 0x56 or 0x10 then we have a Mozart-2
0313 - Of the Mozart there are 3 types:
0314 
0315   - 0x58=0x56, 0x4E=0x94, 0x4F=0x36: Asus ASM58 Mozart-2
0316   - 0x58=0x56, 0x4E=0x94, 0x4F=0x06: Asus AS2K129R Mozart-2
0317   - 0x58=0x10, 0x4E=0x5C, 0x4F=0xA3: Asus ??? Mozart-2
0318 
0319   You can handle all 3 the exact same way :)
0320 
0321 Temperature sensors
0322 ^^^^^^^^^^^^^^^^^^^
0323 
0324 ASB100:
0325   - sensor 1: register 0x27
0326   - sensor 2 & 3 are the 2 LM75's on the SMBus
0327   - sensor 4: register 0x17
0328 
0329 Remark:
0330 
0331   I noticed that on Intel boards sensor 2 is used for the CPU
0332   and 4 is ignored/stuck, on AMD boards sensor 4 is the CPU and sensor 2 is
0333   either ignored or a socket temperature.
0334 
0335 AS99127F (rev.1 and 2 alike):
0336   - sensor 1: register 0x27
0337   - sensor 2 & 3 are the 2 LM75's on the SMBus
0338 
0339 Remark:
0340 
0341   Register 0x5b is suspected to be temperature type selector. Bit 1
0342   would control temp1, bit 3 temp2 and bit 5 temp3.
0343 
0344 Mozart-2:
0345   - sensor 1: register 0x27
0346   - sensor 2: register 0x13
0347 
0348 Fan sensors
0349 ^^^^^^^^^^^
0350 
0351 ASB100, AS99127F (rev.1 and 2 alike):
0352   - 3 fans, identical to the W83781D
0353 
0354 Mozart-2:
0355   - 2 fans only, 1350000/RPM/div
0356   - fan 1: register 0x28,  divisor on register 0xA1 (bits 4-5)
0357   - fan 2: register 0x29,  divisor on register 0xA1 (bits 6-7)
0358 
0359 Voltages
0360 ^^^^^^^^
0361 
0362 This is where there is a difference between AS99127F rev.1 and 2.
0363 
0364 Remark:
0365 
0366   The difference is similar to the difference between
0367   W83781D and W83782D.
0368 
0369 ASB100:
0370   - in0=r(0x20)*0.016
0371   - in1=r(0x21)*0.016
0372   - in2=r(0x22)*0.016
0373   - in3=r(0x23)*0.016*1.68
0374   - in4=r(0x24)*0.016*3.8
0375   - in5=r(0x25)*(-0.016)*3.97
0376   - in6=r(0x26)*(-0.016)*1.666
0377 
0378 AS99127F rev.1:
0379   - in0=r(0x20)*0.016
0380   - in1=r(0x21)*0.016
0381   - in2=r(0x22)*0.016
0382   - in3=r(0x23)*0.016*1.68
0383   - in4=r(0x24)*0.016*3.8
0384   - in5=r(0x25)*(-0.016)*3.97
0385   - in6=r(0x26)*(-0.016)*1.503
0386 
0387 AS99127F rev.2:
0388   - in0=r(0x20)*0.016
0389   - in1=r(0x21)*0.016
0390   - in2=r(0x22)*0.016
0391   - in3=r(0x23)*0.016*1.68
0392   - in4=r(0x24)*0.016*3.8
0393   - in5=(r(0x25)*0.016-3.6)*5.14+3.6
0394   - in6=(r(0x26)*0.016-3.6)*3.14+3.6
0395 
0396 Mozart-2:
0397   - in0=r(0x20)*0.016
0398   - in1=255
0399   - in2=r(0x22)*0.016
0400   - in3=r(0x23)*0.016*1.68
0401   - in4=r(0x24)*0.016*4
0402   - in5=255
0403   - in6=255
0404 
0405 
0406 PWM
0407 ^^^
0408 
0409 * Additional info about PWM on the AS99127F (may apply to other Asus
0410   chips as well) by Jean Delvare as of 2004-04-09:
0411 
0412 AS99127F revision 2 seems to have two PWM registers at 0x59 and 0x5A,
0413 and a temperature sensor type selector at 0x5B (which basically means
0414 that they swapped registers 0x59 and 0x5B when you compare with Winbond
0415 chips).
0416 Revision 1 of the chip also has the temperature sensor type selector at
0417 0x5B, but PWM registers have no effect.
0418 
0419 We don't know exactly how the temperature sensor type selection works.
0420 Looks like bits 1-0 are for temp1, bits 3-2 for temp2 and bits 5-4 for
0421 temp3, although it is possible that only the most significant bit matters
0422 each time. So far, values other than 0 always broke the readings.
0423 
0424 PWM registers seem to be split in two parts: bit 7 is a mode selector,
0425 while the other bits seem to define a value or threshold.
0426 
0427 When bit 7 is clear, bits 6-0 seem to hold a threshold value. If the value
0428 is below a given limit, the fan runs at low speed. If the value is above
0429 the limit, the fan runs at full speed. We have no clue as to what the limit
0430 represents. Note that there seem to be some inertia in this mode, speed
0431 changes may need some time to trigger. Also, an hysteresis mechanism is
0432 suspected since walking through all the values increasingly and then
0433 decreasingly led to slightly different limits.
0434 
0435 When bit 7 is set, bits 3-0 seem to hold a threshold value, while bits 6-4
0436 would not be significant. If the value is below a given limit, the fan runs
0437 at full speed, while if it is above the limit it runs at low speed (so this
0438 is the contrary of the other mode, in a way). Here again, we don't know
0439 what the limit is supposed to represent.
0440 
0441 One remarkable thing is that the fans would only have two or three
0442 different speeds (transitional states left apart), not a whole range as
0443 you usually get with PWM.
0444 
0445 As a conclusion, you can write 0x00 or 0x8F to the PWM registers to make
0446 fans run at low speed, and 0x7F or 0x80 to make them run at full speed.
0447 
0448 Please contact us if you can figure out how it is supposed to work. As
0449 long as we don't know more, the w83781d driver doesn't handle PWM on
0450 AS99127F chips at all.
0451 
0452 * Additional info about PWM on the AS99127F rev.1 by Hector Martin:
0453 
0454 I've been fiddling around with the (in)famous 0x59 register and
0455 found out the following values do work as a form of coarse pwm:
0456 
0457 0x80
0458  - seems to turn fans off after some time(1-2 minutes)... might be
0459    some form of auto-fan-control based on temp? hmm (Qfan? this mobo is an
0460    old ASUS, it isn't marketed as Qfan. Maybe some beta pre-attempt at Qfan
0461    that was dropped at the BIOS)
0462 0x81
0463  - off
0464 0x82
0465  - slightly "on-ner" than off, but my fans do not get to move. I can
0466    hear the high-pitched PWM sound that motors give off at too-low-pwm.
0467 0x83
0468  - now they do move. Estimate about 70% speed or so.
0469 0x84-0x8f
0470  - full on
0471 
0472 Changing the high nibble doesn't seem to do much except the high bit
0473 (0x80) must be set for PWM to work, else the current pwm doesn't seem to
0474 change.
0475 
0476 My mobo is an ASUS A7V266-E. This behavior is similar to what I got
0477 with speedfan under Windows, where 0-15% would be off, 15-2x% (can't
0478 remember the exact value) would be 70% and higher would be full on.
0479 
0480 * Additional info about PWM on the AS99127F rev.1 from lm-sensors
0481   ticket #2350:
0482 
0483 I conducted some experiment on Asus P3B-F motherboard with AS99127F
0484 (Ver. 1).
0485 
0486 I confirm that 0x59 register control the CPU_Fan Header on this
0487 motherboard, and 0x5a register control PWR_Fan.
0488 
0489 In order to reduce the dependency of specific fan, the measurement is
0490 conducted with a digital scope without fan connected. I found out that
0491 P3B-F actually output variable DC voltage on fan header center pin,
0492 looks like PWM is filtered on this motherboard.
0493 
0494 Here are some of measurements:
0495 
0496 ==== =========
0497 0x80     20 mV
0498 0x81     20 mV
0499 0x82    232 mV
0500 0x83   1.2  V
0501 0x84   2.31 V
0502 0x85   3.44 V
0503 0x86   4.62 V
0504 0x87   5.81 V
0505 0x88   7.01 V
0506 9x89   8.22 V
0507 0x8a   9.42 V
0508 0x8b  10.6  V
0509 0x8c  11.9  V
0510 0x8d  12.4  V
0511 0x8e  12.4  V
0512 0x8f  12.4  V
0513 ==== =========