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