DMI: allow omitting ident strings in DMI tables
[linux-2.6-block.git] / drivers / input / serio / i8042-x86ia64io.h
CommitLineData
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
31static int i8042_kbd_irq;
32static 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
42static int i8042_command_reg = 0x64;
43static int i8042_data_reg = 0x60;
44
45
46static inline int i8042_read_data(void)
47{
48 return inb(I8042_DATA_REG);
49}
50
51static inline int i8042_read_status(void)
52{
53 return inb(I8042_STATUS_REG);
54}
55
56static inline void i8042_write_data(int val)
57{
58 outb(val, I8042_DATA_REG);
59}
60
61static 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
70static 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 },
685aaca7
JP
80 {
81 .ident = "ASUS G1S",
82 .matches = {
83 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
84 DMI_MATCH(DMI_BOARD_NAME, "G1S"),
85 DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
86 },
87 },
90245c17
DT
88 {
89 /* AUX LOOP command does not raise AUX IRQ */
90 .ident = "ASUS P65UP5",
91 .matches = {
92 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
93 DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
94 DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
95 },
96 },
1da177e4
LT
97 {
98 .ident = "Compaq Proliant 8500",
99 .matches = {
100 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
101 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
102 DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
103 },
104 },
105 {
106 .ident = "Compaq Proliant DL760",
107 .matches = {
108 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
109 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
110 DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
111 },
112 },
6020bafc
BC
113 {
114 .ident = "OQO Model 01",
115 .matches = {
116 DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
117 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
118 DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
119 },
120 },
8c4df74e
DT
121 {
122 /* AUX LOOP does not work properly */
123 .ident = "ULI EV4873",
124 .matches = {
125 DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
126 DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
127 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
128 },
129 },
8bf4215e
JK
130 {
131 .ident = "Microsoft Virtual Machine",
132 .matches = {
133 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
134 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
135 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
136 },
137 },
89cdb8ce
DT
138 {
139 .ident = "Medion MAM 2070",
140 .matches = {
141 DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
142 DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
143 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
144 },
145 },
2c6f2cb8
SB
146 {
147 .ident = "Blue FB5601",
148 .matches = {
149 DMI_MATCH(DMI_SYS_VENDOR, "blue"),
150 DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
151 DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
152 },
153 },
a6f66ddf
154 {
155 .ident = "Gigabyte M912",
156 .matches = {
157 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
158 DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
159 DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
160 },
161 },
59cc1dd9
DT
162 {
163 .ident = "HP DV9700",
164 .matches = {
165 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
166 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
167 DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
168 },
169 },
1da177e4
LT
170 { }
171};
172
173/*
59311de3 174 * Some Fujitsu notebooks are having trouble with touchpads if
1da177e4
LT
175 * active multiplexing mode is activated. Luckily they don't have
176 * external PS/2 ports so we can safely disable it.
59311de3
DT
177 * ... apparently some Toshibas don't like MUX mode either and
178 * die horrible death on reboot.
1da177e4
LT
179 */
180static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
181 {
182 .ident = "Fujitsu Lifebook P7010/P7010D",
183 .matches = {
184 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
185 DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
186 },
187 },
bb06ec3c
DT
188 {
189 .ident = "Fujitsu Lifebook P7010",
190 .matches = {
191 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
192 DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
193 },
194 },
1da177e4
LT
195 {
196 .ident = "Fujitsu Lifebook P5020D",
197 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
199 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
200 },
201 },
202 {
203 .ident = "Fujitsu Lifebook S2000",
204 .matches = {
205 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
206 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
207 },
208 },
b4ff99b6
DT
209 {
210 .ident = "Fujitsu Lifebook S6230",
211 .matches = {
212 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
213 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
214 },
215 },
1da177e4
LT
216 {
217 .ident = "Fujitsu T70H",
218 .matches = {
219 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
220 DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
221 },
222 },
20f07944
VP
223 {
224 .ident = "Fujitsu-Siemens Lifebook T3010",
225 .matches = {
226 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
227 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
228 },
229 },
7545c24c
DT
230 {
231 .ident = "Fujitsu-Siemens Lifebook E4010",
232 .matches = {
233 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
234 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
235 },
236 },
3f79b1e9
JK
237 {
238 .ident = "Fujitsu-Siemens Amilo Pro 2010",
239 .matches = {
240 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
241 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
242 },
243 },
efd51846
JK
244 {
245 .ident = "Fujitsu-Siemens Amilo Pro 2030",
246 .matches = {
247 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
248 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
249 },
250 },
cc8310e3
DT
251 {
252 /*
253 * No data is coming from the touchscreen unless KBC
254 * is in legacy mode.
255 */
256 .ident = "Panasonic CF-29",
257 .matches = {
258 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
259 DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
260 },
261 },
6e782584
DT
262 {
263 /*
264 * Errors on MUX ports are reported without raising AUXDATA
265 * causing "spurious NAK" messages.
266 */
267 .ident = "HP Pavilion DV4017EA",
268 .matches = {
269 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
270 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
271 },
272 },
9d9d50bb
DT
273 {
274 /*
275 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
276 */
277 .ident = "HP Pavilion ZT1000",
278 .matches = {
279 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
280 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
281 DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
282 },
283 },
749aea73
EP
284 {
285 /*
286 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
287 */
288 .ident = "HP Pavilion DV4270ca",
289 .matches = {
290 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
291 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
292 },
293 },
59311de3
DT
294 {
295 .ident = "Toshiba P10",
296 .matches = {
297 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
298 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
299 },
300 },
a91eaa16
DT
301 {
302 .ident = "Toshiba Equium A110",
303 .matches = {
304 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
305 DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
306 },
307 },
865190cd
DT
308 {
309 .ident = "Alienware Sentia",
310 .matches = {
311 DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
312 DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
313 },
314 },
4eb38ac0
DT
315 {
316 .ident = "Sharp Actius MM20",
317 .matches = {
318 DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
319 DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
320 },
321 },
3dd01a83
VP
322 {
323 .ident = "Sony Vaio FS-115b",
324 .matches = {
325 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
326 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
327 },
328 },
b0225e8f
DT
329 {
330 /*
331 * Reset and GET ID commands issued via KBD port are
332 * sometimes being delivered to AUX3.
333 */
334 .ident = "Sony Vaio FZ-240E",
335 .matches = {
336 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
337 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
338 },
339 },
e2df452b
CH
340 {
341 .ident = "Amoi M636/A737",
342 .matches = {
343 DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
344 DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
345 },
346 },
2a2dcd65
JK
347 {
348 .ident = "Lenovo 3000 n100",
349 .matches = {
350 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
9ce1ca28 351 DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
2a2dcd65
JK
352 },
353 },
0376bce7
JK
354 {
355 .ident = "Acer Aspire 1360",
356 .matches = {
357 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
358 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
359 },
360 },
5b5b43d0
JK
361 {
362 .ident = "Gericom Bellagio",
363 .matches = {
364 DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
365 DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
366 },
367 },
5bd8a05e
CM
368 {
369 .ident = "IBM 2656",
370 .matches = {
371 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
372 DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
373 },
374 },
786b11cc
HRK
375 {
376 .ident = "Dell XPS M1530",
377 .matches = {
378 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
379 DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
380 },
381 },
5f4ba04f
DT
382 {
383 .ident = "Compal HEL80I",
384 .matches = {
385 DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
386 DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
387 },
388 },
9334e90d
JK
389 {
390 .ident = "Dell Vostro 1510",
391 .matches = {
392 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
393 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
394 },
395 },
ced909ff
DT
396 {
397 .ident = "Acer Aspire 5536",
398 .matches = {
399 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
400 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
401 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
402 },
403 },
1da177e4
LT
404 { }
405};
406
7c46e236
AV
407static struct dmi_system_id __initdata i8042_dmi_reset_table[] = {
408 {
409 .ident = "MSI Wind U-100",
410 .matches = {
411 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
412 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
413 },
414 },
415 {
416 .ident = "LG Electronics X110",
417 .matches = {
418 DMI_MATCH(DMI_BOARD_NAME, "X110"),
419 DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
420 },
421 },
9230ccb1
YL
422 {
423 .ident = "Acer Aspire One 150",
424 .matches = {
425 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
426 DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
427 },
428 },
429 {
430 .ident = "Advent 4211",
431 .matches = {
432 DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
433 DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
434 },
435 },
436 {
437 .ident = "Medion Akoya Mini E1210",
438 .matches = {
439 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
440 DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
441 },
442 },
443 {
444 .ident = "Mivvy M310",
445 .matches = {
446 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
447 DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
448 },
449 },
049e2d13
AA
450 {
451 .ident = "Dell Vostro 1320",
452 .matches = {
453 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
454 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
455 },
456 },
457 {
458 .ident = "Dell Vostro 1520",
459 .matches = {
460 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
461 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
462 },
463 },
464 {
465 .ident = "Dell Vostro 1720",
466 .matches = {
467 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
468 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
469 },
470 },
7c46e236
AV
471 { }
472};
473
c3a34f43
JK
474#ifdef CONFIG_PNP
475static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
476 {
477 .ident = "Intel MBO Desktop D845PESV",
478 .matches = {
479 DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
480 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
481 },
482 },
7c46e236
AV
483 {
484 .ident = "MSI Wind U-100",
485 .matches = {
486 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
487 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
488 },
489 },
c3a34f43
JK
490 { }
491};
1c7827ae
DT
492
493static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
494 {
495 .ident = "Portable",
496 .matches = {
497 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
498 },
499 },
500 {
501 .ident = "Laptop",
502 .matches = {
503 DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
504 },
505 },
506 {
507 .ident = "Notebook",
508 .matches = {
509 DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
510 },
511 },
512 {
513 .ident = "Sub-Notebook",
514 .matches = {
515 DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
516 },
517 },
518 { }
519};
1da177e4
LT
520#endif
521
8987fec0
CC
522/*
523 * Some Wistron based laptops need us to explicitly enable the 'Dritek
524 * keyboard extension' to make their extra keys start generating scancodes.
525 * Originally, this was just confined to older laptops, but a few Acer laptops
526 * have turned up in 2007 that also need this again.
527 */
528static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
529 {
530 .ident = "Acer Aspire 5630",
531 .matches = {
532 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
533 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
534 },
535 },
536 {
537 .ident = "Acer Aspire 5650",
538 .matches = {
539 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
540 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
541 },
542 },
543 {
544 .ident = "Acer Aspire 5680",
545 .matches = {
546 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
547 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
548 },
549 },
0e7e92fa
CC
550 {
551 .ident = "Acer Aspire 5720",
552 .matches = {
553 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
554 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
555 },
556 },
5799ddb5
CC
557 {
558 .ident = "Acer Aspire 9110",
559 .matches = {
560 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
561 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
562 },
563 },
65e660aa
BP
564 {
565 .ident = "Acer TravelMate 660",
566 .matches = {
567 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
568 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
569 },
570 },
8987fec0
CC
571 {
572 .ident = "Acer TravelMate 2490",
573 .matches = {
574 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
575 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
576 },
577 },
8e4ae101
CC
578 {
579 .ident = "Acer TravelMate 4280",
580 .matches = {
581 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
582 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
583 },
584 },
8987fec0
CC
585 { }
586};
587
588#endif /* CONFIG_X86 */
589
1da177e4
LT
590#ifdef CONFIG_PNP
591#include <linux/pnp.h>
592
386b3849 593static bool i8042_pnp_kbd_registered;
2bfc3c6e 594static unsigned int i8042_pnp_kbd_devices;
386b3849 595static bool i8042_pnp_aux_registered;
2bfc3c6e 596static unsigned int i8042_pnp_aux_devices;
1da177e4
LT
597
598static int i8042_pnp_command_reg;
599static int i8042_pnp_data_reg;
600static int i8042_pnp_kbd_irq;
601static int i8042_pnp_aux_irq;
602
603static char i8042_pnp_kbd_name[32];
604static char i8042_pnp_aux_name[32];
605
606static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
607{
608 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
609 i8042_pnp_data_reg = pnp_port_start(dev,0);
610
611 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
612 i8042_pnp_command_reg = pnp_port_start(dev, 1);
613
614 if (pnp_irq_valid(dev,0))
615 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
616
8c6deb9c 617 strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
1da177e4 618 if (strlen(pnp_dev_name(dev))) {
8c6deb9c
RK
619 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
620 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
1da177e4
LT
621 }
622
2bfc3c6e 623 i8042_pnp_kbd_devices++;
1da177e4
LT
624 return 0;
625}
626
627static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
628{
629 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
630 i8042_pnp_data_reg = pnp_port_start(dev,0);
631
632 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
633 i8042_pnp_command_reg = pnp_port_start(dev, 1);
634
635 if (pnp_irq_valid(dev, 0))
636 i8042_pnp_aux_irq = pnp_irq(dev, 0);
637
8c6deb9c 638 strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
1da177e4 639 if (strlen(pnp_dev_name(dev))) {
8c6deb9c
RK
640 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
641 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
1da177e4
LT
642 }
643
2bfc3c6e 644 i8042_pnp_aux_devices++;
1da177e4
LT
645 return 0;
646}
647
648static struct pnp_device_id pnp_kbd_devids[] = {
649 { .id = "PNP0303", .driver_data = 0 },
650 { .id = "PNP030b", .driver_data = 0 },
651 { .id = "", },
652};
653
654static struct pnp_driver i8042_pnp_kbd_driver = {
655 .name = "i8042 kbd",
656 .id_table = pnp_kbd_devids,
657 .probe = i8042_pnp_kbd_probe,
658};
659
660static struct pnp_device_id pnp_aux_devids[] = {
b9973954
DT
661 { .id = "FJC6000", .driver_data = 0 },
662 { .id = "FJC6001", .driver_data = 0 },
1da177e4
LT
663 { .id = "PNP0f03", .driver_data = 0 },
664 { .id = "PNP0f0b", .driver_data = 0 },
665 { .id = "PNP0f0e", .driver_data = 0 },
666 { .id = "PNP0f12", .driver_data = 0 },
667 { .id = "PNP0f13", .driver_data = 0 },
668 { .id = "PNP0f19", .driver_data = 0 },
669 { .id = "PNP0f1c", .driver_data = 0 },
670 { .id = "SYN0801", .driver_data = 0 },
671 { .id = "", },
672};
673
674static struct pnp_driver i8042_pnp_aux_driver = {
675 .name = "i8042 aux",
676 .id_table = pnp_aux_devids,
677 .probe = i8042_pnp_aux_probe,
678};
679
680static void i8042_pnp_exit(void)
681{
74af42bb 682 if (i8042_pnp_kbd_registered) {
386b3849 683 i8042_pnp_kbd_registered = false;
1da177e4 684 pnp_unregister_driver(&i8042_pnp_kbd_driver);
74af42bb 685 }
1da177e4 686
74af42bb 687 if (i8042_pnp_aux_registered) {
386b3849 688 i8042_pnp_aux_registered = false;
1da177e4 689 pnp_unregister_driver(&i8042_pnp_aux_driver);
74af42bb 690 }
1da177e4
LT
691}
692
8d5987a6 693static int __init i8042_pnp_init(void)
1da177e4 694{
c3d31e7f 695 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
7dcc9c23 696 bool pnp_data_busted = false;
2bfc3c6e 697 int err;
1da177e4 698
c3a34f43
JK
699#ifdef CONFIG_X86
700 if (dmi_check_system(i8042_dmi_nopnp_table))
386b3849 701 i8042_nopnp = true;
c3a34f43
JK
702#endif
703
1da177e4 704 if (i8042_nopnp) {
39fa5800 705 printk(KERN_INFO "i8042: PNP detection disabled\n");
1da177e4
LT
706 return 0;
707 }
708
2bfc3c6e
BH
709 err = pnp_register_driver(&i8042_pnp_kbd_driver);
710 if (!err)
386b3849 711 i8042_pnp_kbd_registered = true;
c3d31e7f 712
2bfc3c6e
BH
713 err = pnp_register_driver(&i8042_pnp_aux_driver);
714 if (!err)
386b3849 715 i8042_pnp_aux_registered = true;
1da177e4 716
2bfc3c6e 717 if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
1da177e4
LT
718 i8042_pnp_exit();
719#if defined(__ia64__)
720 return -ENODEV;
721#else
5a72afc0 722 printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
1da177e4
LT
723 return 0;
724#endif
725 }
726
2bfc3c6e 727 if (i8042_pnp_kbd_devices)
c3d31e7f
DT
728 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
729 "%d", i8042_pnp_kbd_irq);
2bfc3c6e 730 if (i8042_pnp_aux_devices)
c3d31e7f
DT
731 snprintf(aux_irq_str, sizeof(aux_irq_str),
732 "%d", i8042_pnp_aux_irq);
733
734 printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
2bfc3c6e 735 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
c3d31e7f
DT
736 i8042_pnp_aux_name,
737 i8042_pnp_data_reg, i8042_pnp_command_reg,
2bfc3c6e 738 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
c3d31e7f
DT
739 aux_irq_str);
740
741#if defined(__ia64__)
2bfc3c6e 742 if (!i8042_pnp_kbd_devices)
386b3849 743 i8042_nokbd = true;
2bfc3c6e 744 if (!i8042_pnp_aux_devices)
386b3849 745 i8042_noaux = true;
c3d31e7f
DT
746#endif
747
1da177e4 748 if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
080c652d
DT
749 i8042_pnp_data_reg != i8042_data_reg) ||
750 !i8042_pnp_data_reg) {
751 printk(KERN_WARNING
752 "PNP: PS/2 controller has invalid data port %#x; "
753 "using default %#x\n",
1da177e4
LT
754 i8042_pnp_data_reg, i8042_data_reg);
755 i8042_pnp_data_reg = i8042_data_reg;
386b3849 756 pnp_data_busted = true;
1da177e4
LT
757 }
758
759 if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
080c652d
DT
760 i8042_pnp_command_reg != i8042_command_reg) ||
761 !i8042_pnp_command_reg) {
762 printk(KERN_WARNING
763 "PNP: PS/2 controller has invalid command port %#x; "
764 "using default %#x\n",
1da177e4
LT
765 i8042_pnp_command_reg, i8042_command_reg);
766 i8042_pnp_command_reg = i8042_command_reg;
386b3849 767 pnp_data_busted = true;
1da177e4
LT
768 }
769
945ef0d4 770 if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
080c652d
DT
771 printk(KERN_WARNING
772 "PNP: PS/2 controller doesn't have KBD irq; "
773 "using default %d\n", i8042_kbd_irq);
1da177e4 774 i8042_pnp_kbd_irq = i8042_kbd_irq;
386b3849 775 pnp_data_busted = true;
1da177e4
LT
776 }
777
c3d31e7f 778 if (!i8042_noaux && !i8042_pnp_aux_irq) {
080c652d
DT
779 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
780 printk(KERN_WARNING
781 "PNP: PS/2 appears to have AUX port disabled, "
782 "if this is incorrect please boot with "
783 "i8042.nopnp\n");
386b3849 784 i8042_noaux = true;
080c652d
DT
785 } else {
786 printk(KERN_WARNING
787 "PNP: PS/2 controller doesn't have AUX irq; "
788 "using default %d\n", i8042_aux_irq);
789 i8042_pnp_aux_irq = i8042_aux_irq;
790 }
1da177e4
LT
791 }
792
1da177e4
LT
793 i8042_data_reg = i8042_pnp_data_reg;
794 i8042_command_reg = i8042_pnp_command_reg;
795 i8042_kbd_irq = i8042_pnp_kbd_irq;
796 i8042_aux_irq = i8042_pnp_aux_irq;
797
1c7827ae
DT
798#ifdef CONFIG_X86
799 i8042_bypass_aux_irq_test = !pnp_data_busted &&
800 dmi_check_system(i8042_dmi_laptop_table);
801#endif
802
1da177e4
LT
803 return 0;
804}
805
8d5987a6
DT
806#else
807static inline int i8042_pnp_init(void) { return 0; }
808static inline void i8042_pnp_exit(void) { }
1da177e4
LT
809#endif
810
8d5987a6 811static int __init i8042_platform_init(void)
1da177e4 812{
8d5987a6
DT
813 int retval;
814
1da177e4
LT
815/*
816 * On ix86 platforms touching the i8042 data register region can do really
817 * bad things. Because of this the region is always reserved on ix86 boxes.
818 *
819 * if (!request_region(I8042_DATA_REG, 16, "i8042"))
8d5987a6 820 * return -EBUSY;
1da177e4
LT
821 */
822
823 i8042_kbd_irq = I8042_MAP_IRQ(1);
824 i8042_aux_irq = I8042_MAP_IRQ(12);
825
8d5987a6
DT
826 retval = i8042_pnp_init();
827 if (retval)
828 return retval;
1da177e4
LT
829
830#if defined(__ia64__)
386b3849 831 i8042_reset = true;
1da177e4
LT
832#endif
833
c3a34f43 834#ifdef CONFIG_X86
7c46e236 835 if (dmi_check_system(i8042_dmi_reset_table))
386b3849 836 i8042_reset = true;
7c46e236 837
1da177e4 838 if (dmi_check_system(i8042_dmi_noloop_table))
386b3849 839 i8042_noloop = true;
1da177e4
LT
840
841 if (dmi_check_system(i8042_dmi_nomux_table))
386b3849 842 i8042_nomux = true;
1da177e4 843
8987fec0 844 if (dmi_check_system(i8042_dmi_dritek_table))
386b3849 845 i8042_dritek = true;
8987fec0
CC
846#endif /* CONFIG_X86 */
847
8d5987a6 848 return retval;
1da177e4
LT
849}
850
851static inline void i8042_platform_exit(void)
852{
1da177e4 853 i8042_pnp_exit();
1da177e4
LT
854}
855
856#endif /* _I8042_X86IA64IO_H */