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