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