xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/pc87360.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver pc87360
2*4882a593Smuzhiyun=====================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * National Semiconductor PC87360, PC87363, PC87364, PC87365 and PC87366
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun    Prefixes: 'pc87360', 'pc87363', 'pc87364', 'pc87365', 'pc87366'
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    Addresses scanned: none, address read from Super I/O config space
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheets: No longer available
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunAuthors: Jean Delvare <jdelvare@suse.de>
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunThanks to Sandeep Mehta, Tonko de Rooy and Daniel Ceregatti for testing.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunThanks to Rudolf Marek for helping me investigate conversion issues.
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunModule Parameters
22*4882a593Smuzhiyun-----------------
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun* init int
25*4882a593Smuzhiyun    Chip initialization level:
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun    - 0: None
28*4882a593Smuzhiyun    - **1**: Forcibly enable internal voltage and temperature channels,
29*4882a593Smuzhiyun      except in9
30*4882a593Smuzhiyun    - 2: Forcibly enable all voltage and temperature channels, except in9
31*4882a593Smuzhiyun    - 3: Forcibly enable all voltage and temperature channels, including in9
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunNote that this parameter has no effect for the PC87360, PC87363 and PC87364
34*4882a593Smuzhiyunchips.
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunAlso note that for the PC87366, initialization levels 2 and 3 don't enable
37*4882a593Smuzhiyunall temperature channels, because some of them share pins with each other,
38*4882a593Smuzhiyunso they can't be used at the same time.
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunDescription
42*4882a593Smuzhiyun-----------
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunThe National Semiconductor PC87360 Super I/O chip contains monitoring and
45*4882a593SmuzhiyunPWM control circuitry for two fans. The PC87363 chip is similar, and the
46*4882a593SmuzhiyunPC87364 chip has monitoring and PWM control for a third fan.
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunThe National Semiconductor PC87365 and PC87366 Super I/O chips are complete
49*4882a593Smuzhiyunhardware monitoring chipsets, not only controlling and monitoring three fans,
50*4882a593Smuzhiyunbut also monitoring eleven voltage inputs and two (PC87365) or up to four
51*4882a593Smuzhiyun(PC87366) temperatures.
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun  =========== ======= ======= ======= ======= =====
54*4882a593Smuzhiyun  Chip        #vin    #fan    #pwm    #temp   devid
55*4882a593Smuzhiyun  =========== ======= ======= ======= ======= =====
56*4882a593Smuzhiyun  PC87360     -       2       2       -       0xE1
57*4882a593Smuzhiyun  PC87363     -       2       2       -       0xE8
58*4882a593Smuzhiyun  PC87364     -       3       3       -       0xE4
59*4882a593Smuzhiyun  PC87365     11      3       3       2       0xE5
60*4882a593Smuzhiyun  PC87366     11      3       3       3-4     0xE9
61*4882a593Smuzhiyun  =========== ======= ======= ======= ======= =====
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunThe driver assumes that no more than one chip is present, and one of the
64*4882a593Smuzhiyunstandard Super I/O addresses is used (0x2E/0x2F or 0x4E/0x4F)
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunFan Monitoring
67*4882a593Smuzhiyun--------------
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunFan rotation speeds are reported in RPM (revolutions per minute). An alarm
70*4882a593Smuzhiyunis triggered if the rotation speed has dropped below a programmable limit.
71*4882a593SmuzhiyunA different alarm is triggered if the fan speed is too low to be measured.
72*4882a593Smuzhiyun
73*4882a593SmuzhiyunFan readings are affected by a programmable clock divider, giving the
74*4882a593Smuzhiyunreadings more range or accuracy. Usually, users have to learn how it works,
75*4882a593Smuzhiyunbut this driver implements dynamic clock divider selection, so you don't
76*4882a593Smuzhiyunhave to care no more.
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunFor reference, here are a few values about clock dividers:
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun    =========== =============== =============== ===========
81*4882a593Smuzhiyun		slowest         accuracy        highest
82*4882a593Smuzhiyun		measurable      around 3000     accurate
83*4882a593Smuzhiyun    divider     speed (RPM)     RPM (RPM)       speed (RPM)
84*4882a593Smuzhiyun    =========== =============== =============== ===========
85*4882a593Smuzhiyun	 1        1882              18           6928
86*4882a593Smuzhiyun	 2         941              37           4898
87*4882a593Smuzhiyun	 4         470              74           3464
88*4882a593Smuzhiyun	 8         235             150           2449
89*4882a593Smuzhiyun    =========== =============== =============== ===========
90*4882a593Smuzhiyun
91*4882a593SmuzhiyunFor the curious, here is how the values above were computed:
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun * slowest measurable speed: clock/(255*divider)
94*4882a593Smuzhiyun * accuracy around 3000 RPM: 3000^2/clock
95*4882a593Smuzhiyun * highest accurate speed: sqrt(clock*100)
96*4882a593Smuzhiyun
97*4882a593SmuzhiyunThe clock speed for the PC87360 family is 480 kHz. I arbitrarily chose 100
98*4882a593SmuzhiyunRPM as the lowest acceptable accuracy.
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunAs mentioned above, you don't have to care about this no more.
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunNote that not all RPM values can be represented, even when the best clock
103*4882a593Smuzhiyundivider is selected. This is not only true for the measured speeds, but
104*4882a593Smuzhiyunalso for the programmable low limits, so don't be surprised if you try to
105*4882a593Smuzhiyunset, say, fan1_min to 2900 and it finally reads 2909.
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunFan Control
109*4882a593Smuzhiyun-----------
110*4882a593Smuzhiyun
111*4882a593SmuzhiyunPWM (pulse width modulation) values range from 0 to 255, with 0 meaning
112*4882a593Smuzhiyunthat the fan is stopped, and 255 meaning that the fan goes at full speed.
113*4882a593Smuzhiyun
114*4882a593SmuzhiyunBe extremely careful when changing PWM values. Low PWM values, even
115*4882a593Smuzhiyunnon-zero, can stop the fan, which may cause irreversible damage to your
116*4882a593Smuzhiyunhardware if temperature increases too much. When changing PWM values, go
117*4882a593Smuzhiyunstep by step and keep an eye on temperatures.
118*4882a593Smuzhiyun
119*4882a593SmuzhiyunOne user reported problems with PWM. Changing PWM values would break fan
120*4882a593Smuzhiyunspeed readings. No explanation nor fix could be found.
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun
123*4882a593SmuzhiyunTemperature Monitoring
124*4882a593Smuzhiyun----------------------
125*4882a593Smuzhiyun
126*4882a593SmuzhiyunTemperatures are reported in degrees Celsius. Each temperature measured has
127*4882a593Smuzhiyunassociated low, high and overtemperature limits, each of which triggers an
128*4882a593Smuzhiyunalarm when crossed.
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunThe first two temperature channels are external. The third one (PC87366
131*4882a593Smuzhiyunonly) is internal.
132*4882a593Smuzhiyun
133*4882a593SmuzhiyunThe PC87366 has three additional temperature channels, based on
134*4882a593Smuzhiyunthermistors (as opposed to thermal diodes for the first three temperature
135*4882a593Smuzhiyunchannels). For technical reasons, these channels are held by the VLM
136*4882a593Smuzhiyun(voltage level monitor) logical device, not the TMS (temperature
137*4882a593Smuzhiyunmeasurement) one. As a consequence, these temperatures are exported as
138*4882a593Smuzhiyunvoltages, and converted into temperatures in user-space.
139*4882a593Smuzhiyun
140*4882a593SmuzhiyunNote that these three additional channels share their pins with the
141*4882a593Smuzhiyunexternal thermal diode channels, so you (physically) can't use them all at
142*4882a593Smuzhiyunthe same time. Although it should be possible to mix the two sensor types,
143*4882a593Smuzhiyunthe documents from National Semiconductor suggest that motherboard
144*4882a593Smuzhiyunmanufacturers should choose one type and stick to it. So you will more
145*4882a593Smuzhiyunlikely have either channels 1 to 3 (thermal diodes) or 3 to 6 (internal
146*4882a593Smuzhiyunthermal diode, and thermistors).
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun
149*4882a593SmuzhiyunVoltage Monitoring
150*4882a593Smuzhiyun------------------
151*4882a593Smuzhiyun
152*4882a593SmuzhiyunVoltages are reported relatively to a reference voltage, either internal or
153*4882a593Smuzhiyunexternal. Some of them (in7:Vsb, in8:Vdd and in10:AVdd) are divided by two
154*4882a593Smuzhiyuninternally, you will have to compensate in sensors.conf. Others (in0 to in6)
155*4882a593Smuzhiyunare likely to be divided externally. The meaning of each of these inputs as
156*4882a593Smuzhiyunwell as the values of the resistors used for division is left to the
157*4882a593Smuzhiyunmotherboard manufacturers, so you will have to document yourself and edit
158*4882a593Smuzhiyunsensors.conf accordingly. National Semiconductor has a document with
159*4882a593Smuzhiyunrecommended resistor values for some voltages, but this still leaves much
160*4882a593Smuzhiyunroom for per motherboard specificities, unfortunately. Even worse,
161*4882a593Smuzhiyunmotherboard manufacturers don't seem to care about National Semiconductor's
162*4882a593Smuzhiyunrecommendations.
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunEach voltage measured has associated low and high limits, each of which
165*4882a593Smuzhiyuntriggers an alarm when crossed.
166*4882a593Smuzhiyun
167*4882a593SmuzhiyunWhen available, VID inputs are used to provide the nominal CPU Core voltage.
168*4882a593SmuzhiyunThe driver will default to VRM 9.0, but this can be changed from user-space.
169*4882a593SmuzhiyunThe chipsets can handle two sets of VID inputs (on dual-CPU systems), but
170*4882a593Smuzhiyunthe driver will only export one for now. This may change later if there is
171*4882a593Smuzhiyuna need.
172*4882a593Smuzhiyun
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunGeneral Remarks
175*4882a593Smuzhiyun---------------
176*4882a593Smuzhiyun
177*4882a593SmuzhiyunIf an alarm triggers, it will remain triggered until the hardware register
178*4882a593Smuzhiyunis read at least once. This means that the cause for the alarm may already
179*4882a593Smuzhiyunhave disappeared! Note that all hardware registers are read whenever any
180*4882a593Smuzhiyundata is read (unless it is less than 2 seconds since the last update, in
181*4882a593Smuzhiyunwhich case cached values are returned instead). As a consequence, when
182*4882a593Smuzhiyuna once-only alarm triggers, it may take 2 seconds for it to show, and 2
183*4882a593Smuzhiyunmore seconds for it to disappear.
184*4882a593Smuzhiyun
185*4882a593SmuzhiyunMonitoring of in9 isn't enabled at lower init levels (<3) because that
186*4882a593Smuzhiyunchannel measures the battery voltage (Vbat). It is a known fact that
187*4882a593Smuzhiyunrepeatedly sampling the battery voltage reduces its lifetime. National
188*4882a593SmuzhiyunSemiconductor smartly designed their chipset so that in9 is sampled only
189*4882a593Smuzhiyunonce every 1024 sampling cycles (that is every 34 minutes at the default
190*4882a593Smuzhiyunsampling rate), so the effect is attenuated, but still present.
191*4882a593Smuzhiyun
192*4882a593Smuzhiyun
193*4882a593SmuzhiyunLimitations
194*4882a593Smuzhiyun-----------
195*4882a593Smuzhiyun
196*4882a593SmuzhiyunThe datasheets suggests that some values (fan mins, fan dividers)
197*4882a593Smuzhiyunshouldn't be changed once the monitoring has started, but we ignore that
198*4882a593Smuzhiyunrecommendation. We'll reconsider if it actually causes trouble.
199