xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/adm9240.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver adm9240
2*4882a593Smuzhiyun=====================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * Analog Devices ADM9240
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun    Prefix: 'adm9240'
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c - 0x2f
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheet: Publicly available at the Analog Devices website
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun	http://www.analog.com/UploadedFiles/Data_Sheets/79857778ADM9240_0.pdf
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun  * Dallas Semiconductor DS1780
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun    Prefix: 'ds1780'
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c - 0x2f
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun    Datasheet: Publicly available at the Dallas Semiconductor (Maxim) website
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun	http://pdfserv.maxim-ic.com/en/ds/DS1780.pdf
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun  * National Semiconductor LM81
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    Prefix: 'lm81'
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c - 0x2f
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun    Datasheet: Publicly available at the National Semiconductor website
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun	http://www.national.com/ds.cgi/LM/LM81.pdf
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunAuthors:
37*4882a593Smuzhiyun    - Frodo Looijaard <frodol@dds.nl>,
38*4882a593Smuzhiyun    - Philip Edelbrock <phil@netroedge.com>,
39*4882a593Smuzhiyun    - Michiel Rook <michiel@grendelproject.nl>,
40*4882a593Smuzhiyun    - Grant Coady <gcoady.lk@gmail.com> with guidance
41*4882a593Smuzhiyun      from Jean Delvare <jdelvare@suse.de>
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunInterface
44*4882a593Smuzhiyun---------
45*4882a593SmuzhiyunThe I2C addresses listed above assume BIOS has not changed the
46*4882a593Smuzhiyunchip MSB 5-bit address. Each chip reports a unique manufacturer
47*4882a593Smuzhiyunidentification code as well as the chip revision/stepping level.
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunDescription
50*4882a593Smuzhiyun-----------
51*4882a593Smuzhiyun[From ADM9240] The ADM9240 is a complete system hardware monitor for
52*4882a593Smuzhiyunmicroprocessor-based systems, providing measurement and limit comparison
53*4882a593Smuzhiyunof up to four power supplies and two processor core voltages, plus
54*4882a593Smuzhiyuntemperature, two fan speeds and chassis intrusion. Measured values can
55*4882a593Smuzhiyunbe read out via an I2C-compatible serial System Management Bus, and values
56*4882a593Smuzhiyunfor limit comparisons can be programmed in over the same serial bus. The
57*4882a593Smuzhiyunhigh speed successive approximation ADC allows frequent sampling of all
58*4882a593Smuzhiyunanalog channels to ensure a fast interrupt response to any out-of-limit
59*4882a593Smuzhiyunmeasurement.
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunThe ADM9240, DS1780 and LM81 are register compatible, the following
62*4882a593Smuzhiyundetails are common to the three chips. Chip differences are described
63*4882a593Smuzhiyunafter this section.
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunMeasurements
67*4882a593Smuzhiyun------------
68*4882a593SmuzhiyunThe measurement cycle
69*4882a593Smuzhiyun
70*4882a593SmuzhiyunThe adm9240 driver will take a measurement reading no faster than once
71*4882a593Smuzhiyuneach two seconds. User-space may read sysfs interface faster than the
72*4882a593Smuzhiyunmeasurement update rate and will receive cached data from the most
73*4882a593Smuzhiyunrecent measurement.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunADM9240 has a very fast 320us temperature and voltage measurement cycle
76*4882a593Smuzhiyunwith independent fan speed measurement cycles counting alternating rising
77*4882a593Smuzhiyunedges of the fan tacho inputs.
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunDS1780 measurement cycle is about once per second including fan speed.
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunLM81 measurement cycle is about once per 400ms including fan speed.
82*4882a593SmuzhiyunThe LM81 12-bit extended temperature measurement mode is not supported.
83*4882a593Smuzhiyun
84*4882a593SmuzhiyunTemperature
85*4882a593Smuzhiyun-----------
86*4882a593SmuzhiyunOn chip temperature is reported as degrees Celsius as 9-bit signed data
87*4882a593Smuzhiyunwith resolution of 0.5 degrees Celsius. High and low temperature limits
88*4882a593Smuzhiyunare 8-bit signed data with resolution of one degree Celsius.
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunTemperature alarm is asserted once the temperature exceeds the high limit,
91*4882a593Smuzhiyunand is cleared when the temperature falls below the temp1_max_hyst value.
92*4882a593Smuzhiyun
93*4882a593SmuzhiyunFan Speed
94*4882a593Smuzhiyun---------
95*4882a593SmuzhiyunTwo fan tacho inputs are provided, the ADM9240 gates an internal 22.5kHz
96*4882a593Smuzhiyunclock via a divider to an 8-bit counter. Fan speed (rpm) is calculated by:
97*4882a593Smuzhiyun
98*4882a593Smuzhiyunrpm = (22500 * 60) / (count * divider)
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunAutomatic fan clock divider
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun  * User sets 0 to fan_min limit
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun    - low speed alarm is disabled
105*4882a593Smuzhiyun    - fan clock divider not changed
106*4882a593Smuzhiyun    - auto fan clock adjuster enabled for valid fan speed reading
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun  * User sets fan_min limit too low
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun    - low speed alarm is enabled
111*4882a593Smuzhiyun    - fan clock divider set to max
112*4882a593Smuzhiyun    - fan_min set to register value 254 which corresponds
113*4882a593Smuzhiyun      to 664 rpm on adm9240
114*4882a593Smuzhiyun    - low speed alarm will be asserted if fan speed is
115*4882a593Smuzhiyun      less than minimum measurable speed
116*4882a593Smuzhiyun    - auto fan clock adjuster disabled
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun  * User sets reasonable fan speed
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun    - low speed alarm is enabled
121*4882a593Smuzhiyun    - fan clock divider set to suit fan_min
122*4882a593Smuzhiyun    - auto fan clock adjuster enabled: adjusts fan_min
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun  * User sets unreasonably high low fan speed limit
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun    - resolution of the low speed limit may be reduced
127*4882a593Smuzhiyun    - alarm will be asserted
128*4882a593Smuzhiyun    - auto fan clock adjuster enabled: adjusts fan_min
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun  * fan speed may be displayed as zero until the auto fan clock divider
131*4882a593Smuzhiyun    adjuster brings fan speed clock divider back into chip measurement
132*4882a593Smuzhiyun    range, this will occur within a few measurement cycles.
133*4882a593Smuzhiyun
134*4882a593SmuzhiyunAnalog Output
135*4882a593Smuzhiyun-------------
136*4882a593SmuzhiyunAn analog output provides a 0 to 1.25 volt signal intended for an external
137*4882a593Smuzhiyunfan speed amplifier circuit. The analog output is set to maximum value on
138*4882a593Smuzhiyunpower up or reset. This doesn't do much on the test Intel SE440BX-2.
139*4882a593Smuzhiyun
140*4882a593SmuzhiyunVoltage Monitor
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun^^^^^^^^^^^^^^^
143*4882a593Smuzhiyun
144*4882a593SmuzhiyunVoltage (IN) measurement is internally scaled:
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun    === =========== =========== ========= ==========
147*4882a593Smuzhiyun    nr  label       nominal     maximum   resolution
148*4882a593Smuzhiyun		      mV          mV         mV
149*4882a593Smuzhiyun    === =========== =========== ========= ==========
150*4882a593Smuzhiyun    0   +2.5V        2500        3320       13.0
151*4882a593Smuzhiyun    1   Vccp1        2700        3600       14.1
152*4882a593Smuzhiyun    2   +3.3V        3300        4380       17.2
153*4882a593Smuzhiyun    3     +5V        5000        6640       26.0
154*4882a593Smuzhiyun    4    +12V       12000       15940       62.5
155*4882a593Smuzhiyun    5   Vccp2        2700        3600       14.1
156*4882a593Smuzhiyun    === =========== =========== ========= ==========
157*4882a593Smuzhiyun
158*4882a593SmuzhiyunThe reading is an unsigned 8-bit value, nominal voltage measurement is
159*4882a593Smuzhiyunrepresented by a reading of 192, being 3/4 of the measurement range.
160*4882a593Smuzhiyun
161*4882a593SmuzhiyunAn alarm is asserted for any voltage going below or above the set limits.
162*4882a593Smuzhiyun
163*4882a593SmuzhiyunThe driver reports and accepts voltage limits scaled to the above table.
164*4882a593Smuzhiyun
165*4882a593SmuzhiyunVID Monitor
166*4882a593Smuzhiyun-----------
167*4882a593SmuzhiyunThe chip has five inputs to read the 5-bit VID and reports the mV value
168*4882a593Smuzhiyunbased on detected CPU type.
169*4882a593Smuzhiyun
170*4882a593SmuzhiyunChassis Intrusion
171*4882a593Smuzhiyun-----------------
172*4882a593SmuzhiyunAn alarm is asserted when the CI pin goes active high. The ADM9240
173*4882a593SmuzhiyunDatasheet has an example of an external temperature sensor driving
174*4882a593Smuzhiyunthis pin. On an Intel SE440BX-2 the Chassis Intrusion header is
175*4882a593Smuzhiyunconnected to a normally open switch.
176*4882a593Smuzhiyun
177*4882a593SmuzhiyunThe ADM9240 provides an internal open drain on this line, and may output
178*4882a593Smuzhiyuna 20 ms active low pulse to reset an external Chassis Intrusion latch.
179*4882a593Smuzhiyun
180*4882a593SmuzhiyunClear the CI latch by writing value 0 to the sysfs intrusion0_alarm file.
181*4882a593Smuzhiyun
182*4882a593SmuzhiyunAlarm flags reported as 16-bit word
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun    ===     =============       ==========================
185*4882a593Smuzhiyun    bit     label               comment
186*4882a593Smuzhiyun    ===     =============       ==========================
187*4882a593Smuzhiyun     0      +2.5 V_Error        high or low limit exceeded
188*4882a593Smuzhiyun     1      VCCP_Error          high or low limit exceeded
189*4882a593Smuzhiyun     2      +3.3 V_Error        high or low limit exceeded
190*4882a593Smuzhiyun     3      +5 V_Error          high or low limit exceeded
191*4882a593Smuzhiyun     4      Temp_Error          temperature error
192*4882a593Smuzhiyun     6      FAN1_Error          fan low limit exceeded
193*4882a593Smuzhiyun     7      FAN2_Error          fan low limit exceeded
194*4882a593Smuzhiyun     8      +12 V_Error         high or low limit exceeded
195*4882a593Smuzhiyun     9      VCCP2_Error         high or low limit exceeded
196*4882a593Smuzhiyun    12      Chassis_Error       CI pin went high
197*4882a593Smuzhiyun    ===     =============       ==========================
198*4882a593Smuzhiyun
199*4882a593SmuzhiyunRemaining bits are reserved and thus undefined. It is important to note
200*4882a593Smuzhiyunthat alarm bits may be cleared on read, user-space may latch alarms and
201*4882a593Smuzhiyunprovide the end-user with a method to clear alarm memory.
202