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