Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef _I8042_X86IA64IO_H |
2 | #define _I8042_X86IA64IO_H | |
3 | ||
4 | /* | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License version 2 as published by | |
7 | * the Free Software Foundation. | |
8 | */ | |
9 | ||
10 | /* | |
11 | * Names. | |
12 | */ | |
13 | ||
14 | #define I8042_KBD_PHYS_DESC "isa0060/serio0" | |
15 | #define I8042_AUX_PHYS_DESC "isa0060/serio1" | |
16 | #define I8042_MUX_PHYS_DESC "isa0060/serio%d" | |
17 | ||
18 | /* | |
19 | * IRQs. | |
20 | */ | |
21 | ||
22 | #if defined(__ia64__) | |
23 | # define I8042_MAP_IRQ(x) isa_irq_to_vector((x)) | |
24 | #else | |
25 | # define I8042_MAP_IRQ(x) (x) | |
26 | #endif | |
27 | ||
28 | #define I8042_KBD_IRQ i8042_kbd_irq | |
29 | #define I8042_AUX_IRQ i8042_aux_irq | |
30 | ||
31 | static int i8042_kbd_irq; | |
32 | static int i8042_aux_irq; | |
33 | ||
34 | /* | |
35 | * Register numbers. | |
36 | */ | |
37 | ||
38 | #define I8042_COMMAND_REG i8042_command_reg | |
39 | #define I8042_STATUS_REG i8042_command_reg | |
40 | #define I8042_DATA_REG i8042_data_reg | |
41 | ||
42 | static int i8042_command_reg = 0x64; | |
43 | static int i8042_data_reg = 0x60; | |
44 | ||
45 | ||
46 | static inline int i8042_read_data(void) | |
47 | { | |
48 | return inb(I8042_DATA_REG); | |
49 | } | |
50 | ||
51 | static inline int i8042_read_status(void) | |
52 | { | |
53 | return inb(I8042_STATUS_REG); | |
54 | } | |
55 | ||
56 | static inline void i8042_write_data(int val) | |
57 | { | |
58 | outb(val, I8042_DATA_REG); | |
59 | } | |
60 | ||
61 | static inline void i8042_write_command(int val) | |
62 | { | |
63 | outb(val, I8042_COMMAND_REG); | |
64 | } | |
65 | ||
c3a34f43 | 66 | #ifdef CONFIG_X86 |
1da177e4 LT |
67 | |
68 | #include <linux/dmi.h> | |
69 | ||
70 | static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { | |
87d9173e DT |
71 | { |
72 | /* AUX LOOP command does not raise AUX IRQ */ | |
73 | .ident = "Arima-Rioworks HDAMB", | |
74 | .matches = { | |
75 | DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"), | |
76 | DMI_MATCH(DMI_BOARD_NAME, "HDAMB"), | |
77 | DMI_MATCH(DMI_BOARD_VERSION, "Rev E"), | |
78 | }, | |
79 | }, | |
90245c17 DT |
80 | { |
81 | /* AUX LOOP command does not raise AUX IRQ */ | |
82 | .ident = "ASUS P65UP5", | |
83 | .matches = { | |
84 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | |
85 | DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"), | |
86 | DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"), | |
87 | }, | |
88 | }, | |
1da177e4 LT |
89 | { |
90 | .ident = "Compaq Proliant 8500", | |
91 | .matches = { | |
92 | DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), | |
93 | DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), | |
94 | DMI_MATCH(DMI_PRODUCT_VERSION, "8500"), | |
95 | }, | |
96 | }, | |
97 | { | |
98 | .ident = "Compaq Proliant DL760", | |
99 | .matches = { | |
100 | DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), | |
101 | DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), | |
102 | DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"), | |
103 | }, | |
104 | }, | |
6020bafc BC |
105 | { |
106 | .ident = "OQO Model 01", | |
107 | .matches = { | |
108 | DMI_MATCH(DMI_SYS_VENDOR, "OQO"), | |
109 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"), | |
110 | DMI_MATCH(DMI_PRODUCT_VERSION, "00"), | |
111 | }, | |
112 | }, | |
8c4df74e DT |
113 | { |
114 | /* AUX LOOP does not work properly */ | |
115 | .ident = "ULI EV4873", | |
116 | .matches = { | |
117 | DMI_MATCH(DMI_SYS_VENDOR, "ULI"), | |
118 | DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"), | |
119 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), | |
120 | }, | |
121 | }, | |
8bf4215e JK |
122 | { |
123 | .ident = "Microsoft Virtual Machine", | |
124 | .matches = { | |
125 | DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), | |
126 | DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), | |
127 | DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"), | |
128 | }, | |
129 | }, | |
89cdb8ce DT |
130 | { |
131 | .ident = "Medion MAM 2070", | |
132 | .matches = { | |
133 | DMI_MATCH(DMI_SYS_VENDOR, "Notebook"), | |
134 | DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"), | |
135 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), | |
136 | }, | |
137 | }, | |
2c6f2cb8 SB |
138 | { |
139 | .ident = "Blue FB5601", | |
140 | .matches = { | |
141 | DMI_MATCH(DMI_SYS_VENDOR, "blue"), | |
142 | DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"), | |
143 | DMI_MATCH(DMI_PRODUCT_VERSION, "M606"), | |
144 | }, | |
145 | }, | |
1da177e4 LT |
146 | { } |
147 | }; | |
148 | ||
149 | /* | |
59311de3 | 150 | * Some Fujitsu notebooks are having trouble with touchpads if |
1da177e4 LT |
151 | * active multiplexing mode is activated. Luckily they don't have |
152 | * external PS/2 ports so we can safely disable it. | |
59311de3 DT |
153 | * ... apparently some Toshibas don't like MUX mode either and |
154 | * die horrible death on reboot. | |
1da177e4 LT |
155 | */ |
156 | static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { | |
157 | { | |
158 | .ident = "Fujitsu Lifebook P7010/P7010D", | |
159 | .matches = { | |
160 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
161 | DMI_MATCH(DMI_PRODUCT_NAME, "P7010"), | |
162 | }, | |
163 | }, | |
bb06ec3c DT |
164 | { |
165 | .ident = "Fujitsu Lifebook P7010", | |
166 | .matches = { | |
167 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | |
168 | DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"), | |
169 | }, | |
170 | }, | |
1da177e4 LT |
171 | { |
172 | .ident = "Fujitsu Lifebook P5020D", | |
173 | .matches = { | |
174 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
175 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"), | |
176 | }, | |
177 | }, | |
178 | { | |
179 | .ident = "Fujitsu Lifebook S2000", | |
180 | .matches = { | |
181 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
182 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"), | |
183 | }, | |
184 | }, | |
b4ff99b6 DT |
185 | { |
186 | .ident = "Fujitsu Lifebook S6230", | |
187 | .matches = { | |
188 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
189 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"), | |
190 | }, | |
191 | }, | |
1da177e4 LT |
192 | { |
193 | .ident = "Fujitsu T70H", | |
194 | .matches = { | |
195 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
196 | DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"), | |
197 | }, | |
198 | }, | |
20f07944 VP |
199 | { |
200 | .ident = "Fujitsu-Siemens Lifebook T3010", | |
201 | .matches = { | |
202 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | |
203 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"), | |
204 | }, | |
205 | }, | |
7545c24c DT |
206 | { |
207 | .ident = "Fujitsu-Siemens Lifebook E4010", | |
208 | .matches = { | |
209 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | |
210 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"), | |
211 | }, | |
212 | }, | |
3f79b1e9 JK |
213 | { |
214 | .ident = "Fujitsu-Siemens Amilo Pro 2010", | |
215 | .matches = { | |
216 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | |
217 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"), | |
218 | }, | |
219 | }, | |
efd51846 JK |
220 | { |
221 | .ident = "Fujitsu-Siemens Amilo Pro 2030", | |
222 | .matches = { | |
223 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | |
224 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"), | |
225 | }, | |
226 | }, | |
cc8310e3 DT |
227 | { |
228 | /* | |
229 | * No data is coming from the touchscreen unless KBC | |
230 | * is in legacy mode. | |
231 | */ | |
232 | .ident = "Panasonic CF-29", | |
233 | .matches = { | |
234 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), | |
235 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), | |
236 | }, | |
237 | }, | |
6e782584 DT |
238 | { |
239 | /* | |
240 | * Errors on MUX ports are reported without raising AUXDATA | |
241 | * causing "spurious NAK" messages. | |
242 | */ | |
243 | .ident = "HP Pavilion DV4017EA", | |
244 | .matches = { | |
245 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | |
246 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"), | |
247 | }, | |
248 | }, | |
9d9d50bb DT |
249 | { |
250 | /* | |
251 | * Like DV4017EA does not raise AUXERR for errors on MUX ports. | |
252 | */ | |
253 | .ident = "HP Pavilion ZT1000", | |
254 | .matches = { | |
255 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | |
256 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"), | |
257 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"), | |
258 | }, | |
259 | }, | |
749aea73 EP |
260 | { |
261 | /* | |
262 | * Like DV4017EA does not raise AUXERR for errors on MUX ports. | |
263 | */ | |
264 | .ident = "HP Pavilion DV4270ca", | |
265 | .matches = { | |
266 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | |
267 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"), | |
268 | }, | |
269 | }, | |
59311de3 DT |
270 | { |
271 | .ident = "Toshiba P10", | |
272 | .matches = { | |
273 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | |
274 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), | |
275 | }, | |
276 | }, | |
a91eaa16 DT |
277 | { |
278 | .ident = "Toshiba Equium A110", | |
279 | .matches = { | |
280 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | |
281 | DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"), | |
282 | }, | |
283 | }, | |
865190cd DT |
284 | { |
285 | .ident = "Alienware Sentia", | |
286 | .matches = { | |
287 | DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), | |
288 | DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), | |
289 | }, | |
290 | }, | |
4eb38ac0 DT |
291 | { |
292 | .ident = "Sharp Actius MM20", | |
293 | .matches = { | |
294 | DMI_MATCH(DMI_SYS_VENDOR, "SHARP"), | |
295 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"), | |
296 | }, | |
297 | }, | |
3dd01a83 VP |
298 | { |
299 | .ident = "Sony Vaio FS-115b", | |
300 | .matches = { | |
301 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | |
302 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"), | |
303 | }, | |
304 | }, | |
e2df452b CH |
305 | { |
306 | .ident = "Amoi M636/A737", | |
307 | .matches = { | |
308 | DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."), | |
309 | DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"), | |
310 | }, | |
311 | }, | |
2a2dcd65 JK |
312 | { |
313 | .ident = "Lenovo 3000 n100", | |
314 | .matches = { | |
315 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
9ce1ca28 | 316 | DMI_MATCH(DMI_PRODUCT_NAME, "076804U"), |
2a2dcd65 JK |
317 | }, |
318 | }, | |
0376bce7 JK |
319 | { |
320 | .ident = "Acer Aspire 1360", | |
321 | .matches = { | |
322 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
323 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"), | |
324 | }, | |
325 | }, | |
5b5b43d0 JK |
326 | { |
327 | .ident = "Gericom Bellagio", | |
328 | .matches = { | |
329 | DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), | |
330 | DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"), | |
331 | }, | |
332 | }, | |
5bd8a05e CM |
333 | { |
334 | .ident = "IBM 2656", | |
335 | .matches = { | |
336 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | |
337 | DMI_MATCH(DMI_PRODUCT_NAME, "2656"), | |
338 | }, | |
339 | }, | |
1da177e4 LT |
340 | { } |
341 | }; | |
342 | ||
c3a34f43 JK |
343 | #ifdef CONFIG_PNP |
344 | static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = { | |
345 | { | |
346 | .ident = "Intel MBO Desktop D845PESV", | |
347 | .matches = { | |
348 | DMI_MATCH(DMI_BOARD_NAME, "D845PESV"), | |
349 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), | |
350 | }, | |
351 | }, | |
352 | { } | |
353 | }; | |
1da177e4 LT |
354 | #endif |
355 | ||
8987fec0 CC |
356 | /* |
357 | * Some Wistron based laptops need us to explicitly enable the 'Dritek | |
358 | * keyboard extension' to make their extra keys start generating scancodes. | |
359 | * Originally, this was just confined to older laptops, but a few Acer laptops | |
360 | * have turned up in 2007 that also need this again. | |
361 | */ | |
362 | static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { | |
363 | { | |
364 | .ident = "Acer Aspire 5630", | |
365 | .matches = { | |
366 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
367 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"), | |
368 | }, | |
369 | }, | |
370 | { | |
371 | .ident = "Acer Aspire 5650", | |
372 | .matches = { | |
373 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
374 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"), | |
375 | }, | |
376 | }, | |
377 | { | |
378 | .ident = "Acer Aspire 5680", | |
379 | .matches = { | |
380 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
381 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"), | |
382 | }, | |
383 | }, | |
0e7e92fa CC |
384 | { |
385 | .ident = "Acer Aspire 5720", | |
386 | .matches = { | |
387 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
388 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"), | |
389 | }, | |
390 | }, | |
5799ddb5 CC |
391 | { |
392 | .ident = "Acer Aspire 9110", | |
393 | .matches = { | |
394 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
395 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"), | |
396 | }, | |
397 | }, | |
65e660aa BP |
398 | { |
399 | .ident = "Acer TravelMate 660", | |
400 | .matches = { | |
401 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
402 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"), | |
403 | }, | |
404 | }, | |
8987fec0 CC |
405 | { |
406 | .ident = "Acer TravelMate 2490", | |
407 | .matches = { | |
408 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
409 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"), | |
410 | }, | |
411 | }, | |
8e4ae101 CC |
412 | { |
413 | .ident = "Acer TravelMate 4280", | |
414 | .matches = { | |
415 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
416 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"), | |
417 | }, | |
418 | }, | |
8987fec0 CC |
419 | { } |
420 | }; | |
421 | ||
422 | #endif /* CONFIG_X86 */ | |
423 | ||
1da177e4 LT |
424 | #ifdef CONFIG_PNP |
425 | #include <linux/pnp.h> | |
426 | ||
427 | static int i8042_pnp_kbd_registered; | |
2bfc3c6e | 428 | static unsigned int i8042_pnp_kbd_devices; |
1da177e4 | 429 | static int i8042_pnp_aux_registered; |
2bfc3c6e | 430 | static unsigned int i8042_pnp_aux_devices; |
1da177e4 LT |
431 | |
432 | static int i8042_pnp_command_reg; | |
433 | static int i8042_pnp_data_reg; | |
434 | static int i8042_pnp_kbd_irq; | |
435 | static int i8042_pnp_aux_irq; | |
436 | ||
437 | static char i8042_pnp_kbd_name[32]; | |
438 | static char i8042_pnp_aux_name[32]; | |
439 | ||
440 | static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did) | |
441 | { | |
442 | if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1) | |
443 | i8042_pnp_data_reg = pnp_port_start(dev,0); | |
444 | ||
445 | if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1) | |
446 | i8042_pnp_command_reg = pnp_port_start(dev, 1); | |
447 | ||
448 | if (pnp_irq_valid(dev,0)) | |
449 | i8042_pnp_kbd_irq = pnp_irq(dev, 0); | |
450 | ||
8c6deb9c | 451 | strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name)); |
1da177e4 | 452 | if (strlen(pnp_dev_name(dev))) { |
8c6deb9c RK |
453 | strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name)); |
454 | strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name)); | |
1da177e4 LT |
455 | } |
456 | ||
2bfc3c6e | 457 | i8042_pnp_kbd_devices++; |
1da177e4 LT |
458 | return 0; |
459 | } | |
460 | ||
461 | static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did) | |
462 | { | |
463 | if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1) | |
464 | i8042_pnp_data_reg = pnp_port_start(dev,0); | |
465 | ||
466 | if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1) | |
467 | i8042_pnp_command_reg = pnp_port_start(dev, 1); | |
468 | ||
469 | if (pnp_irq_valid(dev, 0)) | |
470 | i8042_pnp_aux_irq = pnp_irq(dev, 0); | |
471 | ||
8c6deb9c | 472 | strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name)); |
1da177e4 | 473 | if (strlen(pnp_dev_name(dev))) { |
8c6deb9c RK |
474 | strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name)); |
475 | strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name)); | |
1da177e4 LT |
476 | } |
477 | ||
2bfc3c6e | 478 | i8042_pnp_aux_devices++; |
1da177e4 LT |
479 | return 0; |
480 | } | |
481 | ||
482 | static struct pnp_device_id pnp_kbd_devids[] = { | |
483 | { .id = "PNP0303", .driver_data = 0 }, | |
484 | { .id = "PNP030b", .driver_data = 0 }, | |
485 | { .id = "", }, | |
486 | }; | |
487 | ||
488 | static struct pnp_driver i8042_pnp_kbd_driver = { | |
489 | .name = "i8042 kbd", | |
490 | .id_table = pnp_kbd_devids, | |
491 | .probe = i8042_pnp_kbd_probe, | |
492 | }; | |
493 | ||
494 | static struct pnp_device_id pnp_aux_devids[] = { | |
b9973954 DT |
495 | { .id = "FJC6000", .driver_data = 0 }, |
496 | { .id = "FJC6001", .driver_data = 0 }, | |
1da177e4 LT |
497 | { .id = "PNP0f03", .driver_data = 0 }, |
498 | { .id = "PNP0f0b", .driver_data = 0 }, | |
499 | { .id = "PNP0f0e", .driver_data = 0 }, | |
500 | { .id = "PNP0f12", .driver_data = 0 }, | |
501 | { .id = "PNP0f13", .driver_data = 0 }, | |
502 | { .id = "PNP0f19", .driver_data = 0 }, | |
503 | { .id = "PNP0f1c", .driver_data = 0 }, | |
504 | { .id = "SYN0801", .driver_data = 0 }, | |
505 | { .id = "", }, | |
506 | }; | |
507 | ||
508 | static struct pnp_driver i8042_pnp_aux_driver = { | |
509 | .name = "i8042 aux", | |
510 | .id_table = pnp_aux_devids, | |
511 | .probe = i8042_pnp_aux_probe, | |
512 | }; | |
513 | ||
514 | static void i8042_pnp_exit(void) | |
515 | { | |
74af42bb KG |
516 | if (i8042_pnp_kbd_registered) { |
517 | i8042_pnp_kbd_registered = 0; | |
1da177e4 | 518 | pnp_unregister_driver(&i8042_pnp_kbd_driver); |
74af42bb | 519 | } |
1da177e4 | 520 | |
74af42bb KG |
521 | if (i8042_pnp_aux_registered) { |
522 | i8042_pnp_aux_registered = 0; | |
1da177e4 | 523 | pnp_unregister_driver(&i8042_pnp_aux_driver); |
74af42bb | 524 | } |
1da177e4 LT |
525 | } |
526 | ||
8d5987a6 | 527 | static int __init i8042_pnp_init(void) |
1da177e4 | 528 | { |
c3d31e7f | 529 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; |
080c652d | 530 | int pnp_data_busted = 0; |
2bfc3c6e | 531 | int err; |
1da177e4 | 532 | |
c3a34f43 JK |
533 | #ifdef CONFIG_X86 |
534 | if (dmi_check_system(i8042_dmi_nopnp_table)) | |
535 | i8042_nopnp = 1; | |
536 | #endif | |
537 | ||
1da177e4 | 538 | if (i8042_nopnp) { |
39fa5800 | 539 | printk(KERN_INFO "i8042: PNP detection disabled\n"); |
1da177e4 LT |
540 | return 0; |
541 | } | |
542 | ||
2bfc3c6e BH |
543 | err = pnp_register_driver(&i8042_pnp_kbd_driver); |
544 | if (!err) | |
1da177e4 | 545 | i8042_pnp_kbd_registered = 1; |
c3d31e7f | 546 | |
2bfc3c6e BH |
547 | err = pnp_register_driver(&i8042_pnp_aux_driver); |
548 | if (!err) | |
1da177e4 LT |
549 | i8042_pnp_aux_registered = 1; |
550 | ||
2bfc3c6e | 551 | if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) { |
1da177e4 LT |
552 | i8042_pnp_exit(); |
553 | #if defined(__ia64__) | |
554 | return -ENODEV; | |
555 | #else | |
5a72afc0 | 556 | printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n"); |
1da177e4 LT |
557 | return 0; |
558 | #endif | |
559 | } | |
560 | ||
2bfc3c6e | 561 | if (i8042_pnp_kbd_devices) |
c3d31e7f DT |
562 | snprintf(kbd_irq_str, sizeof(kbd_irq_str), |
563 | "%d", i8042_pnp_kbd_irq); | |
2bfc3c6e | 564 | if (i8042_pnp_aux_devices) |
c3d31e7f DT |
565 | snprintf(aux_irq_str, sizeof(aux_irq_str), |
566 | "%d", i8042_pnp_aux_irq); | |
567 | ||
568 | printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n", | |
2bfc3c6e | 569 | i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "", |
c3d31e7f DT |
570 | i8042_pnp_aux_name, |
571 | i8042_pnp_data_reg, i8042_pnp_command_reg, | |
2bfc3c6e | 572 | kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "", |
c3d31e7f DT |
573 | aux_irq_str); |
574 | ||
575 | #if defined(__ia64__) | |
2bfc3c6e | 576 | if (!i8042_pnp_kbd_devices) |
945ef0d4 | 577 | i8042_nokbd = 1; |
2bfc3c6e | 578 | if (!i8042_pnp_aux_devices) |
c3d31e7f DT |
579 | i8042_noaux = 1; |
580 | #endif | |
581 | ||
1da177e4 | 582 | if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && |
080c652d DT |
583 | i8042_pnp_data_reg != i8042_data_reg) || |
584 | !i8042_pnp_data_reg) { | |
585 | printk(KERN_WARNING | |
586 | "PNP: PS/2 controller has invalid data port %#x; " | |
587 | "using default %#x\n", | |
1da177e4 LT |
588 | i8042_pnp_data_reg, i8042_data_reg); |
589 | i8042_pnp_data_reg = i8042_data_reg; | |
080c652d | 590 | pnp_data_busted = 1; |
1da177e4 LT |
591 | } |
592 | ||
593 | if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) && | |
080c652d DT |
594 | i8042_pnp_command_reg != i8042_command_reg) || |
595 | !i8042_pnp_command_reg) { | |
596 | printk(KERN_WARNING | |
597 | "PNP: PS/2 controller has invalid command port %#x; " | |
598 | "using default %#x\n", | |
1da177e4 LT |
599 | i8042_pnp_command_reg, i8042_command_reg); |
600 | i8042_pnp_command_reg = i8042_command_reg; | |
080c652d | 601 | pnp_data_busted = 1; |
1da177e4 LT |
602 | } |
603 | ||
945ef0d4 | 604 | if (!i8042_nokbd && !i8042_pnp_kbd_irq) { |
080c652d DT |
605 | printk(KERN_WARNING |
606 | "PNP: PS/2 controller doesn't have KBD irq; " | |
607 | "using default %d\n", i8042_kbd_irq); | |
1da177e4 | 608 | i8042_pnp_kbd_irq = i8042_kbd_irq; |
080c652d | 609 | pnp_data_busted = 1; |
1da177e4 LT |
610 | } |
611 | ||
c3d31e7f | 612 | if (!i8042_noaux && !i8042_pnp_aux_irq) { |
080c652d DT |
613 | if (!pnp_data_busted && i8042_pnp_kbd_irq) { |
614 | printk(KERN_WARNING | |
615 | "PNP: PS/2 appears to have AUX port disabled, " | |
616 | "if this is incorrect please boot with " | |
617 | "i8042.nopnp\n"); | |
618 | i8042_noaux = 1; | |
619 | } else { | |
620 | printk(KERN_WARNING | |
621 | "PNP: PS/2 controller doesn't have AUX irq; " | |
622 | "using default %d\n", i8042_aux_irq); | |
623 | i8042_pnp_aux_irq = i8042_aux_irq; | |
624 | } | |
1da177e4 LT |
625 | } |
626 | ||
1da177e4 LT |
627 | i8042_data_reg = i8042_pnp_data_reg; |
628 | i8042_command_reg = i8042_pnp_command_reg; | |
629 | i8042_kbd_irq = i8042_pnp_kbd_irq; | |
630 | i8042_aux_irq = i8042_pnp_aux_irq; | |
631 | ||
1da177e4 LT |
632 | return 0; |
633 | } | |
634 | ||
8d5987a6 DT |
635 | #else |
636 | static inline int i8042_pnp_init(void) { return 0; } | |
637 | static inline void i8042_pnp_exit(void) { } | |
1da177e4 LT |
638 | #endif |
639 | ||
8d5987a6 | 640 | static int __init i8042_platform_init(void) |
1da177e4 | 641 | { |
8d5987a6 DT |
642 | int retval; |
643 | ||
1da177e4 LT |
644 | /* |
645 | * On ix86 platforms touching the i8042 data register region can do really | |
646 | * bad things. Because of this the region is always reserved on ix86 boxes. | |
647 | * | |
648 | * if (!request_region(I8042_DATA_REG, 16, "i8042")) | |
8d5987a6 | 649 | * return -EBUSY; |
1da177e4 LT |
650 | */ |
651 | ||
652 | i8042_kbd_irq = I8042_MAP_IRQ(1); | |
653 | i8042_aux_irq = I8042_MAP_IRQ(12); | |
654 | ||
8d5987a6 DT |
655 | retval = i8042_pnp_init(); |
656 | if (retval) | |
657 | return retval; | |
1da177e4 LT |
658 | |
659 | #if defined(__ia64__) | |
660 | i8042_reset = 1; | |
661 | #endif | |
662 | ||
c3a34f43 | 663 | #ifdef CONFIG_X86 |
1da177e4 LT |
664 | if (dmi_check_system(i8042_dmi_noloop_table)) |
665 | i8042_noloop = 1; | |
666 | ||
667 | if (dmi_check_system(i8042_dmi_nomux_table)) | |
668 | i8042_nomux = 1; | |
1da177e4 | 669 | |
8987fec0 CC |
670 | if (dmi_check_system(i8042_dmi_dritek_table)) |
671 | i8042_dritek = 1; | |
672 | #endif /* CONFIG_X86 */ | |
673 | ||
8d5987a6 | 674 | return retval; |
1da177e4 LT |
675 | } |
676 | ||
677 | static inline void i8042_platform_exit(void) | |
678 | { | |
1da177e4 | 679 | i8042_pnp_exit(); |
1da177e4 LT |
680 | } |
681 | ||
682 | #endif /* _I8042_X86IA64IO_H */ |