xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/lm85.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver lm85
2*4882a593Smuzhiyun==================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * National Semiconductor LM85 (B and C versions)
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun    Prefix: 'lm85b' or 'lm85c'
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheet: http://www.national.com/pf/LM/LM85.html
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun  * Texas Instruments LM96000
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun    Prefix: 'lm9600'
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun    Datasheet: https://www.ti.com/lit/ds/symlink/lm96000.pdf
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun  * Analog Devices ADM1027
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun    Prefix: 'adm1027'
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    Datasheet: https://www.onsemi.com/PowerSolutions/product.do?id=ADM1027
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun  * Analog Devices ADT7463
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun    Prefix: 'adt7463'
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun    Datasheet: https://www.onsemi.com/PowerSolutions/product.do?id=ADT7463
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun  * Analog Devices ADT7468
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun    Prefix: 'adt7468'
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun    Datasheet: https://www.onsemi.com/PowerSolutions/product.do?id=ADT7468
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun  * SMSC EMC6D100, SMSC EMC6D101
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun    Prefix: 'emc6d100'
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun    Datasheet: http://www.smsc.com/media/Downloads_Public/discontinued/6d100.pdf
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun  * SMSC EMC6D102
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun    Prefix: 'emc6d102'
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun    Datasheet: http://www.smsc.com/main/catalog/emc6d102.html
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun  * SMSC EMC6D103
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun    Prefix: 'emc6d103'
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun    Datasheet: http://www.smsc.com/main/catalog/emc6d103.html
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun  * SMSC EMC6D103S
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun    Prefix: 'emc6d103s'
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c, 0x2d, 0x2e
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun    Datasheet: http://www.smsc.com/main/catalog/emc6d103s.html
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunAuthors:
79*4882a593Smuzhiyun       - Philip Pokorny <ppokorny@penguincomputing.com>,
80*4882a593Smuzhiyun       - Frodo Looijaard <frodol@dds.nl>,
81*4882a593Smuzhiyun       - Richard Barrington <rich_b_nz@clear.net.nz>,
82*4882a593Smuzhiyun       - Margit Schubert-While <margitsw@t-online.de>,
83*4882a593Smuzhiyun       - Justin Thiessen <jthiessen@penguincomputing.com>
84*4882a593Smuzhiyun
85*4882a593SmuzhiyunDescription
86*4882a593Smuzhiyun-----------
87*4882a593Smuzhiyun
88*4882a593SmuzhiyunThis driver implements support for the National Semiconductor LM85 and
89*4882a593Smuzhiyuncompatible chips including the Analog Devices ADM1027, ADT7463, ADT7468 and
90*4882a593SmuzhiyunSMSC EMC6D10x chips family.
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunThe LM85 uses the 2-wire interface compatible with the SMBUS 2.0
93*4882a593Smuzhiyunspecification. Using an analog to digital converter it measures three (3)
94*4882a593Smuzhiyuntemperatures and five (5) voltages. It has four (4) 16-bit counters for
95*4882a593Smuzhiyunmeasuring fan speed. Five (5) digital inputs are provided for sampling the
96*4882a593SmuzhiyunVID signals from the processor to the VRM. Lastly, there are three (3) PWM
97*4882a593Smuzhiyunoutputs that can be used to control fan speed.
98*4882a593Smuzhiyun
99*4882a593SmuzhiyunThe voltage inputs have internal scaling resistors so that the following
100*4882a593Smuzhiyunvoltage can be measured without external resistors:
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun  2.5V, 3.3V, 5V, 12V, and CPU core voltage (2.25V)
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunThe temperatures measured are one internal diode, and two remote diodes.
105*4882a593SmuzhiyunRemote 1 is generally the CPU temperature. These inputs are designed to
106*4882a593Smuzhiyunmeasure a thermal diode like the one in a Pentium 4 processor in a socket
107*4882a593Smuzhiyun423 or socket 478 package. They can also measure temperature using a
108*4882a593Smuzhiyuntransistor like the 2N3904.
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunA sophisticated control system for the PWM outputs is designed into the
111*4882a593SmuzhiyunLM85 that allows fan speed to be adjusted automatically based on any of the
112*4882a593Smuzhiyunthree temperature sensors. Each PWM output is individually adjustable and
113*4882a593Smuzhiyunprogrammable. Once configured, the LM85 will adjust the PWM outputs in
114*4882a593Smuzhiyunresponse to the measured temperatures without further host intervention.
115*4882a593SmuzhiyunThis feature can also be disabled for manual control of the PWM's.
116*4882a593Smuzhiyun
117*4882a593SmuzhiyunEach of the measured inputs (voltage, temperature, fan speed) has
118*4882a593Smuzhiyuncorresponding high/low limit values. The LM85 will signal an ALARM if any
119*4882a593Smuzhiyunmeasured value exceeds either limit.
120*4882a593Smuzhiyun
121*4882a593SmuzhiyunThe LM85 samples all inputs continuously. The lm85 driver will not read
122*4882a593Smuzhiyunthe registers more often than once a second. Further, configuration data is
123*4882a593Smuzhiyunonly read once each 5 minutes. There is twice as much config data as
124*4882a593Smuzhiyunmeasurements, so this would seem to be a worthwhile optimization.
125*4882a593Smuzhiyun
126*4882a593SmuzhiyunSpecial Features
127*4882a593Smuzhiyun----------------
128*4882a593Smuzhiyun
129*4882a593SmuzhiyunThe LM85 has four fan speed monitoring modes. The ADM1027 has only two.
130*4882a593SmuzhiyunBoth have special circuitry to compensate for PWM interactions with the
131*4882a593SmuzhiyunTACH signal from the fans. The ADM1027 can be configured to measure the
132*4882a593Smuzhiyunspeed of a two wire fan, but the input conditioning circuitry is different
133*4882a593Smuzhiyunfor 3-wire and 2-wire mode. For this reason, the 2-wire fan modes are not
134*4882a593Smuzhiyunexposed to user control. The BIOS should initialize them to the correct
135*4882a593Smuzhiyunmode. If you've designed your own ADM1027, you'll have to modify the
136*4882a593Smuzhiyuninit_client function and add an insmod parameter to set this up.
137*4882a593Smuzhiyun
138*4882a593SmuzhiyunTo smooth the response of fans to changes in temperature, the LM85 has an
139*4882a593Smuzhiyunoptional filter for smoothing temperatures. The ADM1027 has the same
140*4882a593Smuzhiyunconfig option but uses it to rate limit the changes to fan speed instead.
141*4882a593Smuzhiyun
142*4882a593SmuzhiyunThe ADM1027, ADT7463 and ADT7468 have a 10-bit ADC and can therefore
143*4882a593Smuzhiyunmeasure temperatures with 0.25 degC resolution. They also provide an offset
144*4882a593Smuzhiyunto the temperature readings that is automatically applied during
145*4882a593Smuzhiyunmeasurement. This offset can be used to zero out any errors due to traces
146*4882a593Smuzhiyunand placement. The documentation says that the offset is in 0.25 degC
147*4882a593Smuzhiyunsteps, but in initial testing of the ADM1027 it was 1.00 degC steps. Analog
148*4882a593SmuzhiyunDevices has confirmed this "bug". The ADT7463 is reported to work as
149*4882a593Smuzhiyundescribed in the documentation. The current lm85 driver does not show the
150*4882a593Smuzhiyunoffset register.
151*4882a593Smuzhiyun
152*4882a593SmuzhiyunThe ADT7468 has a high-frequency PWM mode, where all PWM outputs are
153*4882a593Smuzhiyundriven by a 22.5 kHz clock. This is a global mode, not per-PWM output,
154*4882a593Smuzhiyunwhich means that setting any PWM frequency above 11.3 kHz will switch
155*4882a593Smuzhiyunall 3 PWM outputs to a 22.5 kHz frequency. Conversely, setting any PWM
156*4882a593Smuzhiyunfrequency below 11.3 kHz will switch all 3 PWM outputs to a frequency
157*4882a593Smuzhiyunbetween 10 and 100 Hz, which can then be tuned separately.
158*4882a593Smuzhiyun
159*4882a593SmuzhiyunSee the vendor datasheets for more information. There is application note
160*4882a593Smuzhiyunfrom National (AN-1260) with some additional information about the LM85.
161*4882a593SmuzhiyunThe Analog Devices datasheet is very detailed and describes a procedure for
162*4882a593Smuzhiyundetermining an optimal configuration for the automatic PWM control.
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunThe SMSC EMC6D100 & EMC6D101 monitor external voltages, temperatures, and
165*4882a593Smuzhiyunfan speeds. They use this monitoring capability to alert the system to out
166*4882a593Smuzhiyunof limit conditions and can automatically control the speeds of multiple
167*4882a593Smuzhiyunfans in a PC or embedded system. The EMC6D101, available in a 24-pin SSOP
168*4882a593Smuzhiyunpackage, and the EMC6D100, available in a 28-pin SSOP package, are designed
169*4882a593Smuzhiyunto be register compatible. The EMC6D100 offers all the features of the
170*4882a593SmuzhiyunEMC6D101 plus additional voltage monitoring and system control features.
171*4882a593SmuzhiyunUnfortunately it is not possible to distinguish between the package
172*4882a593Smuzhiyunversions on register level so these additional voltage inputs may read
173*4882a593Smuzhiyunzero. EMC6D102 and EMC6D103 feature additional ADC bits thus extending precision
174*4882a593Smuzhiyunof voltage and temperature channels.
175*4882a593Smuzhiyun
176*4882a593SmuzhiyunSMSC EMC6D103S is similar to EMC6D103, but does not support pwm#_auto_pwm_minctl
177*4882a593Smuzhiyunand temp#_auto_temp_off.
178*4882a593Smuzhiyun
179*4882a593SmuzhiyunThe LM96000 supports additional high frequency PWM modes (22.5 kHz, 24 kHz,
180*4882a593Smuzhiyun25.7 kHz, 27.7 kHz and 30 kHz), which can be configured on a per-PWM basis.
181*4882a593Smuzhiyun
182*4882a593SmuzhiyunHardware Configurations
183*4882a593Smuzhiyun-----------------------
184*4882a593Smuzhiyun
185*4882a593SmuzhiyunThe LM85 can be jumpered for 3 different SMBus addresses. There are
186*4882a593Smuzhiyunno other hardware configuration options for the LM85.
187*4882a593Smuzhiyun
188*4882a593SmuzhiyunThe lm85 driver detects both LM85B and LM85C revisions of the chip. See the
189*4882a593Smuzhiyundatasheet for a complete description of the differences. Other than
190*4882a593Smuzhiyunidentifying the chip, the driver behaves no differently with regard to
191*4882a593Smuzhiyunthese two chips. The LM85B is recommended for new designs.
192*4882a593Smuzhiyun
193*4882a593SmuzhiyunThe ADM1027, ADT7463 and ADT7468 chips have an optional SMBALERT output
194*4882a593Smuzhiyunthat can be used to signal the chipset in case a limit is exceeded or the
195*4882a593Smuzhiyuntemperature sensors fail. Individual sensor interrupts can be masked so
196*4882a593Smuzhiyunthey won't trigger SMBALERT. The SMBALERT output if configured replaces one
197*4882a593Smuzhiyunof the other functions (PWM2 or IN0). This functionality is not implemented
198*4882a593Smuzhiyunin current driver.
199*4882a593Smuzhiyun
200*4882a593SmuzhiyunThe ADT7463 and ADT7468 also have an optional THERM output/input which can
201*4882a593Smuzhiyunbe connected to the processor PROC_HOT output. If available, the autofan
202*4882a593Smuzhiyuncontrol dynamic Tmin feature can be enabled to keep the system temperature
203*4882a593Smuzhiyunwithin spec (just?!) with the least possible fan noise.
204*4882a593Smuzhiyun
205*4882a593SmuzhiyunConfiguration Notes
206*4882a593Smuzhiyun-------------------
207*4882a593Smuzhiyun
208*4882a593SmuzhiyunBesides standard interfaces driver adds following:
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun* Temperatures and Zones
211*4882a593Smuzhiyun
212*4882a593SmuzhiyunEach temperature sensor is associated with a Zone. There are three
213*4882a593Smuzhiyunsensors and therefore three zones (# 1, 2 and 3). Each zone has the following
214*4882a593Smuzhiyuntemperature configuration points:
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun* temp#_auto_temp_off
217*4882a593Smuzhiyun	- temperature below which fans should be off or spinning very low.
218*4882a593Smuzhiyun* temp#_auto_temp_min
219*4882a593Smuzhiyun	- temperature over which fans start to spin.
220*4882a593Smuzhiyun* temp#_auto_temp_max
221*4882a593Smuzhiyun	- temperature when fans spin at full speed.
222*4882a593Smuzhiyun* temp#_auto_temp_crit
223*4882a593Smuzhiyun	- temperature when all fans will run full speed.
224*4882a593Smuzhiyun
225*4882a593SmuzhiyunPWM Control
226*4882a593Smuzhiyun^^^^^^^^^^^
227*4882a593Smuzhiyun
228*4882a593SmuzhiyunThere are three PWM outputs. The LM85 datasheet suggests that the
229*4882a593Smuzhiyunpwm3 output control both fan3 and fan4. Each PWM can be individually
230*4882a593Smuzhiyunconfigured and assigned to a zone for its control value. Each PWM can be
231*4882a593Smuzhiyunconfigured individually according to the following options.
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun* pwm#_auto_pwm_min
234*4882a593Smuzhiyun	- this specifies the PWM value for temp#_auto_temp_off
235*4882a593Smuzhiyun	  temperature. (PWM value from 0 to 255)
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun* pwm#_auto_pwm_minctl
238*4882a593Smuzhiyun	- this flags selects for temp#_auto_temp_off temperature
239*4882a593Smuzhiyun	  the behaviour of fans. Write 1 to let fans spinning at
240*4882a593Smuzhiyun	  pwm#_auto_pwm_min or write 0 to let them off.
241*4882a593Smuzhiyun
242*4882a593Smuzhiyun.. note::
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun	It has been reported that there is a bug in the LM85 that causes
245*4882a593Smuzhiyun	the flag to be associated with the zones not the PWMs. This
246*4882a593Smuzhiyun	contradicts all the published documentation. Setting pwm#_min_ctl
247*4882a593Smuzhiyun	in this case actually affects all PWMs controlled by zone '#'.
248*4882a593Smuzhiyun
249*4882a593SmuzhiyunPWM Controlling Zone selection
250*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
251*4882a593Smuzhiyun
252*4882a593Smuzhiyun* pwm#_auto_channels
253*4882a593Smuzhiyun	- controls zone that is associated with PWM
254*4882a593Smuzhiyun
255*4882a593SmuzhiyunConfiguration choices:
256*4882a593Smuzhiyun
257*4882a593Smuzhiyun========== =============================================
258*4882a593SmuzhiyunValue      Meaning
259*4882a593Smuzhiyun========== =============================================
260*4882a593Smuzhiyun      1    Controlled by Zone 1
261*4882a593Smuzhiyun      2    Controlled by Zone 2
262*4882a593Smuzhiyun      3    Controlled by Zone 3
263*4882a593Smuzhiyun     23    Controlled by higher temp of Zone 2 or 3
264*4882a593Smuzhiyun    123    Controlled by highest temp of Zone 1, 2 or 3
265*4882a593Smuzhiyun      0    PWM always 0%  (off)
266*4882a593Smuzhiyun     -1    PWM always 100%  (full on)
267*4882a593Smuzhiyun     -2    Manual control (write to 'pwm#' to set)
268*4882a593Smuzhiyun========== =============================================
269*4882a593Smuzhiyun
270*4882a593SmuzhiyunThe National LM85's have two vendor specific configuration
271*4882a593Smuzhiyunfeatures. Tach. mode and Spinup Control. For more details on these,
272*4882a593Smuzhiyunsee the LM85 datasheet or Application Note AN-1260. These features
273*4882a593Smuzhiyunare not currently supported by the lm85 driver.
274*4882a593Smuzhiyun
275*4882a593SmuzhiyunThe Analog Devices ADM1027 has several vendor specific enhancements.
276*4882a593SmuzhiyunThe number of pulses-per-rev of the fans can be set, Tach monitoring
277*4882a593Smuzhiyuncan be optimized for PWM operation, and an offset can be applied to
278*4882a593Smuzhiyunthe temperatures to compensate for systemic errors in the
279*4882a593Smuzhiyunmeasurements. These features are not currently supported by the lm85
280*4882a593Smuzhiyundriver.
281*4882a593Smuzhiyun
282*4882a593SmuzhiyunIn addition to the ADM1027 features, the ADT7463 and ADT7468 also have
283*4882a593SmuzhiyunTmin control and THERM asserted counts. Automatic Tmin control acts to
284*4882a593Smuzhiyunadjust the Tmin value to maintain the measured temperature sensor at a
285*4882a593Smuzhiyunspecified temperature. There isn't much documentation on this feature in
286*4882a593Smuzhiyunthe ADT7463 data sheet. This is not supported by current driver.
287