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