1 #ifndef _I8042_X86IA64IO_H
2 #define _I8042_X86IA64IO_H
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.
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"
23 # define I8042_MAP_IRQ(x) isa_irq_to_vector((x))
25 # define I8042_MAP_IRQ(x) (x)
28 #define I8042_KBD_IRQ i8042_kbd_irq
29 #define I8042_AUX_IRQ i8042_aux_irq
31 static int i8042_kbd_irq
;
32 static int i8042_aux_irq
;
38 #define I8042_COMMAND_REG i8042_command_reg
39 #define I8042_STATUS_REG i8042_command_reg
40 #define I8042_DATA_REG i8042_data_reg
42 static int i8042_command_reg
= 0x64;
43 static int i8042_data_reg
= 0x60;
46 static inline int i8042_read_data(void)
48 return inb(I8042_DATA_REG
);
51 static inline int i8042_read_status(void)
53 return inb(I8042_STATUS_REG
);
56 static inline void i8042_write_data(int val
)
58 outb(val
, I8042_DATA_REG
);
61 static inline void i8042_write_command(int val
)
63 outb(val
, I8042_COMMAND_REG
);
66 #if defined(__i386__) || defined(__x86_64__)
68 #include <linux/dmi.h>
70 static struct dmi_system_id __initdata i8042_dmi_noloop_table
[] = {
72 /* AUX LOOP command does not raise AUX IRQ */
73 .ident
= "ASUS P65UP5",
75 DMI_MATCH(DMI_BOARD_VENDOR
, "ASUSTeK Computer INC."),
76 DMI_MATCH(DMI_BOARD_NAME
, "P/I-P65UP5"),
77 DMI_MATCH(DMI_BOARD_VERSION
, "REV 2.X"),
81 .ident
= "Compaq Proliant 8500",
83 DMI_MATCH(DMI_SYS_VENDOR
, "Compaq"),
84 DMI_MATCH(DMI_PRODUCT_NAME
, "ProLiant"),
85 DMI_MATCH(DMI_PRODUCT_VERSION
, "8500"),
89 .ident
= "Compaq Proliant DL760",
91 DMI_MATCH(DMI_SYS_VENDOR
, "Compaq"),
92 DMI_MATCH(DMI_PRODUCT_NAME
, "ProLiant"),
93 DMI_MATCH(DMI_PRODUCT_VERSION
, "DL760"),
97 .ident
= "OQO Model 01",
99 DMI_MATCH(DMI_SYS_VENDOR
, "OQO"),
100 DMI_MATCH(DMI_PRODUCT_NAME
, "ZEPTO"),
101 DMI_MATCH(DMI_PRODUCT_VERSION
, "00"),
105 /* AUX LOOP does not work properly */
106 .ident
= "ULI EV4873",
108 DMI_MATCH(DMI_SYS_VENDOR
, "ULI"),
109 DMI_MATCH(DMI_PRODUCT_NAME
, "EV4873"),
110 DMI_MATCH(DMI_PRODUCT_VERSION
, "5a"),
114 .ident
= "Microsoft Virtual Machine",
116 DMI_MATCH(DMI_SYS_VENDOR
, "Microsoft Corporation"),
117 DMI_MATCH(DMI_PRODUCT_NAME
, "Virtual Machine"),
118 DMI_MATCH(DMI_PRODUCT_VERSION
, "VS2005R2"),
125 * Some Fujitsu notebooks are having trouble with touchpads if
126 * active multiplexing mode is activated. Luckily they don't have
127 * external PS/2 ports so we can safely disable it.
128 * ... apparently some Toshibas don't like MUX mode either and
129 * die horrible death on reboot.
131 static struct dmi_system_id __initdata i8042_dmi_nomux_table
[] = {
133 .ident
= "Fujitsu Lifebook P7010/P7010D",
135 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU"),
136 DMI_MATCH(DMI_PRODUCT_NAME
, "P7010"),
140 .ident
= "Fujitsu Lifebook P7010",
142 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU SIEMENS"),
143 DMI_MATCH(DMI_PRODUCT_NAME
, "0000000000"),
147 .ident
= "Fujitsu Lifebook P5020D",
149 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU"),
150 DMI_MATCH(DMI_PRODUCT_NAME
, "LifeBook P Series"),
154 .ident
= "Fujitsu Lifebook S2000",
156 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU"),
157 DMI_MATCH(DMI_PRODUCT_NAME
, "LifeBook S Series"),
161 .ident
= "Fujitsu Lifebook S6230",
163 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU"),
164 DMI_MATCH(DMI_PRODUCT_NAME
, "LifeBook S6230"),
168 .ident
= "Fujitsu T70H",
170 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU"),
171 DMI_MATCH(DMI_PRODUCT_NAME
, "FMVLT70H"),
175 .ident
= "Fujitsu-Siemens Lifebook T3010",
177 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU SIEMENS"),
178 DMI_MATCH(DMI_PRODUCT_NAME
, "LIFEBOOK T3010"),
182 .ident
= "Fujitsu-Siemens Lifebook E4010",
184 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU SIEMENS"),
185 DMI_MATCH(DMI_PRODUCT_NAME
, "LIFEBOOK E4010"),
189 .ident
= "Fujitsu-Siemens Amilo Pro 2010",
191 DMI_MATCH(DMI_SYS_VENDOR
, "FUJITSU SIEMENS"),
192 DMI_MATCH(DMI_PRODUCT_NAME
, "AMILO Pro V2010"),
197 * No data is coming from the touchscreen unless KBC
200 .ident
= "Panasonic CF-29",
202 DMI_MATCH(DMI_SYS_VENDOR
, "Matsushita"),
203 DMI_MATCH(DMI_PRODUCT_NAME
, "CF-29"),
208 * Errors on MUX ports are reported without raising AUXDATA
209 * causing "spurious NAK" messages.
211 .ident
= "HP Pavilion DV4017EA",
213 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
214 DMI_MATCH(DMI_PRODUCT_NAME
, "Pavilion dv4000 (EA032EA#ABF)"),
219 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
221 .ident
= "HP Pavilion ZT1000",
223 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
224 DMI_MATCH(DMI_PRODUCT_NAME
, "HP Pavilion Notebook PC"),
225 DMI_MATCH(DMI_PRODUCT_VERSION
, "HP Pavilion Notebook ZT1000"),
230 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
232 .ident
= "HP Pavilion DV4270ca",
234 DMI_MATCH(DMI_SYS_VENDOR
, "Hewlett-Packard"),
235 DMI_MATCH(DMI_PRODUCT_NAME
, "Pavilion dv4000 (EH476UA#ABL)"),
239 .ident
= "Toshiba P10",
241 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
242 DMI_MATCH(DMI_PRODUCT_NAME
, "Satellite P10"),
246 .ident
= "Toshiba Equium A110",
248 DMI_MATCH(DMI_SYS_VENDOR
, "TOSHIBA"),
249 DMI_MATCH(DMI_PRODUCT_NAME
, "EQUIUM A110"),
253 .ident
= "Alienware Sentia",
255 DMI_MATCH(DMI_SYS_VENDOR
, "ALIENWARE"),
256 DMI_MATCH(DMI_PRODUCT_NAME
, "Sentia"),
260 .ident
= "Sharp Actius MM20",
262 DMI_MATCH(DMI_SYS_VENDOR
, "SHARP"),
263 DMI_MATCH(DMI_PRODUCT_NAME
, "PC-MM20 Series"),
267 .ident
= "Sony Vaio FS-115b",
269 DMI_MATCH(DMI_SYS_VENDOR
, "Sony Corporation"),
270 DMI_MATCH(DMI_PRODUCT_NAME
, "VGN-FS115B"),
274 .ident
= "Amoi M636/A737",
276 DMI_MATCH(DMI_SYS_VENDOR
, "Amoi Electronics CO.,LTD."),
277 DMI_MATCH(DMI_PRODUCT_NAME
, "M636/A737 platform"),
281 .ident
= "Lenovo 3000 n100",
283 DMI_MATCH(DMI_SYS_VENDOR
, "LENOVO"),
284 DMI_MATCH(DMI_PRODUCT_VERSION
, "3000 N100"),
296 #include <linux/dmi.h>
299 * Some Wistron based laptops need us to explicitly enable the 'Dritek
300 * keyboard extension' to make their extra keys start generating scancodes.
301 * Originally, this was just confined to older laptops, but a few Acer laptops
302 * have turned up in 2007 that also need this again.
304 static struct dmi_system_id __initdata i8042_dmi_dritek_table
[] = {
306 .ident
= "Acer Aspire 5630",
308 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
309 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5630"),
313 .ident
= "Acer Aspire 5650",
315 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
316 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5650"),
320 .ident
= "Acer Aspire 5680",
322 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
323 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 5680"),
327 .ident
= "Acer Aspire 9110",
329 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
330 DMI_MATCH(DMI_PRODUCT_NAME
, "Aspire 9110"),
334 .ident
= "Acer TravelMate 660",
336 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
337 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 660"),
341 .ident
= "Acer TravelMate 2490",
343 DMI_MATCH(DMI_SYS_VENDOR
, "Acer"),
344 DMI_MATCH(DMI_PRODUCT_NAME
, "TravelMate 2490"),
350 #endif /* CONFIG_X86 */
354 #include <linux/pnp.h>
356 static int i8042_pnp_kbd_registered
;
357 static unsigned int i8042_pnp_kbd_devices
;
358 static int i8042_pnp_aux_registered
;
359 static unsigned int i8042_pnp_aux_devices
;
361 static int i8042_pnp_command_reg
;
362 static int i8042_pnp_data_reg
;
363 static int i8042_pnp_kbd_irq
;
364 static int i8042_pnp_aux_irq
;
366 static char i8042_pnp_kbd_name
[32];
367 static char i8042_pnp_aux_name
[32];
369 static int i8042_pnp_kbd_probe(struct pnp_dev
*dev
, const struct pnp_device_id
*did
)
371 if (pnp_port_valid(dev
, 0) && pnp_port_len(dev
, 0) == 1)
372 i8042_pnp_data_reg
= pnp_port_start(dev
,0);
374 if (pnp_port_valid(dev
, 1) && pnp_port_len(dev
, 1) == 1)
375 i8042_pnp_command_reg
= pnp_port_start(dev
, 1);
377 if (pnp_irq_valid(dev
,0))
378 i8042_pnp_kbd_irq
= pnp_irq(dev
, 0);
380 strlcpy(i8042_pnp_kbd_name
, did
->id
, sizeof(i8042_pnp_kbd_name
));
381 if (strlen(pnp_dev_name(dev
))) {
382 strlcat(i8042_pnp_kbd_name
, ":", sizeof(i8042_pnp_kbd_name
));
383 strlcat(i8042_pnp_kbd_name
, pnp_dev_name(dev
), sizeof(i8042_pnp_kbd_name
));
386 i8042_pnp_kbd_devices
++;
390 static int i8042_pnp_aux_probe(struct pnp_dev
*dev
, const struct pnp_device_id
*did
)
392 if (pnp_port_valid(dev
, 0) && pnp_port_len(dev
, 0) == 1)
393 i8042_pnp_data_reg
= pnp_port_start(dev
,0);
395 if (pnp_port_valid(dev
, 1) && pnp_port_len(dev
, 1) == 1)
396 i8042_pnp_command_reg
= pnp_port_start(dev
, 1);
398 if (pnp_irq_valid(dev
, 0))
399 i8042_pnp_aux_irq
= pnp_irq(dev
, 0);
401 strlcpy(i8042_pnp_aux_name
, did
->id
, sizeof(i8042_pnp_aux_name
));
402 if (strlen(pnp_dev_name(dev
))) {
403 strlcat(i8042_pnp_aux_name
, ":", sizeof(i8042_pnp_aux_name
));
404 strlcat(i8042_pnp_aux_name
, pnp_dev_name(dev
), sizeof(i8042_pnp_aux_name
));
407 i8042_pnp_aux_devices
++;
411 static struct pnp_device_id pnp_kbd_devids
[] = {
412 { .id
= "PNP0303", .driver_data
= 0 },
413 { .id
= "PNP030b", .driver_data
= 0 },
417 static struct pnp_driver i8042_pnp_kbd_driver
= {
419 .id_table
= pnp_kbd_devids
,
420 .probe
= i8042_pnp_kbd_probe
,
423 static struct pnp_device_id pnp_aux_devids
[] = {
424 { .id
= "FJC6000", .driver_data
= 0 },
425 { .id
= "FJC6001", .driver_data
= 0 },
426 { .id
= "PNP0f03", .driver_data
= 0 },
427 { .id
= "PNP0f0b", .driver_data
= 0 },
428 { .id
= "PNP0f0e", .driver_data
= 0 },
429 { .id
= "PNP0f12", .driver_data
= 0 },
430 { .id
= "PNP0f13", .driver_data
= 0 },
431 { .id
= "PNP0f19", .driver_data
= 0 },
432 { .id
= "PNP0f1c", .driver_data
= 0 },
433 { .id
= "SYN0801", .driver_data
= 0 },
437 static struct pnp_driver i8042_pnp_aux_driver
= {
439 .id_table
= pnp_aux_devids
,
440 .probe
= i8042_pnp_aux_probe
,
443 static void i8042_pnp_exit(void)
445 if (i8042_pnp_kbd_registered
) {
446 i8042_pnp_kbd_registered
= 0;
447 pnp_unregister_driver(&i8042_pnp_kbd_driver
);
450 if (i8042_pnp_aux_registered
) {
451 i8042_pnp_aux_registered
= 0;
452 pnp_unregister_driver(&i8042_pnp_aux_driver
);
456 static int __init
i8042_pnp_init(void)
458 char kbd_irq_str
[4] = { 0 }, aux_irq_str
[4] = { 0 };
459 int pnp_data_busted
= 0;
463 printk(KERN_INFO
"i8042: PNP detection disabled\n");
467 err
= pnp_register_driver(&i8042_pnp_kbd_driver
);
469 i8042_pnp_kbd_registered
= 1;
471 err
= pnp_register_driver(&i8042_pnp_aux_driver
);
473 i8042_pnp_aux_registered
= 1;
475 if (!i8042_pnp_kbd_devices
&& !i8042_pnp_aux_devices
) {
477 #if defined(__ia64__)
480 printk(KERN_INFO
"PNP: No PS/2 controller found. Probing ports directly.\n");
485 if (i8042_pnp_kbd_devices
)
486 snprintf(kbd_irq_str
, sizeof(kbd_irq_str
),
487 "%d", i8042_pnp_kbd_irq
);
488 if (i8042_pnp_aux_devices
)
489 snprintf(aux_irq_str
, sizeof(aux_irq_str
),
490 "%d", i8042_pnp_aux_irq
);
492 printk(KERN_INFO
"PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
493 i8042_pnp_kbd_name
, (i8042_pnp_kbd_devices
&& i8042_pnp_aux_devices
) ? "," : "",
495 i8042_pnp_data_reg
, i8042_pnp_command_reg
,
496 kbd_irq_str
, (i8042_pnp_kbd_devices
&& i8042_pnp_aux_devices
) ? "," : "",
499 #if defined(__ia64__)
500 if (!i8042_pnp_kbd_devices
)
502 if (!i8042_pnp_aux_devices
)
506 if (((i8042_pnp_data_reg
& ~0xf) == (i8042_data_reg
& ~0xf) &&
507 i8042_pnp_data_reg
!= i8042_data_reg
) ||
508 !i8042_pnp_data_reg
) {
510 "PNP: PS/2 controller has invalid data port %#x; "
511 "using default %#x\n",
512 i8042_pnp_data_reg
, i8042_data_reg
);
513 i8042_pnp_data_reg
= i8042_data_reg
;
517 if (((i8042_pnp_command_reg
& ~0xf) == (i8042_command_reg
& ~0xf) &&
518 i8042_pnp_command_reg
!= i8042_command_reg
) ||
519 !i8042_pnp_command_reg
) {
521 "PNP: PS/2 controller has invalid command port %#x; "
522 "using default %#x\n",
523 i8042_pnp_command_reg
, i8042_command_reg
);
524 i8042_pnp_command_reg
= i8042_command_reg
;
528 if (!i8042_nokbd
&& !i8042_pnp_kbd_irq
) {
530 "PNP: PS/2 controller doesn't have KBD irq; "
531 "using default %d\n", i8042_kbd_irq
);
532 i8042_pnp_kbd_irq
= i8042_kbd_irq
;
536 if (!i8042_noaux
&& !i8042_pnp_aux_irq
) {
537 if (!pnp_data_busted
&& i8042_pnp_kbd_irq
) {
539 "PNP: PS/2 appears to have AUX port disabled, "
540 "if this is incorrect please boot with "
545 "PNP: PS/2 controller doesn't have AUX irq; "
546 "using default %d\n", i8042_aux_irq
);
547 i8042_pnp_aux_irq
= i8042_aux_irq
;
551 i8042_data_reg
= i8042_pnp_data_reg
;
552 i8042_command_reg
= i8042_pnp_command_reg
;
553 i8042_kbd_irq
= i8042_pnp_kbd_irq
;
554 i8042_aux_irq
= i8042_pnp_aux_irq
;
560 static inline int i8042_pnp_init(void) { return 0; }
561 static inline void i8042_pnp_exit(void) { }
564 static int __init
i8042_platform_init(void)
569 * On ix86 platforms touching the i8042 data register region can do really
570 * bad things. Because of this the region is always reserved on ix86 boxes.
572 * if (!request_region(I8042_DATA_REG, 16, "i8042"))
576 i8042_kbd_irq
= I8042_MAP_IRQ(1);
577 i8042_aux_irq
= I8042_MAP_IRQ(12);
579 retval
= i8042_pnp_init();
583 #if defined(__ia64__)
587 #if defined(__i386__) || defined(__x86_64__)
588 if (dmi_check_system(i8042_dmi_noloop_table
))
591 if (dmi_check_system(i8042_dmi_nomux_table
))
596 if (dmi_check_system(i8042_dmi_dritek_table
))
598 #endif /* CONFIG_X86 */
603 static inline void i8042_platform_exit(void)
608 #endif /* _I8042_X86IA64IO_H */