xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/lm93.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver lm93
2*4882a593Smuzhiyun==================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * National Semiconductor LM93
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun    Prefix 'lm93'
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c-0x2e
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheet: http://www.national.com/ds.cgi/LM/LM93.pdf
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun  * National Semiconductor LM94
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun    Prefix 'lm94'
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c-0x2e
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun    Datasheet: http://www.national.com/ds.cgi/LM/LM94.pdf
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunAuthors:
24*4882a593Smuzhiyun	- Mark M. Hoffman <mhoffman@lightlink.com>
25*4882a593Smuzhiyun	- Ported to 2.6 by Eric J. Bowersox <ericb@aspsys.com>
26*4882a593Smuzhiyun	- Adapted to 2.6.20 by Carsten Emde <ce@osadl.org>
27*4882a593Smuzhiyun	- Modified for mainline integration by Hans J. Koch <hjk@hansjkoch.de>
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunModule Parameters
30*4882a593Smuzhiyun-----------------
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun* init: integer
33*4882a593Smuzhiyun  Set to non-zero to force some initializations (default is 0).
34*4882a593Smuzhiyun* disable_block: integer
35*4882a593Smuzhiyun  A "0" allows SMBus block data transactions if the host supports them.  A "1"
36*4882a593Smuzhiyun  disables SMBus block data transactions.  The default is 0.
37*4882a593Smuzhiyun* vccp_limit_type: integer array (2)
38*4882a593Smuzhiyun  Configures in7 and in8 limit type, where 0 means absolute and non-zero
39*4882a593Smuzhiyun  means relative.  "Relative" here refers to "Dynamic Vccp Monitoring using
40*4882a593Smuzhiyun  VID" from the datasheet.  It greatly simplifies the interface to allow
41*4882a593Smuzhiyun  only one set of limits (absolute or relative) to be in operation at a
42*4882a593Smuzhiyun  time (even though the hardware is capable of enabling both).  There's
43*4882a593Smuzhiyun  not a compelling use case for enabling both at once, anyway.  The default
44*4882a593Smuzhiyun  is "0,0".
45*4882a593Smuzhiyun* vid_agtl: integer
46*4882a593Smuzhiyun  A "0" configures the VID pins for V(ih) = 2.1V min, V(il) = 0.8V max.
47*4882a593Smuzhiyun  A "1" configures the VID pins for V(ih) = 0.8V min, V(il) = 0.4V max.
48*4882a593Smuzhiyun  (The latter setting is referred to as AGTL+ Compatible in the datasheet.)
49*4882a593Smuzhiyun  I.e. this parameter controls the VID pin input thresholds; if your VID
50*4882a593Smuzhiyun  inputs are not working, try changing this.  The default value is "0".
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunHardware Description
54*4882a593Smuzhiyun--------------------
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun(from the datasheet)
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunThe LM93 hardware monitor has a two wire digital interface compatible with
59*4882a593SmuzhiyunSMBus 2.0. Using an 8-bit ADC, the LM93 measures the temperature of two remote
60*4882a593Smuzhiyundiode connected transistors as well as its own die and 16 power supply
61*4882a593Smuzhiyunvoltages. To set fan speed, the LM93 has two PWM outputs that are each
62*4882a593Smuzhiyuncontrolled by up to four temperature zones. The fancontrol algorithm is lookup
63*4882a593Smuzhiyuntable based. The LM93 includes a digital filter that can be invoked to smooth
64*4882a593Smuzhiyuntemperature readings for better control of fan speed. The LM93 has four
65*4882a593Smuzhiyuntachometer inputs to measure fan speed. Limit and status registers for all
66*4882a593Smuzhiyunmeasured values are included. The LM93 builds upon the functionality of
67*4882a593Smuzhiyunprevious motherboard management ASICs and uses some of the LM85's features
68*4882a593Smuzhiyun(i.e. smart tachometer mode). It also adds measurement and control support
69*4882a593Smuzhiyunfor dynamic Vccp monitoring and PROCHOT. It is designed to monitor a dual
70*4882a593Smuzhiyunprocessor Xeon class motherboard with a minimum of external components.
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunLM94 is also supported in LM93 compatible mode. Extra sensors and features of
73*4882a593SmuzhiyunLM94 are not supported.
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun
76*4882a593SmuzhiyunUser Interface
77*4882a593Smuzhiyun--------------
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun#PROCHOT
80*4882a593Smuzhiyun^^^^^^^^
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunThe LM93 can monitor two #PROCHOT signals.  The results are found in the
83*4882a593Smuzhiyunsysfs files prochot1, prochot2, prochot1_avg, prochot2_avg, prochot1_max,
84*4882a593Smuzhiyunand prochot2_max.  prochot1_max and prochot2_max contain the user limits
85*4882a593Smuzhiyunfor #PROCHOT1 and #PROCHOT2, respectively.  prochot1 and prochot2 contain
86*4882a593Smuzhiyunthe current readings for the most recent complete time interval.  The
87*4882a593Smuzhiyunvalue of prochot1_avg and prochot2_avg is something like a 2 period
88*4882a593Smuzhiyunexponential moving average (but not quite - check the datasheet). Note
89*4882a593Smuzhiyunthat this third value is calculated by the chip itself.  All values range
90*4882a593Smuzhiyunfrom 0-255 where 0 indicates no throttling, and 255 indicates > 99.6%.
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunThe monitoring intervals for the two #PROCHOT signals is also configurable.
93*4882a593SmuzhiyunThese intervals can be found in the sysfs files prochot1_interval and
94*4882a593Smuzhiyunprochot2_interval.  The values in these files specify the intervals for
95*4882a593Smuzhiyun#P1_PROCHOT and #P2_PROCHOT, respectively.  Selecting a value not in this
96*4882a593Smuzhiyunlist will cause the driver to use the next largest interval.  The available
97*4882a593Smuzhiyunintervals are (in seconds):
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun#PROCHOT intervals:
100*4882a593Smuzhiyun	0.73, 1.46, 2.9, 5.8, 11.7, 23.3, 46.6, 93.2, 186, 372
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunIt is possible to configure the LM93 to logically short the two #PROCHOT
103*4882a593Smuzhiyunsignals.  I.e. when #P1_PROCHOT is asserted, the LM93 will automatically
104*4882a593Smuzhiyunassert #P2_PROCHOT, and vice-versa.  This mode is enabled by writing a
105*4882a593Smuzhiyunnon-zero integer to the sysfs file prochot_short.
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunThe LM93 can also override the #PROCHOT pins by driving a PWM signal onto
108*4882a593Smuzhiyunone or both of them.  When overridden, the signal has a period of 3.56 ms,
109*4882a593Smuzhiyuna minimum pulse width of 5 clocks (at 22.5kHz => 6.25% duty cycle), and
110*4882a593Smuzhiyuna maximum pulse width of 80 clocks (at 22.5kHz => 99.88% duty cycle).
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunThe sysfs files prochot1_override and prochot2_override contain boolean
113*4882a593Smuzhiyunintegers which enable or disable the override function for #P1_PROCHOT and
114*4882a593Smuzhiyun#P2_PROCHOT, respectively.  The sysfs file prochot_override_duty_cycle
115*4882a593Smuzhiyuncontains a value controlling the duty cycle for the PWM signal used when
116*4882a593Smuzhiyunthe override function is enabled.  This value ranges from 0 to 15, with 0
117*4882a593Smuzhiyunindicating minimum duty cycle and 15 indicating maximum.
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun#VRD_HOT
120*4882a593Smuzhiyun^^^^^^^^
121*4882a593Smuzhiyun
122*4882a593SmuzhiyunThe LM93 can monitor two #VRD_HOT signals. The results are found in the
123*4882a593Smuzhiyunsysfs files vrdhot1 and vrdhot2. There is one value per file: a boolean for
124*4882a593Smuzhiyunwhich 1 indicates #VRD_HOT is asserted and 0 indicates it is negated. These
125*4882a593Smuzhiyunfiles are read-only.
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunSmart Tach Mode (from the datasheet)::
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun	If a fan is driven using a low-side drive PWM, the tachometer
130*4882a593Smuzhiyun	output of the fan is corrupted. The LM93 includes smart tachometer
131*4882a593Smuzhiyun	circuitry that allows an accurate tachometer reading to be
132*4882a593Smuzhiyun	achieved despite the signal corruption.  In smart tach mode all
133*4882a593Smuzhiyun	four signals are measured within 4 seconds.
134*4882a593Smuzhiyun
135*4882a593SmuzhiyunSmart tach mode is enabled by the driver by writing 1 or 2 (associating the
136*4882a593Smuzhiyunfan tachometer with a pwm) to the sysfs file fan<n>_smart_tach.  A zero
137*4882a593Smuzhiyunwill disable the function for that fan.  Note that Smart tach mode cannot be
138*4882a593Smuzhiyunenabled if the PWM output frequency is 22500 Hz (see below).
139*4882a593Smuzhiyun
140*4882a593SmuzhiyunManual PWM
141*4882a593Smuzhiyun^^^^^^^^^^
142*4882a593Smuzhiyun
143*4882a593SmuzhiyunThe LM93 has a fixed or override mode for the two PWM outputs (although, there
144*4882a593Smuzhiyunare still some conditions that will override even this mode - see section
145*4882a593Smuzhiyun15.10.6 of the datasheet for details.)  The sysfs files pwm1_override
146*4882a593Smuzhiyunand pwm2_override are used to enable this mode; each is a boolean integer
147*4882a593Smuzhiyunwhere 0 disables and 1 enables the manual control mode.  The sysfs files pwm1
148*4882a593Smuzhiyunand pwm2 are used to set the manual duty cycle; each is an integer (0-255)
149*4882a593Smuzhiyunwhere 0 is 0% duty cycle, and 255 is 100%.  Note that the duty cycle values
150*4882a593Smuzhiyunare constrained by the hardware. Selecting a value which is not available
151*4882a593Smuzhiyunwill cause the driver to use the next largest value.  Also note: when manual
152*4882a593SmuzhiyunPWM mode is disabled, the value of pwm1 and pwm2 indicates the current duty
153*4882a593Smuzhiyuncycle chosen by the h/w.
154*4882a593Smuzhiyun
155*4882a593SmuzhiyunPWM Output Frequency
156*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^
157*4882a593Smuzhiyun
158*4882a593SmuzhiyunThe LM93 supports several different frequencies for the PWM output channels.
159*4882a593SmuzhiyunThe sysfs files pwm1_freq and pwm2_freq are used to select the frequency. The
160*4882a593Smuzhiyunfrequency values are constrained by the hardware.  Selecting a value which is
161*4882a593Smuzhiyunnot available will cause the driver to use the next largest value.  Also note
162*4882a593Smuzhiyunthat this parameter has implications for the Smart Tach Mode (see above).
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunPWM Output Frequencies (in Hz):
165*4882a593Smuzhiyun	12, 36, 48, 60, 72, 84, 96, 22500 (default)
166*4882a593Smuzhiyun
167*4882a593SmuzhiyunAutomatic PWM
168*4882a593Smuzhiyun^^^^^^^^^^^^^
169*4882a593Smuzhiyun
170*4882a593SmuzhiyunThe LM93 is capable of complex automatic fan control, with many different
171*4882a593Smuzhiyunpoints of configuration.  To start, each PWM output can be bound to any
172*4882a593Smuzhiyuncombination of eight control sources.  The final PWM is the largest of all
173*4882a593Smuzhiyunindividual control sources to which the PWM output is bound.
174*4882a593Smuzhiyun
175*4882a593SmuzhiyunThe eight control sources are: temp1-temp4 (aka "zones" in the datasheet),
176*4882a593Smuzhiyun#PROCHOT 1 & 2, and #VRDHOT 1 & 2.  The bindings are expressed as a bitmask
177*4882a593Smuzhiyunin the sysfs files pwm<n>_auto_channels, where a "1" enables the binding, and
178*4882a593Smuzhiyuna "0" disables it. The h/w default is 0x0f (all temperatures bound).
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun	====== ===========
181*4882a593Smuzhiyun	0x01   Temp 1
182*4882a593Smuzhiyun	0x02   Temp 2
183*4882a593Smuzhiyun	0x04   Temp 3
184*4882a593Smuzhiyun	0x08   Temp 4
185*4882a593Smuzhiyun	0x10   #PROCHOT 1
186*4882a593Smuzhiyun	0x20   #PROCHOT 2
187*4882a593Smuzhiyun	0x40   #VRDHOT 1
188*4882a593Smuzhiyun	0x80   #VRDHOT 2
189*4882a593Smuzhiyun	====== ===========
190*4882a593Smuzhiyun
191*4882a593SmuzhiyunThe function y = f(x) takes a source temperature x to a PWM output y.  This
192*4882a593Smuzhiyunfunction of the LM93 is derived from a base temperature and a table of 12
193*4882a593Smuzhiyuntemperature offsets.  The base temperature is expressed in degrees C in the
194*4882a593Smuzhiyunsysfs files temp<n>_auto_base.  The offsets are expressed in cumulative
195*4882a593Smuzhiyundegrees C, with the value of offset <i> for temperature value <n> being
196*4882a593Smuzhiyuncontained in the file temp<n>_auto_offset<i>.  E.g. if the base temperature
197*4882a593Smuzhiyunis 40C:
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun     ========== ======================= =============== =======
200*4882a593Smuzhiyun     offset #	temp<n>_auto_offset<i>	range		pwm
201*4882a593Smuzhiyun     ========== ======================= =============== =======
202*4882a593Smuzhiyun	 1		0		-		 25.00%
203*4882a593Smuzhiyun	 2		0		-		 28.57%
204*4882a593Smuzhiyun	 3		1		40C - 41C	 32.14%
205*4882a593Smuzhiyun	 4		1		41C - 42C	 35.71%
206*4882a593Smuzhiyun	 5		2		42C - 44C	 39.29%
207*4882a593Smuzhiyun	 6		2		44C - 46C	 42.86%
208*4882a593Smuzhiyun	 7		2		48C - 50C	 46.43%
209*4882a593Smuzhiyun	 8		2		50C - 52C	 50.00%
210*4882a593Smuzhiyun	 9		2		52C - 54C	 53.57%
211*4882a593Smuzhiyun	10		2		54C - 56C	 57.14%
212*4882a593Smuzhiyun	11		2		56C - 58C	 71.43%
213*4882a593Smuzhiyun	12		2		58C - 60C	 85.71%
214*4882a593Smuzhiyun	-		-		> 60C		100.00%
215*4882a593Smuzhiyun     ========== ======================= =============== =======
216*4882a593Smuzhiyun
217*4882a593SmuzhiyunValid offsets are in the range 0C <= x <= 7.5C in 0.5C increments.
218*4882a593Smuzhiyun
219*4882a593SmuzhiyunThere is an independent base temperature for each temperature channel. Note,
220*4882a593Smuzhiyunhowever, there are only two tables of offsets: one each for temp[12] and
221*4882a593Smuzhiyuntemp[34].  Therefore, any change to e.g. temp1_auto_offset<i> will also
222*4882a593Smuzhiyunaffect temp2_auto_offset<i>.
223*4882a593Smuzhiyun
224*4882a593SmuzhiyunThe LM93 can also apply hysteresis to the offset table, to prevent unwanted
225*4882a593Smuzhiyunoscillation between two steps in the offsets table.  These values are found in
226*4882a593Smuzhiyunthe sysfs files temp<n>_auto_offset_hyst.  The value in this file has the
227*4882a593Smuzhiyunsame representation as in temp<n>_auto_offset<i>.
228*4882a593Smuzhiyun
229*4882a593SmuzhiyunIf a temperature reading falls below the base value for that channel, the LM93
230*4882a593Smuzhiyunwill use the minimum PWM value.  These values are found in the sysfs files
231*4882a593Smuzhiyuntemp<n>_auto_pwm_min.  Note, there are only two minimums: one each for temp[12]
232*4882a593Smuzhiyunand temp[34].  Therefore, any change to e.g. temp1_auto_pwm_min will also
233*4882a593Smuzhiyunaffect temp2_auto_pwm_min.
234*4882a593Smuzhiyun
235*4882a593SmuzhiyunPWM Spin-Up Cycle
236*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^
237*4882a593Smuzhiyun
238*4882a593SmuzhiyunA spin-up cycle occurs when a PWM output is commanded from 0% duty cycle to
239*4882a593Smuzhiyunsome value > 0%.  The LM93 supports a minimum duty cycle during spin-up.  These
240*4882a593Smuzhiyunvalues are found in the sysfs files pwm<n>_auto_spinup_min. The value in this
241*4882a593Smuzhiyunfile has the same representation as other PWM duty cycle values. The
242*4882a593Smuzhiyunduration of the spin-up cycle is also configurable.  These values are found in
243*4882a593Smuzhiyunthe sysfs files pwm<n>_auto_spinup_time. The value in this file is
244*4882a593Smuzhiyunthe spin-up time in seconds.  The available spin-up times are constrained by
245*4882a593Smuzhiyunthe hardware.  Selecting a value which is not available will cause the driver
246*4882a593Smuzhiyunto use the next largest value.
247*4882a593Smuzhiyun
248*4882a593SmuzhiyunSpin-up Durations:
249*4882a593Smuzhiyun	0 (disabled, h/w default), 0.1, 0.25, 0.4, 0.7, 1.0, 2.0, 4.0
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun#PROCHOT and #VRDHOT PWM Ramping
252*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
253*4882a593Smuzhiyun
254*4882a593SmuzhiyunIf the #PROCHOT or #VRDHOT signals are asserted while bound to a PWM output
255*4882a593Smuzhiyunchannel, the LM93 will ramp the PWM output up to 100% duty cycle in discrete
256*4882a593Smuzhiyunsteps. The duration of each step is configurable. There are two files, with
257*4882a593Smuzhiyunone value each in seconds: pwm_auto_prochot_ramp and pwm_auto_vrdhot_ramp.
258*4882a593SmuzhiyunThe available ramp times are constrained by the hardware.  Selecting a value
259*4882a593Smuzhiyunwhich is not available will cause the driver to use the next largest value.
260*4882a593Smuzhiyun
261*4882a593SmuzhiyunRamp Times:
262*4882a593Smuzhiyun	0 (disabled, h/w default) to 0.75 in 0.05 second intervals
263*4882a593Smuzhiyun
264*4882a593SmuzhiyunFan Boost
265*4882a593Smuzhiyun^^^^^^^^^
266*4882a593Smuzhiyun
267*4882a593SmuzhiyunFor each temperature channel, there is a boost temperature: if the channel
268*4882a593Smuzhiyunexceeds this limit, the LM93 will immediately drive both PWM outputs to 100%.
269*4882a593SmuzhiyunThis limit is expressed in degrees C in the sysfs files temp<n>_auto_boost.
270*4882a593SmuzhiyunThere is also a hysteresis temperature for this function: after the boost
271*4882a593Smuzhiyunlimit is reached, the temperature channel must drop below this value before
272*4882a593Smuzhiyunthe boost function is disabled.  This temperature is also expressed in degrees
273*4882a593SmuzhiyunC in the sysfs files temp<n>_auto_boost_hyst.
274*4882a593Smuzhiyun
275*4882a593SmuzhiyunGPIO Pins
276*4882a593Smuzhiyun^^^^^^^^^
277*4882a593Smuzhiyun
278*4882a593SmuzhiyunThe LM93 can monitor the logic level of four dedicated GPIO pins as well as the
279*4882a593Smuzhiyunfour tach input pins.  GPIO0-GPIO3 correspond to (fan) tach 1-4, respectively.
280*4882a593SmuzhiyunAll eight GPIOs are read by reading the bitmask in the sysfs file gpio.  The
281*4882a593SmuzhiyunLSB is GPIO0, and the MSB is GPIO7.
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun
284*4882a593SmuzhiyunLM93 Unique sysfs Files
285*4882a593Smuzhiyun-----------------------
286*4882a593Smuzhiyun
287*4882a593Smuzhiyun=========================== ===============================================
288*4882a593Smuzhiyunfile			    description
289*4882a593Smuzhiyun=========================== ===============================================
290*4882a593Smuzhiyunprochot<n>		    current #PROCHOT %
291*4882a593Smuzhiyunprochot<n>_avg		    moving average #PROCHOT %
292*4882a593Smuzhiyunprochot<n>_max		    limit #PROCHOT %
293*4882a593Smuzhiyunprochot_short		    enable or disable logical #PROCHOT pin short
294*4882a593Smuzhiyunprochot<n>_override	    force #PROCHOT assertion as PWM
295*4882a593Smuzhiyunprochot_override_duty_cycle duty cycle for the PWM signal used when
296*4882a593Smuzhiyun			    #PROCHOT is overridden
297*4882a593Smuzhiyunprochot<n>_interval	    #PROCHOT PWM sampling interval
298*4882a593Smuzhiyunvrdhot<n>		    0 means negated, 1 means asserted
299*4882a593Smuzhiyunfan<n>_smart_tach	    enable or disable smart tach mode
300*4882a593Smuzhiyunpwm<n>_auto_channels	    select control sources for PWM outputs
301*4882a593Smuzhiyunpwm<n>_auto_spinup_min	    minimum duty cycle during spin-up
302*4882a593Smuzhiyunpwm<n>_auto_spinup_time	    duration of spin-up
303*4882a593Smuzhiyunpwm_auto_prochot_ramp	    ramp time per step when #PROCHOT asserted
304*4882a593Smuzhiyunpwm_auto_vrdhot_ramp	    ramp time per step when #VRDHOT asserted
305*4882a593Smuzhiyuntemp<n>_auto_base	    temperature channel base
306*4882a593Smuzhiyuntemp<n>_auto_offset[1-12]   temperature channel offsets
307*4882a593Smuzhiyuntemp<n>_auto_offset_hyst    temperature channel offset hysteresis
308*4882a593Smuzhiyuntemp<n>_auto_boost	    temperature channel boost (PWMs to 100%)
309*4882a593Smuzhiyun			    limit
310*4882a593Smuzhiyuntemp<n>_auto_boost_hyst     temperature channel boost hysteresis
311*4882a593Smuzhiyungpio			    input state of 8 GPIO pins; read-only
312*4882a593Smuzhiyun=========================== ===============================================
313