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