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