xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/w83791d.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver w83791d
2*4882a593Smuzhiyun=====================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSupported chips:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun  * Winbond W83791D
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun    Prefix: 'w83791d'
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    Addresses scanned: I2C 0x2c - 0x2f
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83791D_W83791Gb.pdf
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunAuthor: Charles Spirakis <bezaur@gmail.com>
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunThis driver was derived from the w83781d.c and w83792d.c source files.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunCredits:
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun  w83781d.c:
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun    - Frodo Looijaard <frodol@dds.nl>,
23*4882a593Smuzhiyun    - Philip Edelbrock <phil@netroedge.com>,
24*4882a593Smuzhiyun    - Mark Studebaker <mdsxyz123@yahoo.com>
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun  w83792d.c:
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    - Shane Huang (Winbond),
29*4882a593Smuzhiyun    - Rudolf Marek <r.marek@assembler.cz>
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunAdditional contributors:
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun    - Sven Anders <anders@anduras.de>
34*4882a593Smuzhiyun    - Marc Hulsman <m.hulsman@tudelft.nl>
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunModule Parameters
37*4882a593Smuzhiyun-----------------
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun* init boolean
40*4882a593Smuzhiyun    (default 0)
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun    Use 'init=1' to have the driver do extra software initializations.
43*4882a593Smuzhiyun    The default behavior is to do the minimum initialization possible
44*4882a593Smuzhiyun    and depend on the BIOS to properly setup the chip. If you know you
45*4882a593Smuzhiyun    have a w83791d and you're having problems, try init=1 before trying
46*4882a593Smuzhiyun    reset=1.
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun* reset boolean
49*4882a593Smuzhiyun    (default 0)
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun    Use 'reset=1' to reset the chip (via index 0x40, bit 7). The default
52*4882a593Smuzhiyun    behavior is no chip reset to preserve BIOS settings.
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun* force_subclients=bus,caddr,saddr,saddr
55*4882a593Smuzhiyun    This is used to force the i2c addresses for subclients of
56*4882a593Smuzhiyun    a certain chip. Example usage is `force_subclients=0,0x2f,0x4a,0x4b`
57*4882a593Smuzhiyun    to force the subclients of chip 0x2f on bus 0 to i2c addresses
58*4882a593Smuzhiyun    0x4a and 0x4b.
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunDescription
62*4882a593Smuzhiyun-----------
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunThis driver implements support for the Winbond W83791D chip. The W83791G
65*4882a593Smuzhiyunchip appears to be the same as the W83791D but is lead free.
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunDetection of the chip can sometimes be foiled because it can be in an
68*4882a593Smuzhiyuninternal state that allows no clean access (Bank with ID register is not
69*4882a593Smuzhiyuncurrently selected). If you know the address of the chip, use a 'force'
70*4882a593Smuzhiyunparameter; this will put it into a more well-behaved state first.
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunThe driver implements three temperature sensors, ten voltage sensors,
73*4882a593Smuzhiyunfive fan rotation speed sensors and manual PWM control of each fan.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunTemperatures are measured in degrees Celsius and measurement resolution is 1
76*4882a593SmuzhiyundegC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
77*4882a593Smuzhiyunthe temperature gets higher than the Overtemperature Shutdown value; it stays
78*4882a593Smuzhiyunon until the temperature falls below the Hysteresis value.
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunVoltage sensors (also known as IN sensors) report their values in millivolts.
81*4882a593SmuzhiyunAn alarm is triggered if the voltage has crossed a programmable minimum
82*4882a593Smuzhiyunor maximum limit.
83*4882a593Smuzhiyun
84*4882a593SmuzhiyunFan rotation speeds are reported in RPM (rotations per minute). An alarm is
85*4882a593Smuzhiyuntriggered if the rotation speed has dropped below a programmable limit. Fan
86*4882a593Smuzhiyunreadings can be divided by a programmable divider (1, 2, 4, 8, 16,
87*4882a593Smuzhiyun32, 64 or 128 for all fans) to give the readings more range or accuracy.
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunEach fan controlled is controlled by PWM. The PWM duty cycle can be read and
90*4882a593Smuzhiyunset for each fan separately. Valid values range from 0 (stop) to 255 (full).
91*4882a593SmuzhiyunPWM 1-3 support Thermal Cruise mode, in which the PWMs are automatically
92*4882a593Smuzhiyunregulated to keep respectively temp 1-3 at a certain target temperature.
93*4882a593SmuzhiyunSee below for the description of the sysfs-interface.
94*4882a593Smuzhiyun
95*4882a593SmuzhiyunThe w83791d has a global bit used to enable beeping from the speaker when an
96*4882a593Smuzhiyunalarm is triggered as well as a bitmask to enable or disable the beep for
97*4882a593Smuzhiyunspecific alarms. You need both the global beep enable bit and the
98*4882a593Smuzhiyuncorresponding beep bit to be on for a triggered alarm to sound a beep.
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunThe sysfs interface to the global enable is via the sysfs beep_enable file.
101*4882a593SmuzhiyunThis file is used for both legacy and new code.
102*4882a593Smuzhiyun
103*4882a593SmuzhiyunThe sysfs interface to the beep bitmask has migrated from the original legacy
104*4882a593Smuzhiyunmethod of a single sysfs beep_mask file to a newer method using multiple
105*4882a593Smuzhiyun`*_beep` files as described in `Documentation/hwmon/sysfs-interface.rst`.
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunA similar change has occurred for the bitmap corresponding to the alarms. The
108*4882a593Smuzhiyunoriginal legacy method used a single sysfs alarms file containing a bitmap
109*4882a593Smuzhiyunof triggered alarms. The newer method uses multiple sysfs `*_alarm` files
110*4882a593Smuzhiyun(again following the pattern described in sysfs-interface).
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunSince both methods read and write the underlying hardware, they can be used
113*4882a593Smuzhiyuninterchangeably and changes in one will automatically be reflected by
114*4882a593Smuzhiyunthe other. If you use the legacy bitmask method, your user-space code is
115*4882a593Smuzhiyunresponsible for handling the fact that the alarms and beep_mask bitmaps
116*4882a593Smuzhiyunare not the same (see the table below).
117*4882a593Smuzhiyun
118*4882a593SmuzhiyunNOTE: All new code should be written to use the newer sysfs-interface
119*4882a593Smuzhiyunspecification as that avoids bitmap problems and is the preferred interface
120*4882a593Smuzhiyungoing forward.
121*4882a593Smuzhiyun
122*4882a593SmuzhiyunThe driver reads the hardware chip values at most once every three seconds.
123*4882a593SmuzhiyunUser mode code requesting values more often will receive cached values.
124*4882a593Smuzhiyun
125*4882a593Smuzhiyun/sys files
126*4882a593Smuzhiyun----------
127*4882a593SmuzhiyunThe sysfs-interface is documented in the 'sysfs-interface' file. Only
128*4882a593Smuzhiyunchip-specific options are documented here.
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun======================= =======================================================
131*4882a593Smuzhiyunpwm[1-3]_enable		this file controls mode of fan/temperature control for
132*4882a593Smuzhiyun			fan 1-3. Fan/PWM 4-5 only support manual mode.
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun			    * 1 Manual mode
135*4882a593Smuzhiyun			    * 2 Thermal Cruise mode
136*4882a593Smuzhiyun			    * 3 Fan Speed Cruise mode (no further support)
137*4882a593Smuzhiyun
138*4882a593Smuzhiyuntemp[1-3]_target	defines the target temperature for Thermal Cruise mode.
139*4882a593Smuzhiyun			Unit: millidegree Celsius
140*4882a593Smuzhiyun			RW
141*4882a593Smuzhiyun
142*4882a593Smuzhiyuntemp[1-3]_tolerance	temperature tolerance for Thermal Cruise mode.
143*4882a593Smuzhiyun			Specifies an interval around the target temperature
144*4882a593Smuzhiyun			in which the fan speed is not changed.
145*4882a593Smuzhiyun			Unit: millidegree Celsius
146*4882a593Smuzhiyun			RW
147*4882a593Smuzhiyun======================= =======================================================
148*4882a593Smuzhiyun
149*4882a593SmuzhiyunAlarms bitmap vs. beep_mask bitmask
150*4882a593Smuzhiyun-----------------------------------
151*4882a593Smuzhiyun
152*4882a593SmuzhiyunFor legacy code using the alarms and beep_mask files:
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun=============  ========  ========= ==========================
155*4882a593SmuzhiyunSignal         Alarms    beep_mask Obs
156*4882a593Smuzhiyun=============  ========  ========= ==========================
157*4882a593Smuzhiyunin0 (VCORE)    0x000001  0x000001
158*4882a593Smuzhiyunin1 (VINR0)    0x000002  0x002000  <== mismatch
159*4882a593Smuzhiyunin2 (+3.3VIN)  0x000004  0x000004
160*4882a593Smuzhiyunin3 (5VDD)     0x000008  0x000008
161*4882a593Smuzhiyunin4 (+12VIN)   0x000100  0x000100
162*4882a593Smuzhiyunin5 (-12VIN)   0x000200  0x000200
163*4882a593Smuzhiyunin6 (-5VIN)    0x000400  0x000400
164*4882a593Smuzhiyunin7 (VSB)      0x080000  0x010000  <== mismatch
165*4882a593Smuzhiyunin8 (VBAT)     0x100000  0x020000  <== mismatch
166*4882a593Smuzhiyunin9 (VINR1)    0x004000  0x004000
167*4882a593Smuzhiyuntemp1          0x000010  0x000010
168*4882a593Smuzhiyuntemp2          0x000020  0x000020
169*4882a593Smuzhiyuntemp3          0x002000  0x000002  <== mismatch
170*4882a593Smuzhiyunfan1           0x000040  0x000040
171*4882a593Smuzhiyunfan2           0x000080  0x000080
172*4882a593Smuzhiyunfan3           0x000800  0x000800
173*4882a593Smuzhiyunfan4           0x200000  0x200000
174*4882a593Smuzhiyunfan5           0x400000  0x400000
175*4882a593Smuzhiyuntart1          0x010000  0x040000  <== mismatch
176*4882a593Smuzhiyuntart2          0x020000  0x080000  <== mismatch
177*4882a593Smuzhiyuntart3          0x040000  0x100000  <== mismatch
178*4882a593Smuzhiyuncase_open      0x001000  0x001000
179*4882a593Smuzhiyunglobal_enable  -         0x800000  (modified via beep_enable)
180*4882a593Smuzhiyun=============  ========  ========= ==========================
181