xref: /openbmc/linux/Documentation/hwmon/w83791d.rst (revision c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2)
1*7ebd8b66SMauro Carvalho ChehabKernel driver w83791d
2*7ebd8b66SMauro Carvalho Chehab=====================
3*7ebd8b66SMauro Carvalho Chehab
4*7ebd8b66SMauro Carvalho ChehabSupported chips:
5*7ebd8b66SMauro Carvalho Chehab
6*7ebd8b66SMauro Carvalho Chehab  * Winbond W83791D
7*7ebd8b66SMauro Carvalho Chehab
8*7ebd8b66SMauro Carvalho Chehab    Prefix: 'w83791d'
9*7ebd8b66SMauro Carvalho Chehab
10*7ebd8b66SMauro Carvalho Chehab    Addresses scanned: I2C 0x2c - 0x2f
11*7ebd8b66SMauro Carvalho Chehab
12*7ebd8b66SMauro Carvalho Chehab    Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83791D_W83791Gb.pdf
13*7ebd8b66SMauro Carvalho Chehab
14*7ebd8b66SMauro Carvalho ChehabAuthor: Charles Spirakis <bezaur@gmail.com>
15*7ebd8b66SMauro Carvalho Chehab
16*7ebd8b66SMauro Carvalho ChehabThis driver was derived from the w83781d.c and w83792d.c source files.
17*7ebd8b66SMauro Carvalho Chehab
18*7ebd8b66SMauro Carvalho ChehabCredits:
19*7ebd8b66SMauro Carvalho Chehab
20*7ebd8b66SMauro Carvalho Chehab  w83781d.c:
21*7ebd8b66SMauro Carvalho Chehab
22*7ebd8b66SMauro Carvalho Chehab    - Frodo Looijaard <frodol@dds.nl>,
23*7ebd8b66SMauro Carvalho Chehab    - Philip Edelbrock <phil@netroedge.com>,
24*7ebd8b66SMauro Carvalho Chehab    - Mark Studebaker <mdsxyz123@yahoo.com>
25*7ebd8b66SMauro Carvalho Chehab
26*7ebd8b66SMauro Carvalho Chehab  w83792d.c:
27*7ebd8b66SMauro Carvalho Chehab
28*7ebd8b66SMauro Carvalho Chehab    - Shane Huang (Winbond),
29*7ebd8b66SMauro Carvalho Chehab    - Rudolf Marek <r.marek@assembler.cz>
30*7ebd8b66SMauro Carvalho Chehab
31*7ebd8b66SMauro Carvalho ChehabAdditional contributors:
32*7ebd8b66SMauro Carvalho Chehab
33*7ebd8b66SMauro Carvalho Chehab    - Sven Anders <anders@anduras.de>
34*7ebd8b66SMauro Carvalho Chehab    - Marc Hulsman <m.hulsman@tudelft.nl>
35*7ebd8b66SMauro Carvalho Chehab
36*7ebd8b66SMauro Carvalho ChehabModule Parameters
37*7ebd8b66SMauro Carvalho Chehab-----------------
38*7ebd8b66SMauro Carvalho Chehab
39*7ebd8b66SMauro Carvalho Chehab* init boolean
40*7ebd8b66SMauro Carvalho Chehab    (default 0)
41*7ebd8b66SMauro Carvalho Chehab
42*7ebd8b66SMauro Carvalho Chehab    Use 'init=1' to have the driver do extra software initializations.
43*7ebd8b66SMauro Carvalho Chehab    The default behavior is to do the minimum initialization possible
44*7ebd8b66SMauro Carvalho Chehab    and depend on the BIOS to properly setup the chip. If you know you
45*7ebd8b66SMauro Carvalho Chehab    have a w83791d and you're having problems, try init=1 before trying
46*7ebd8b66SMauro Carvalho Chehab    reset=1.
47*7ebd8b66SMauro Carvalho Chehab
48*7ebd8b66SMauro Carvalho Chehab* reset boolean
49*7ebd8b66SMauro Carvalho Chehab    (default 0)
50*7ebd8b66SMauro Carvalho Chehab
51*7ebd8b66SMauro Carvalho Chehab    Use 'reset=1' to reset the chip (via index 0x40, bit 7). The default
52*7ebd8b66SMauro Carvalho Chehab    behavior is no chip reset to preserve BIOS settings.
53*7ebd8b66SMauro Carvalho Chehab
54*7ebd8b66SMauro Carvalho Chehab* force_subclients=bus,caddr,saddr,saddr
55*7ebd8b66SMauro Carvalho Chehab    This is used to force the i2c addresses for subclients of
56*7ebd8b66SMauro Carvalho Chehab    a certain chip. Example usage is `force_subclients=0,0x2f,0x4a,0x4b`
57*7ebd8b66SMauro Carvalho Chehab    to force the subclients of chip 0x2f on bus 0 to i2c addresses
58*7ebd8b66SMauro Carvalho Chehab    0x4a and 0x4b.
59*7ebd8b66SMauro Carvalho Chehab
60*7ebd8b66SMauro Carvalho Chehab
61*7ebd8b66SMauro Carvalho ChehabDescription
62*7ebd8b66SMauro Carvalho Chehab-----------
63*7ebd8b66SMauro Carvalho Chehab
64*7ebd8b66SMauro Carvalho ChehabThis driver implements support for the Winbond W83791D chip. The W83791G
65*7ebd8b66SMauro Carvalho Chehabchip appears to be the same as the W83791D but is lead free.
66*7ebd8b66SMauro Carvalho Chehab
67*7ebd8b66SMauro Carvalho ChehabDetection of the chip can sometimes be foiled because it can be in an
68*7ebd8b66SMauro Carvalho Chehabinternal state that allows no clean access (Bank with ID register is not
69*7ebd8b66SMauro Carvalho Chehabcurrently selected). If you know the address of the chip, use a 'force'
70*7ebd8b66SMauro Carvalho Chehabparameter; this will put it into a more well-behaved state first.
71*7ebd8b66SMauro Carvalho Chehab
72*7ebd8b66SMauro Carvalho ChehabThe driver implements three temperature sensors, ten voltage sensors,
73*7ebd8b66SMauro Carvalho Chehabfive fan rotation speed sensors and manual PWM control of each fan.
74*7ebd8b66SMauro Carvalho Chehab
75*7ebd8b66SMauro Carvalho ChehabTemperatures are measured in degrees Celsius and measurement resolution is 1
76*7ebd8b66SMauro Carvalho ChehabdegC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
77*7ebd8b66SMauro Carvalho Chehabthe temperature gets higher than the Overtemperature Shutdown value; it stays
78*7ebd8b66SMauro Carvalho Chehabon until the temperature falls below the Hysteresis value.
79*7ebd8b66SMauro Carvalho Chehab
80*7ebd8b66SMauro Carvalho ChehabVoltage sensors (also known as IN sensors) report their values in millivolts.
81*7ebd8b66SMauro Carvalho ChehabAn alarm is triggered if the voltage has crossed a programmable minimum
82*7ebd8b66SMauro Carvalho Chehabor maximum limit.
83*7ebd8b66SMauro Carvalho Chehab
84*7ebd8b66SMauro Carvalho ChehabFan rotation speeds are reported in RPM (rotations per minute). An alarm is
85*7ebd8b66SMauro Carvalho Chehabtriggered if the rotation speed has dropped below a programmable limit. Fan
86*7ebd8b66SMauro Carvalho Chehabreadings can be divided by a programmable divider (1, 2, 4, 8, 16,
87*7ebd8b66SMauro Carvalho Chehab32, 64 or 128 for all fans) to give the readings more range or accuracy.
88*7ebd8b66SMauro Carvalho Chehab
89*7ebd8b66SMauro Carvalho ChehabEach fan controlled is controlled by PWM. The PWM duty cycle can be read and
90*7ebd8b66SMauro Carvalho Chehabset for each fan separately. Valid values range from 0 (stop) to 255 (full).
91*7ebd8b66SMauro Carvalho ChehabPWM 1-3 support Thermal Cruise mode, in which the PWMs are automatically
92*7ebd8b66SMauro Carvalho Chehabregulated to keep respectively temp 1-3 at a certain target temperature.
93*7ebd8b66SMauro Carvalho ChehabSee below for the description of the sysfs-interface.
94*7ebd8b66SMauro Carvalho Chehab
95*7ebd8b66SMauro Carvalho ChehabThe w83791d has a global bit used to enable beeping from the speaker when an
96*7ebd8b66SMauro Carvalho Chehabalarm is triggered as well as a bitmask to enable or disable the beep for
97*7ebd8b66SMauro Carvalho Chehabspecific alarms. You need both the global beep enable bit and the
98*7ebd8b66SMauro Carvalho Chehabcorresponding beep bit to be on for a triggered alarm to sound a beep.
99*7ebd8b66SMauro Carvalho Chehab
100*7ebd8b66SMauro Carvalho ChehabThe sysfs interface to the global enable is via the sysfs beep_enable file.
101*7ebd8b66SMauro Carvalho ChehabThis file is used for both legacy and new code.
102*7ebd8b66SMauro Carvalho Chehab
103*7ebd8b66SMauro Carvalho ChehabThe sysfs interface to the beep bitmask has migrated from the original legacy
104*7ebd8b66SMauro Carvalho Chehabmethod of a single sysfs beep_mask file to a newer method using multiple
105*7ebd8b66SMauro Carvalho Chehab`*_beep` files as described in `Documentation/hwmon/sysfs-interface.rst`.
106*7ebd8b66SMauro Carvalho Chehab
107*7ebd8b66SMauro Carvalho ChehabA similar change has occurred for the bitmap corresponding to the alarms. The
108*7ebd8b66SMauro Carvalho Chehaboriginal legacy method used a single sysfs alarms file containing a bitmap
109*7ebd8b66SMauro Carvalho Chehabof triggered alarms. The newer method uses multiple sysfs `*_alarm` files
110*7ebd8b66SMauro Carvalho Chehab(again following the pattern described in sysfs-interface).
111*7ebd8b66SMauro Carvalho Chehab
112*7ebd8b66SMauro Carvalho ChehabSince both methods read and write the underlying hardware, they can be used
113*7ebd8b66SMauro Carvalho Chehabinterchangeably and changes in one will automatically be reflected by
114*7ebd8b66SMauro Carvalho Chehabthe other. If you use the legacy bitmask method, your user-space code is
115*7ebd8b66SMauro Carvalho Chehabresponsible for handling the fact that the alarms and beep_mask bitmaps
116*7ebd8b66SMauro Carvalho Chehabare not the same (see the table below).
117*7ebd8b66SMauro Carvalho Chehab
118*7ebd8b66SMauro Carvalho ChehabNOTE: All new code should be written to use the newer sysfs-interface
119*7ebd8b66SMauro Carvalho Chehabspecification as that avoids bitmap problems and is the preferred interface
120*7ebd8b66SMauro Carvalho Chehabgoing forward.
121*7ebd8b66SMauro Carvalho Chehab
122*7ebd8b66SMauro Carvalho ChehabThe driver reads the hardware chip values at most once every three seconds.
123*7ebd8b66SMauro Carvalho ChehabUser mode code requesting values more often will receive cached values.
124*7ebd8b66SMauro Carvalho Chehab
125*7ebd8b66SMauro Carvalho Chehab/sys files
126*7ebd8b66SMauro Carvalho Chehab----------
127*7ebd8b66SMauro Carvalho ChehabThe sysfs-interface is documented in the 'sysfs-interface' file. Only
128*7ebd8b66SMauro Carvalho Chehabchip-specific options are documented here.
129*7ebd8b66SMauro Carvalho Chehab
130*7ebd8b66SMauro Carvalho Chehab======================= =======================================================
131*7ebd8b66SMauro Carvalho Chehabpwm[1-3]_enable		this file controls mode of fan/temperature control for
132*7ebd8b66SMauro Carvalho Chehab			fan 1-3. Fan/PWM 4-5 only support manual mode.
133*7ebd8b66SMauro Carvalho Chehab
134*7ebd8b66SMauro Carvalho Chehab			    * 1 Manual mode
135*7ebd8b66SMauro Carvalho Chehab			    * 2 Thermal Cruise mode
136*7ebd8b66SMauro Carvalho Chehab			    * 3 Fan Speed Cruise mode (no further support)
137*7ebd8b66SMauro Carvalho Chehab
138*7ebd8b66SMauro Carvalho Chehabtemp[1-3]_target	defines the target temperature for Thermal Cruise mode.
139*7ebd8b66SMauro Carvalho Chehab			Unit: millidegree Celsius
140*7ebd8b66SMauro Carvalho Chehab			RW
141*7ebd8b66SMauro Carvalho Chehab
142*7ebd8b66SMauro Carvalho Chehabtemp[1-3]_tolerance	temperature tolerance for Thermal Cruise mode.
143*7ebd8b66SMauro Carvalho Chehab			Specifies an interval around the target temperature
144*7ebd8b66SMauro Carvalho Chehab			in which the fan speed is not changed.
145*7ebd8b66SMauro Carvalho Chehab			Unit: millidegree Celsius
146*7ebd8b66SMauro Carvalho Chehab			RW
147*7ebd8b66SMauro Carvalho Chehab======================= =======================================================
148*7ebd8b66SMauro Carvalho Chehab
149*7ebd8b66SMauro Carvalho ChehabAlarms bitmap vs. beep_mask bitmask
150*7ebd8b66SMauro Carvalho Chehab-----------------------------------
151*7ebd8b66SMauro Carvalho Chehab
152*7ebd8b66SMauro Carvalho ChehabFor legacy code using the alarms and beep_mask files:
153*7ebd8b66SMauro Carvalho Chehab
154*7ebd8b66SMauro Carvalho Chehab=============  ========  ========= ==========================
155*7ebd8b66SMauro Carvalho ChehabSignal         Alarms    beep_mask Obs
156*7ebd8b66SMauro Carvalho Chehab=============  ========  ========= ==========================
157*7ebd8b66SMauro Carvalho Chehabin0 (VCORE)    0x000001  0x000001
158*7ebd8b66SMauro Carvalho Chehabin1 (VINR0)    0x000002  0x002000  <== mismatch
159*7ebd8b66SMauro Carvalho Chehabin2 (+3.3VIN)  0x000004  0x000004
160*7ebd8b66SMauro Carvalho Chehabin3 (5VDD)     0x000008  0x000008
161*7ebd8b66SMauro Carvalho Chehabin4 (+12VIN)   0x000100  0x000100
162*7ebd8b66SMauro Carvalho Chehabin5 (-12VIN)   0x000200  0x000200
163*7ebd8b66SMauro Carvalho Chehabin6 (-5VIN)    0x000400  0x000400
164*7ebd8b66SMauro Carvalho Chehabin7 (VSB)      0x080000  0x010000  <== mismatch
165*7ebd8b66SMauro Carvalho Chehabin8 (VBAT)     0x100000  0x020000  <== mismatch
166*7ebd8b66SMauro Carvalho Chehabin9 (VINR1)    0x004000  0x004000
167*7ebd8b66SMauro Carvalho Chehabtemp1          0x000010  0x000010
168*7ebd8b66SMauro Carvalho Chehabtemp2          0x000020  0x000020
169*7ebd8b66SMauro Carvalho Chehabtemp3          0x002000  0x000002  <== mismatch
170*7ebd8b66SMauro Carvalho Chehabfan1           0x000040  0x000040
171*7ebd8b66SMauro Carvalho Chehabfan2           0x000080  0x000080
172*7ebd8b66SMauro Carvalho Chehabfan3           0x000800  0x000800
173*7ebd8b66SMauro Carvalho Chehabfan4           0x200000  0x200000
174*7ebd8b66SMauro Carvalho Chehabfan5           0x400000  0x400000
175*7ebd8b66SMauro Carvalho Chehabtart1          0x010000  0x040000  <== mismatch
176*7ebd8b66SMauro Carvalho Chehabtart2          0x020000  0x080000  <== mismatch
177*7ebd8b66SMauro Carvalho Chehabtart3          0x040000  0x100000  <== mismatch
178*7ebd8b66SMauro Carvalho Chehabcase_open      0x001000  0x001000
179*7ebd8b66SMauro Carvalho Chehabglobal_enable  -         0x800000  (modified via beep_enable)
180*7ebd8b66SMauro Carvalho Chehab=============  ========  ========= ==========================
181