xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/abituguru-datasheet.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===============
2*4882a593SmuzhiyunuGuru datasheet
3*4882a593Smuzhiyun===============
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunFirst of all, what I know about uGuru is no fact based on any help, hints or
6*4882a593Smuzhiyundatasheet from Abit. The data I have got on uGuru have I assembled through
7*4882a593Smuzhiyunmy weak knowledge in "backwards engineering".
8*4882a593SmuzhiyunAnd just for the record, you may have noticed uGuru isn't a chip developed by
9*4882a593SmuzhiyunAbit, as they claim it to be. It's really just an microprocessor (uC) created by
10*4882a593SmuzhiyunWinbond (W83L950D). And no, reading the manual for this specific uC or
11*4882a593Smuzhiyunmailing  Windbond for help won't give any useful data about uGuru, as it is
12*4882a593Smuzhiyunthe program inside the uC that is responding to calls.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunOlle Sandberg <ollebull@gmail.com>, 2005-05-25
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunOriginal version by Olle Sandberg who did the heavy lifting of the initial
18*4882a593Smuzhiyunreverse engineering. This version has been almost fully rewritten for clarity
19*4882a593Smuzhiyunand extended with write support and info on more databanks, the write support
20*4882a593Smuzhiyunis once again reverse engineered by Olle the additional databanks have been
21*4882a593Smuzhiyunreverse engineered by me. I would like to express my thanks to Olle, this
22*4882a593Smuzhiyundocument and the Linux driver could not have been written without his efforts.
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunNote: because of the lack of specs only the sensors part of the uGuru is
25*4882a593Smuzhiyundescribed here and not the CPU / RAM / etc voltage & frequency control.
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunHans de Goede <j.w.r.degoede@hhs.nl>, 28-01-2006
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunDetection
31*4882a593Smuzhiyun=========
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunAs far as known the uGuru is always placed at and using the (ISA) I/O-ports
34*4882a593Smuzhiyun0xE0 and 0xE4, so we don't have to scan any port-range, just check what the two
35*4882a593Smuzhiyunports are holding for detection. We will refer to 0xE0 as CMD (command-port)
36*4882a593Smuzhiyunand 0xE4 as DATA because Abit refers to them with these names.
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunIf DATA holds 0x00 or 0x08 and CMD holds 0x00 or 0xAC an uGuru could be
39*4882a593Smuzhiyunpresent. We have to check for two different values at data-port, because
40*4882a593Smuzhiyunafter a reboot uGuru will hold 0x00 here, but if the driver is removed and
41*4882a593Smuzhiyunlater on attached again data-port will hold 0x08, more about this later.
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunAfter wider testing of the Linux kernel driver some variants of the uGuru have
44*4882a593Smuzhiyunturned up which will hold 0x00 instead of 0xAC at the CMD port, thus we also
45*4882a593Smuzhiyunhave to test CMD for two different values. On these uGuru's DATA will initially
46*4882a593Smuzhiyunhold 0x09 and will only hold 0x08 after reading CMD first, so CMD must be read
47*4882a593Smuzhiyunfirst!
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunTo be really sure an uGuru is present a test read of one or more register
50*4882a593Smuzhiyunsets should be done.
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunReading / Writing
54*4882a593Smuzhiyun=================
55*4882a593Smuzhiyun
56*4882a593SmuzhiyunAddressing
57*4882a593Smuzhiyun----------
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunThe uGuru has a number of different addressing levels. The first addressing
60*4882a593Smuzhiyunlevel we will call banks. A bank holds data for one or more sensors. The data
61*4882a593Smuzhiyunin a bank for a sensor is one or more bytes large.
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunThe number of bytes is fixed for a given bank, you should always read or write
64*4882a593Smuzhiyunthat many bytes, reading / writing more will fail, the results when writing
65*4882a593Smuzhiyunless then the number of bytes for a given bank are undetermined.
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunSee below for all known bank addresses, numbers of sensors in that bank,
68*4882a593Smuzhiyunnumber of bytes data per sensor and contents/meaning of those bytes.
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunAlthough both this document and the kernel driver have kept the sensor
71*4882a593Smuzhiyunterminology for the addressing within a bank this is not 100% correct, in
72*4882a593Smuzhiyunbank 0x24 for example the addressing within the bank selects a PWM output not
73*4882a593Smuzhiyuna sensor.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunNotice that some banks have both a read and a write address this is how the
76*4882a593SmuzhiyunuGuru determines if a read from or a write to the bank is taking place, thus
77*4882a593Smuzhiyunwhen reading you should always use the read address and when writing the
78*4882a593Smuzhiyunwrite address. The write address is always one (1) more than the read address.
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunuGuru ready
82*4882a593Smuzhiyun-----------
83*4882a593Smuzhiyun
84*4882a593SmuzhiyunBefore you can read from or write to the uGuru you must first put the uGuru
85*4882a593Smuzhiyunin "ready" mode.
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunTo put the uGuru in ready mode first write 0x00 to DATA and then wait for DATA
88*4882a593Smuzhiyunto hold 0x09, DATA should read 0x09 within 250 read cycles.
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunNext CMD _must_ be read and should hold 0xAC, usually CMD will hold 0xAC the
91*4882a593Smuzhiyunfirst read but sometimes it takes a while before CMD holds 0xAC and thus it
92*4882a593Smuzhiyunhas to be read a number of times (max 50).
93*4882a593Smuzhiyun
94*4882a593SmuzhiyunAfter reading CMD, DATA should hold 0x08 which means that the uGuru is ready
95*4882a593Smuzhiyunfor input. As above DATA will usually hold 0x08 the first read but not always.
96*4882a593SmuzhiyunThis step can be skipped, but it is undetermined what happens if the uGuru has
97*4882a593Smuzhiyunnot yet reported 0x08 at DATA and you proceed with writing a bank address.
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunSending bank and sensor addresses to the uGuru
101*4882a593Smuzhiyun----------------------------------------------
102*4882a593Smuzhiyun
103*4882a593SmuzhiyunFirst the uGuru must be in "ready" mode as described above, DATA should hold
104*4882a593Smuzhiyun0x08 indicating that the uGuru wants input, in this case the bank address.
105*4882a593Smuzhiyun
106*4882a593SmuzhiyunNext write the bank address to DATA. After the bank address has been written
107*4882a593Smuzhiyunwait for to DATA to hold 0x08 again indicating that it wants / is ready for
108*4882a593Smuzhiyunmore input (max 250 reads).
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunOnce DATA holds 0x08 again write the sensor address to CMD.
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunReading
114*4882a593Smuzhiyun-------
115*4882a593Smuzhiyun
116*4882a593SmuzhiyunFirst send the bank and sensor addresses as described above.
117*4882a593SmuzhiyunThen for each byte of data you want to read wait for DATA to hold 0x01
118*4882a593Smuzhiyunwhich indicates that the uGuru is ready to be read (max 250 reads) and once
119*4882a593SmuzhiyunDATA holds 0x01 read the byte from CMD.
120*4882a593Smuzhiyun
121*4882a593SmuzhiyunOnce all bytes have been read data will hold 0x09, but there is no reason to
122*4882a593Smuzhiyuntest for this. Notice that the number of bytes is bank address dependent see
123*4882a593Smuzhiyunabove and below.
124*4882a593Smuzhiyun
125*4882a593SmuzhiyunAfter completing a successful read it is advised to put the uGuru back in
126*4882a593Smuzhiyunready mode, so that it is ready for the next read / write cycle. This way
127*4882a593Smuzhiyunif your program / driver is unloaded and later loaded again the detection
128*4882a593Smuzhiyunalgorithm described above will still work.
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun
132*4882a593SmuzhiyunWriting
133*4882a593Smuzhiyun-------
134*4882a593Smuzhiyun
135*4882a593SmuzhiyunFirst send the bank and sensor addresses as described above.
136*4882a593SmuzhiyunThen for each byte of data you want to write wait for DATA to hold 0x00
137*4882a593Smuzhiyunwhich indicates that the uGuru is ready to be written (max 250 reads) and
138*4882a593Smuzhiyunonce DATA holds 0x00 write the byte to CMD.
139*4882a593Smuzhiyun
140*4882a593SmuzhiyunOnce all bytes have been written wait for DATA to hold 0x01 (max 250 reads)
141*4882a593Smuzhiyundon't ask why this is the way it is.
142*4882a593Smuzhiyun
143*4882a593SmuzhiyunOnce DATA holds 0x01 read CMD it should hold 0xAC now.
144*4882a593Smuzhiyun
145*4882a593SmuzhiyunAfter completing a successful write it is advised to put the uGuru back in
146*4882a593Smuzhiyunready mode, so that it is ready for the next read / write cycle. This way
147*4882a593Smuzhiyunif your program / driver is unloaded and later loaded again the detection
148*4882a593Smuzhiyunalgorithm described above will still work.
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun
151*4882a593SmuzhiyunGotchas
152*4882a593Smuzhiyun-------
153*4882a593Smuzhiyun
154*4882a593SmuzhiyunAfter wider testing of the Linux kernel driver some variants of the uGuru have
155*4882a593Smuzhiyunturned up which do not hold 0x08 at DATA within 250 reads after writing the
156*4882a593Smuzhiyunbank address. With these versions this happens quite frequent, using larger
157*4882a593Smuzhiyuntimeouts doesn't help, they just go offline for a second or 2, doing some
158*4882a593Smuzhiyuninternal calibration or whatever. Your code should be prepared to handle
159*4882a593Smuzhiyunthis and in case of no response in this specific case just goto sleep for a
160*4882a593Smuzhiyunwhile and then retry.
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun
163*4882a593SmuzhiyunAddress Map
164*4882a593Smuzhiyun===========
165*4882a593Smuzhiyun
166*4882a593SmuzhiyunBank 0x20 Alarms (R)
167*4882a593Smuzhiyun--------------------
168*4882a593SmuzhiyunThis bank contains 0 sensors, iow the sensor address is ignored (but must be
169*4882a593Smuzhiyunwritten) just use 0. Bank 0x20 contains 3 bytes:
170*4882a593Smuzhiyun
171*4882a593SmuzhiyunByte 0:
172*4882a593Smuzhiyun  This byte holds the alarm flags for sensor 0-7 of Sensor Bank1, with bit 0
173*4882a593Smuzhiyun  corresponding to sensor 0, 1 to 1, etc.
174*4882a593Smuzhiyun
175*4882a593SmuzhiyunByte 1:
176*4882a593Smuzhiyun  This byte holds the alarm flags for sensor 8-15 of Sensor Bank1, with bit 0
177*4882a593Smuzhiyun  corresponding to sensor 8, 1 to 9, etc.
178*4882a593Smuzhiyun
179*4882a593SmuzhiyunByte 2:
180*4882a593Smuzhiyun  This byte holds the alarm flags for sensor 0-5 of Sensor Bank2, with bit 0
181*4882a593Smuzhiyun  corresponding to sensor 0, 1 to 1, etc.
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun
184*4882a593SmuzhiyunBank 0x21 Sensor Bank1 Values / Readings (R)
185*4882a593Smuzhiyun--------------------------------------------
186*4882a593SmuzhiyunThis bank contains 16 sensors, for each sensor it contains 1 byte.
187*4882a593SmuzhiyunSo far the following sensors are known to be available on all motherboards:
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun- Sensor  0 CPU temp
190*4882a593Smuzhiyun- Sensor  1 SYS temp
191*4882a593Smuzhiyun- Sensor  3 CPU core volt
192*4882a593Smuzhiyun- Sensor  4 DDR volt
193*4882a593Smuzhiyun- Sensor 10 DDR Vtt volt
194*4882a593Smuzhiyun- Sensor 15 PWM temp
195*4882a593Smuzhiyun
196*4882a593SmuzhiyunByte 0:
197*4882a593Smuzhiyun  This byte holds the reading from the sensor. Sensors in Bank1 can be both
198*4882a593Smuzhiyun  volt and temp sensors, this is motherboard specific. The uGuru however does
199*4882a593Smuzhiyun  seem to know (be programmed with) what kindoff sensor is attached see Sensor
200*4882a593Smuzhiyun  Bank1 Settings description.
201*4882a593Smuzhiyun
202*4882a593SmuzhiyunVolt sensors use a linear scale, a reading 0 corresponds with 0 volt and a
203*4882a593Smuzhiyunreading of 255 with 3494 mV. The sensors for higher voltages however are
204*4882a593Smuzhiyunconnected through a division circuit. The currently known division circuits
205*4882a593Smuzhiyunin use result in ranges of: 0-4361mV, 0-6248mV or 0-14510mV. 3.3 volt sources
206*4882a593Smuzhiyunuse the 0-4361mV range, 5 volt the 0-6248mV and 12 volt the 0-14510mV .
207*4882a593Smuzhiyun
208*4882a593SmuzhiyunTemp sensors also use a linear scale, a reading of 0 corresponds with 0 degree
209*4882a593SmuzhiyunCelsius and a reading of 255 with a reading of 255 degrees Celsius.
210*4882a593Smuzhiyun
211*4882a593Smuzhiyun
212*4882a593SmuzhiyunBank 0x22 Sensor Bank1 Settings (R) and Bank 0x23 Sensor Bank1 Settings (W)
213*4882a593Smuzhiyun---------------------------------------------------------------------------
214*4882a593Smuzhiyun
215*4882a593SmuzhiyunThose banks contain 16 sensors, for each sensor it contains 3 bytes. Each
216*4882a593Smuzhiyunset of 3 bytes contains the settings for the sensor with the same sensor
217*4882a593Smuzhiyunaddress in Bank 0x21 .
218*4882a593Smuzhiyun
219*4882a593SmuzhiyunByte 0:
220*4882a593Smuzhiyun  Alarm behaviour for the selected sensor. A 1 enables the described
221*4882a593Smuzhiyun  behaviour.
222*4882a593Smuzhiyun
223*4882a593SmuzhiyunBit 0:
224*4882a593Smuzhiyun  Give an alarm if measured temp is over the warning threshold		(RW) [1]_
225*4882a593Smuzhiyun
226*4882a593SmuzhiyunBit 1:
227*4882a593Smuzhiyun  Give an alarm if measured volt is over the max threshold		(RW) [2]_
228*4882a593Smuzhiyun
229*4882a593SmuzhiyunBit 2:
230*4882a593Smuzhiyun  Give an alarm if measured volt is under the min threshold		(RW) [2]_
231*4882a593Smuzhiyun
232*4882a593SmuzhiyunBit 3:
233*4882a593Smuzhiyun  Beep if alarm								(RW)
234*4882a593Smuzhiyun
235*4882a593SmuzhiyunBit 4:
236*4882a593Smuzhiyun  1 if alarm cause measured temp is over the warning threshold		(R)
237*4882a593Smuzhiyun
238*4882a593SmuzhiyunBit 5:
239*4882a593Smuzhiyun  1 if alarm cause measured volt is over the max threshold		(R)
240*4882a593Smuzhiyun
241*4882a593SmuzhiyunBit 6:
242*4882a593Smuzhiyun  1 if alarm cause measured volt is under the min threshold		(R)
243*4882a593Smuzhiyun
244*4882a593SmuzhiyunBit 7:
245*4882a593Smuzhiyun  - Volt sensor: Shutdown if alarm persist for more than 4 seconds	(RW)
246*4882a593Smuzhiyun  - Temp sensor: Shutdown if temp is over the shutdown threshold	(RW)
247*4882a593Smuzhiyun
248*4882a593Smuzhiyun.. [1] This bit is only honored/used by the uGuru if a temp sensor is connected
249*4882a593Smuzhiyun
250*4882a593Smuzhiyun.. [2] This bit is only honored/used by the uGuru if a volt sensor is connected
251*4882a593Smuzhiyun       Note with some trickery this can be used to find out what kinda sensor
252*4882a593Smuzhiyun       is detected see the Linux kernel driver for an example with many
253*4882a593Smuzhiyun       comments on how todo this.
254*4882a593Smuzhiyun
255*4882a593SmuzhiyunByte 1:
256*4882a593Smuzhiyun  - Temp sensor: warning threshold  (scale as bank 0x21)
257*4882a593Smuzhiyun  - Volt sensor: min threshold      (scale as bank 0x21)
258*4882a593Smuzhiyun
259*4882a593SmuzhiyunByte 2:
260*4882a593Smuzhiyun  - Temp sensor: shutdown threshold (scale as bank 0x21)
261*4882a593Smuzhiyun  - Volt sensor: max threshold      (scale as bank 0x21)
262*4882a593Smuzhiyun
263*4882a593Smuzhiyun
264*4882a593SmuzhiyunBank 0x24 PWM outputs for FAN's (R) and Bank 0x25 PWM outputs for FAN's (W)
265*4882a593Smuzhiyun---------------------------------------------------------------------------
266*4882a593Smuzhiyun
267*4882a593SmuzhiyunThose banks contain 3 "sensors", for each sensor it contains 5 bytes.
268*4882a593Smuzhiyun  - Sensor 0 usually controls the CPU fan
269*4882a593Smuzhiyun  - Sensor 1 usually controls the NB (or chipset for single chip) fan
270*4882a593Smuzhiyun  - Sensor 2 usually controls the System fan
271*4882a593Smuzhiyun
272*4882a593SmuzhiyunByte 0:
273*4882a593Smuzhiyun  Flag 0x80 to enable control, Fan runs at 100% when disabled.
274*4882a593Smuzhiyun  low nibble (temp)sensor address at bank 0x21 used for control.
275*4882a593Smuzhiyun
276*4882a593SmuzhiyunByte 1:
277*4882a593Smuzhiyun  0-255 = 0-12v (linear), specify voltage at which fan will rotate when under
278*4882a593Smuzhiyun  low threshold temp (specified in byte 3)
279*4882a593Smuzhiyun
280*4882a593SmuzhiyunByte 2:
281*4882a593Smuzhiyun  0-255 = 0-12v (linear), specify voltage at which fan will rotate when above
282*4882a593Smuzhiyun  high threshold temp (specified in byte 4)
283*4882a593Smuzhiyun
284*4882a593SmuzhiyunByte 3:
285*4882a593Smuzhiyun  Low threshold temp  (scale as bank 0x21)
286*4882a593Smuzhiyun
287*4882a593Smuzhiyunbyte 4:
288*4882a593Smuzhiyun  High threshold temp (scale as bank 0x21)
289*4882a593Smuzhiyun
290*4882a593Smuzhiyun
291*4882a593SmuzhiyunBank 0x26 Sensors Bank2 Values / Readings (R)
292*4882a593Smuzhiyun---------------------------------------------
293*4882a593Smuzhiyun
294*4882a593SmuzhiyunThis bank contains 6 sensors (AFAIK), for each sensor it contains 1 byte.
295*4882a593Smuzhiyun
296*4882a593SmuzhiyunSo far the following sensors are known to be available on all motherboards:
297*4882a593Smuzhiyun  - Sensor 0: CPU fan speed
298*4882a593Smuzhiyun  - Sensor 1: NB (or chipset for single chip) fan speed
299*4882a593Smuzhiyun  - Sensor 2: SYS fan speed
300*4882a593Smuzhiyun
301*4882a593SmuzhiyunByte 0:
302*4882a593Smuzhiyun  This byte holds the reading from the sensor. 0-255 = 0-15300 (linear)
303*4882a593Smuzhiyun
304*4882a593Smuzhiyun
305*4882a593SmuzhiyunBank 0x27 Sensors Bank2 Settings (R) and Bank 0x28 Sensors Bank2 Settings (W)
306*4882a593Smuzhiyun-----------------------------------------------------------------------------
307*4882a593Smuzhiyun
308*4882a593SmuzhiyunThose banks contain 6 sensors (AFAIK), for each sensor it contains 2 bytes.
309*4882a593Smuzhiyun
310*4882a593SmuzhiyunByte 0:
311*4882a593Smuzhiyun  Alarm behaviour for the selected sensor. A 1 enables the described behaviour.
312*4882a593Smuzhiyun
313*4882a593SmuzhiyunBit 0:
314*4882a593Smuzhiyun  Give an alarm if measured rpm is under the min threshold	(RW)
315*4882a593Smuzhiyun
316*4882a593SmuzhiyunBit 3:
317*4882a593Smuzhiyun  Beep if alarm							(RW)
318*4882a593Smuzhiyun
319*4882a593SmuzhiyunBit 7:
320*4882a593Smuzhiyun  Shutdown if alarm persist for more than 4 seconds		(RW)
321*4882a593Smuzhiyun
322*4882a593SmuzhiyunByte 1:
323*4882a593Smuzhiyun  min threshold (scale as bank 0x26)
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun
326*4882a593SmuzhiyunWarning for the adventurous
327*4882a593Smuzhiyun===========================
328*4882a593Smuzhiyun
329*4882a593SmuzhiyunA word of caution to those who want to experiment and see if they can figure
330*4882a593Smuzhiyunthe voltage / clock programming out, I tried reading and only reading banks
331*4882a593Smuzhiyun0-0x30 with the reading code used for the sensor banks (0x20-0x28) and this
332*4882a593Smuzhiyunresulted in a _permanent_ reprogramming of the voltages, luckily I had the
333*4882a593Smuzhiyunsensors part configured so that it would shutdown my system on any out of spec
334*4882a593Smuzhiyunvoltages which probably safed my computer (after a reboot I managed to
335*4882a593Smuzhiyunimmediately enter the bios and reload the defaults). This probably means that
336*4882a593Smuzhiyunthe read/write cycle for the non sensor part is different from the sensor part.
337