1
2*** Brief Summary of sensor chip modules and SMBus access modules ***
3    (for hackers to include supports for new hardwares!)
4
5
6**************************************************************************
7[1] sensor chip modules
8**************************************************************************
9
10  The treatments of reading data are different in each class of hardware
11monitor chips.  They are separated into the following modules:
12
13   sens_winbond.c   --- LM78/79, Winbond W83XXX, Asus AS99127F ASB100
14   sens_wl784.c     --- Winbond W83L784X, W83L785X
15   sens_via68.c     --- VIA82C686A/B
16   sens_it87.c      --- ITE IT85XX and SiS950
17   sens_gl52.c      --- GL518SM/GL520SM
18   sens_lm85.c      --- LM85, ADM1027/ADT7463, EMC6D10X
19   sens_lm80.c      --- LM80
20   sens_lm90.c      --- LM90, ADM1020/1021/1023
21   sens_lm75.c      --- LM75
22
23  If one wants to add a support for new monitor chips, first prepare
24the corresponding module:
25
26   sens_xxxx.c
27   sens_yyyy.c
28
29  Then, one has to change the file, "sensors.h", in the following way
30to add the new module:
31-----------------------------------------------------------------------
32
33typedef struct hwm_access SENSOR;
34
35extern SENSOR winbond;
36extern SENSOR wl784;
37extern SENSOR via686;
38extern SENSOR it87;
39extern SENSOR gl52;
40extern SENSOR lm85;
41extern SENSOR lm80;
42extern SENSOR lm90;
43extern SENSOR lm75;
44extern SENSOR xxx;   <--- add new one xxx
45extern SENSOR yyy;   <--- add new one yyy
46
47/* should be larger than the number of "HWM_sensor_chip" */
48#define SEARCH	2002
49
50/*
51 *  Supported HWM, ordering is important!!
52 *  HWM_sensor_chip{} should be consistent with
53 *  HWM_module[] and HWM_name[]
54 */
55
56enum HWM_sensor_chip {
57	c_winbond,
58	c_wl784,
59	c_via686,
60	c_it87,
61	c_gl52,
62	c_lm85,
63	c_lm80,
64	c_lm90,
65	c_lm75,
66	c_xxxx,   <--- add new one xxx
67	c_yyyy    <--- add new one yyy
68};
69
70#ifdef INCLUDE_HWM_MODULE
71
72/* Array of Supported HWM, ordering is important!! */
73SENSOR *HWM_module[] = {
74	&winbond,
75	&wl784,
76	&via686,
77	&it87,
78	&gl52,
79	&lm85,
80	&lm80,
81	&lm90,
82	&lm75,
83	&xxx,   <--- add new one xxx
84	&yyy,   <--- add new one yyy
85	NULL };
86
87/* HWM_name[] should have one-to-one correspondence to HWM_module[] */
88char *HWM_name[] = {
89	"winbond",
90	"wl784",
91	"via686",
92	"it87",
93	"gl52",
94	"lm85",
95	"lm80",
96	"lm90",
97	"lm75",
98	"xxx",   <--- add new one xxx
99	"yyy",   <--- add new one yyy
100	NULL };
101
102int HWM_VIA = 0;
103
104/* HWM_SMBchip[] should have one-to-one correspondence to HWM_module[] */
105int HWM_SMBchip[] = {
106	0,
107	0,
108	0,
109	0,
110	0,
111	0,
112	0,
113	0,
114	0,
115	0,   <--- add new one xxx
116	0,   <--- add new one yyy
117	0 };
118
119/* HWM_smbslave[] should have one-to-one correspondence to HWM_module[] */
120int HWM_smbslave[] = {
121	0,
122	0,
123	0,
124	0,
125	0,
126	0,
127	0,
128	0,
129	0,
130	0,   <--- add new one xxx
131	0,   <--- add new one yyy
132	0 };
133
134/* HWM_ISAchip[] should have one-to-one correspondence to HWM_module[] */
135int HWM_ISAchip[] = {
136	0,
137	0,
138	0,
139	0,
140	0,
141	0,
142	0,
143	0,
144	0,
145	0,   <--- add new one xxx
146	0,   <--- add new one yyy
147	0 };
148
149
150#endif  /* INCLUDE_HWM_MODULE */
151-----------------------------------------------------------------------
152
153Here, the global variable of data type SENSOR, xxx and yyy, should be
154defined in each module, sens_xxx.c and sens_yyy.c.
155
156  And do not forget to add it to CHIPLIST macro in "mbmon.h".
157
158#define CHIPLIST "winbond|wl784|via686|it87|gl52|lm85|lm80|lm90|lm75"
159
160  As for how to make each module, please refer existing ones above.
161
162
163
164**************************************************************************
165[2] smbus modules
166**************************************************************************
167
168  The treatments of SMBus access are different for various Power Management
169Controllers (usually inside the south chipset).  They are separated into
170the following modules:
171
172   smbus_piix4.c  --- PIIX4(440BX), VT82C586/596/686A/B(KT133 etc),
173                      VT8233(KT266/A, KT333), etc
174   smbus_amd.c    --- AMD756/766/768, NVidia nForce
175   smbus_ali.c    --- ALi M1535D+
176   smbus_amd8.c   --- AMD8111, NVidia nForce2
177
178  If one wants to add a support for new PM chipset to access SMBus, first
179prepare the corresponding module:
180
181   smbus_xxx.c
182   smbus_yyy.c
183
184in each of which,
185
186   struct smbus_io smbus_xxxx = ....
187or
188   struct smbus_io smbus_yyyy = ....
189
190should be defined.  This structure "smbus_xxxx/yyyy" is used in
191"smbuses.c" below.
192
193  Next, one has to make the PM chip to be recognized in the search routine
194of the PCI Configuration in the files.  For this purpose one has to modify
195the file "pci_pm.c" and "pci_pm.h".  Include new macros in pci_pm.h,
196
197   #define XXxxxSMB	xx(int, appropriate number)
198   #define YYyyySMB	yy(int, appropriate number)
199
200and correspondingly change the file pci_pm.c.  Here one needs the following
201information:
202
203   (a)The PCI chip and vendor ID of the PM chip to be supported
204   (b)The offset where the SMBus base address is stored
205
206For the supported chipsets, these information are included in pci_pm.h.
207Refer to it for adding new PM chipsets.
208
209  Then one has to change the file, "smbuses.c", in the following way
210 to add the module:
211-----------------------------------------------------------------------
212/* smbus io routines, global */
213#if !defined(LINUX) && defined(HAVE_SMBUS) && defined(SMBUS_IOCTL)
214#else		/* using own SMBus IO routines */
215extern SMBUS_IO *smbus;
216extern SMBUS_IO smbus_piix4;
217extern SMBUS_IO smbus_amd;
218extern SMBUS_IO smbus_ali;
219extern SMBUS_IO smbus_amd8;
220extern SMBUS_IO smbus_xxx;   <--- add new one xxx
221extern SMBUS_IO smbus_yyy;   <--- add new one yyy
222#endif
223
224int set_smbus_io(int *viahwm_base, int *smb_base)
225{
226	int n;
227
228	n = pci_pm_smb_prob(viahwm_base, smb_base);
229#if !defined(LINUX) && defined(HAVE_SMBUS) && defined(SMBUS_IOCTL)
230	return n;
231#else           /* using own SMBus IO routines */
232	if (n <= 0)
233		return n;
234
235	if (n/10 == AMD756SMB/10)
236		smbus = &smbus_amd;
237	else if (n/10 == ALI7101SMB/10)
238		smbus = &smbus_ali;
239	else if (n/10 == AMD8111SMB/10)
240		smbus = &smbus_amd8;
241	else if (n/10 == XXxxxSMB/10)   <--- add new one xxx
242			smbus = &smbus_xxx;
243	else if (n/10 == YYyyySMB/10)   <--- add new one yyy
244		smbus = &smbus_yyy;
245	else
246		smbus = &smbus_piix4;
247
248	return n;
249#endif
250}
251
252