]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/input/serio/i8042-x86ia64io.h
Input: i8042 - add Intel D845PESV to nopnp list
[linux-2.6-omap-h63xx.git] / drivers / input / serio / i8042-x86ia64io.h
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
31 static int i8042_kbd_irq;
32 static 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
42 static int i8042_command_reg = 0x64;
43 static int i8042_data_reg = 0x60;
44
45
46 static inline int i8042_read_data(void)
47 {
48         return inb(I8042_DATA_REG);
49 }
50
51 static inline int i8042_read_status(void)
52 {
53         return inb(I8042_STATUS_REG);
54 }
55
56 static inline void i8042_write_data(int val)
57 {
58         outb(val, I8042_DATA_REG);
59 }
60
61 static inline void i8042_write_command(int val)
62 {
63         outb(val, I8042_COMMAND_REG);
64 }
65
66 #ifdef CONFIG_X86
67
68 #include <linux/dmi.h>
69
70 static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
71         {
72                 /* AUX LOOP command does not raise AUX IRQ */
73                 .ident = "ASUS P65UP5",
74                 .matches = {
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"),
78                 },
79         },
80         {
81                 .ident = "Compaq Proliant 8500",
82                 .matches = {
83                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
84                         DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
85                         DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
86                 },
87         },
88         {
89                 .ident = "Compaq Proliant DL760",
90                 .matches = {
91                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
92                         DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
93                         DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
94                 },
95         },
96         {
97                 .ident = "OQO Model 01",
98                 .matches = {
99                         DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
100                         DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
101                         DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
102                 },
103         },
104         {
105                 /* AUX LOOP does not work properly */
106                 .ident = "ULI EV4873",
107                 .matches = {
108                         DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
109                         DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
110                         DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
111                 },
112         },
113         {
114                 .ident = "Microsoft Virtual Machine",
115                 .matches = {
116                         DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
117                         DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
118                         DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
119                 },
120         },
121         { }
122 };
123
124 /*
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.
130  */
131 static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
132         {
133                 .ident = "Fujitsu Lifebook P7010/P7010D",
134                 .matches = {
135                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
136                         DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
137                 },
138         },
139         {
140                 .ident = "Fujitsu Lifebook P7010",
141                 .matches = {
142                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
143                         DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
144                 },
145         },
146         {
147                 .ident = "Fujitsu Lifebook P5020D",
148                 .matches = {
149                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
150                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
151                 },
152         },
153         {
154                 .ident = "Fujitsu Lifebook S2000",
155                 .matches = {
156                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
157                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
158                 },
159         },
160         {
161                 .ident = "Fujitsu Lifebook S6230",
162                 .matches = {
163                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
164                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
165                 },
166         },
167         {
168                 .ident = "Fujitsu T70H",
169                 .matches = {
170                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
171                         DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
172                 },
173         },
174         {
175                 .ident = "Fujitsu-Siemens Lifebook T3010",
176                 .matches = {
177                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
178                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
179                 },
180         },
181         {
182                 .ident = "Fujitsu-Siemens Lifebook E4010",
183                 .matches = {
184                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
185                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
186                 },
187         },
188         {
189                 .ident = "Fujitsu-Siemens Amilo Pro 2010",
190                 .matches = {
191                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
192                         DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
193                 },
194         },
195         {
196                 /*
197                  * No data is coming from the touchscreen unless KBC
198                  * is in legacy mode.
199                  */
200                 .ident = "Panasonic CF-29",
201                 .matches = {
202                         DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
203                         DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
204                 },
205         },
206         {
207                 /*
208                  * Errors on MUX ports are reported without raising AUXDATA
209                  * causing "spurious NAK" messages.
210                  */
211                 .ident = "HP Pavilion DV4017EA",
212                 .matches = {
213                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
214                         DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
215                 },
216         },
217         {
218                 /*
219                  * Like DV4017EA does not raise AUXERR for errors on MUX ports.
220                  */
221                 .ident = "HP Pavilion ZT1000",
222                 .matches = {
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"),
226                 },
227         },
228         {
229                 /*
230                  * Like DV4017EA does not raise AUXERR for errors on MUX ports.
231                  */
232                 .ident = "HP Pavilion DV4270ca",
233                 .matches = {
234                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
235                         DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
236                 },
237         },
238         {
239                 .ident = "Toshiba P10",
240                 .matches = {
241                         DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
242                         DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
243                 },
244         },
245         {
246                 .ident = "Toshiba Equium A110",
247                 .matches = {
248                         DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
249                         DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
250                 },
251         },
252         {
253                 .ident = "Alienware Sentia",
254                 .matches = {
255                         DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
256                         DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
257                 },
258         },
259         {
260                 .ident = "Sharp Actius MM20",
261                 .matches = {
262                         DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
263                         DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
264                 },
265         },
266         {
267                 .ident = "Sony Vaio FS-115b",
268                 .matches = {
269                         DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
270                         DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
271                 },
272         },
273         {
274                 .ident = "Amoi M636/A737",
275                 .matches = {
276                         DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
277                         DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
278                 },
279         },
280         {
281                 .ident = "Lenovo 3000 n100",
282                 .matches = {
283                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
284                         DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"),
285                 },
286         },
287         { }
288 };
289
290 #ifdef CONFIG_PNP
291 static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
292         {
293                 .ident = "Intel MBO Desktop D845PESV",
294                 .matches = {
295                         DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
296                         DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
297                 },
298         },
299         { }
300 };
301 #endif
302
303 /*
304  * Some Wistron based laptops need us to explicitly enable the 'Dritek
305  * keyboard extension' to make their extra keys start generating scancodes.
306  * Originally, this was just confined to older laptops, but a few Acer laptops
307  * have turned up in 2007 that also need this again.
308  */
309 static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
310         {
311                 .ident = "Acer Aspire 5630",
312                 .matches = {
313                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
314                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
315                 },
316         },
317         {
318                 .ident = "Acer Aspire 5650",
319                 .matches = {
320                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
321                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
322                 },
323         },
324         {
325                 .ident = "Acer Aspire 5680",
326                 .matches = {
327                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
328                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
329                 },
330         },
331         {
332                 .ident = "Acer Aspire 9110",
333                 .matches = {
334                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
335                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
336                 },
337         },
338         {
339                 .ident = "Acer TravelMate 2490",
340                 .matches = {
341                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
342                         DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
343                 },
344         },
345         { }
346 };
347
348 #endif /* CONFIG_X86 */
349
350 #ifdef CONFIG_PNP
351 #include <linux/pnp.h>
352
353 static int i8042_pnp_kbd_registered;
354 static unsigned int i8042_pnp_kbd_devices;
355 static int i8042_pnp_aux_registered;
356 static unsigned int i8042_pnp_aux_devices;
357
358 static int i8042_pnp_command_reg;
359 static int i8042_pnp_data_reg;
360 static int i8042_pnp_kbd_irq;
361 static int i8042_pnp_aux_irq;
362
363 static char i8042_pnp_kbd_name[32];
364 static char i8042_pnp_aux_name[32];
365
366 static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
367 {
368         if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
369                 i8042_pnp_data_reg = pnp_port_start(dev,0);
370
371         if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
372                 i8042_pnp_command_reg = pnp_port_start(dev, 1);
373
374         if (pnp_irq_valid(dev,0))
375                 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
376
377         strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
378         if (strlen(pnp_dev_name(dev))) {
379                 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
380                 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
381         }
382
383         i8042_pnp_kbd_devices++;
384         return 0;
385 }
386
387 static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
388 {
389         if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
390                 i8042_pnp_data_reg = pnp_port_start(dev,0);
391
392         if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
393                 i8042_pnp_command_reg = pnp_port_start(dev, 1);
394
395         if (pnp_irq_valid(dev, 0))
396                 i8042_pnp_aux_irq = pnp_irq(dev, 0);
397
398         strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
399         if (strlen(pnp_dev_name(dev))) {
400                 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
401                 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
402         }
403
404         i8042_pnp_aux_devices++;
405         return 0;
406 }
407
408 static struct pnp_device_id pnp_kbd_devids[] = {
409         { .id = "PNP0303", .driver_data = 0 },
410         { .id = "PNP030b", .driver_data = 0 },
411         { .id = "", },
412 };
413
414 static struct pnp_driver i8042_pnp_kbd_driver = {
415         .name           = "i8042 kbd",
416         .id_table       = pnp_kbd_devids,
417         .probe          = i8042_pnp_kbd_probe,
418 };
419
420 static struct pnp_device_id pnp_aux_devids[] = {
421         { .id = "FJC6000", .driver_data = 0 },
422         { .id = "FJC6001", .driver_data = 0 },
423         { .id = "PNP0f03", .driver_data = 0 },
424         { .id = "PNP0f0b", .driver_data = 0 },
425         { .id = "PNP0f0e", .driver_data = 0 },
426         { .id = "PNP0f12", .driver_data = 0 },
427         { .id = "PNP0f13", .driver_data = 0 },
428         { .id = "PNP0f19", .driver_data = 0 },
429         { .id = "PNP0f1c", .driver_data = 0 },
430         { .id = "SYN0801", .driver_data = 0 },
431         { .id = "", },
432 };
433
434 static struct pnp_driver i8042_pnp_aux_driver = {
435         .name           = "i8042 aux",
436         .id_table       = pnp_aux_devids,
437         .probe          = i8042_pnp_aux_probe,
438 };
439
440 static void i8042_pnp_exit(void)
441 {
442         if (i8042_pnp_kbd_registered) {
443                 i8042_pnp_kbd_registered = 0;
444                 pnp_unregister_driver(&i8042_pnp_kbd_driver);
445         }
446
447         if (i8042_pnp_aux_registered) {
448                 i8042_pnp_aux_registered = 0;
449                 pnp_unregister_driver(&i8042_pnp_aux_driver);
450         }
451 }
452
453 static int __init i8042_pnp_init(void)
454 {
455         char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
456         int pnp_data_busted = 0;
457         int err;
458
459 #ifdef CONFIG_X86
460         if (dmi_check_system(i8042_dmi_nopnp_table))
461                 i8042_nopnp = 1;
462 #endif
463
464         if (i8042_nopnp) {
465                 printk(KERN_INFO "i8042: PNP detection disabled\n");
466                 return 0;
467         }
468
469         err = pnp_register_driver(&i8042_pnp_kbd_driver);
470         if (!err)
471                 i8042_pnp_kbd_registered = 1;
472
473         err = pnp_register_driver(&i8042_pnp_aux_driver);
474         if (!err)
475                 i8042_pnp_aux_registered = 1;
476
477         if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
478                 i8042_pnp_exit();
479 #if defined(__ia64__)
480                 return -ENODEV;
481 #else
482                 printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
483                 return 0;
484 #endif
485         }
486
487         if (i8042_pnp_kbd_devices)
488                 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
489                         "%d", i8042_pnp_kbd_irq);
490         if (i8042_pnp_aux_devices)
491                 snprintf(aux_irq_str, sizeof(aux_irq_str),
492                         "%d", i8042_pnp_aux_irq);
493
494         printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
495                 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
496                 i8042_pnp_aux_name,
497                 i8042_pnp_data_reg, i8042_pnp_command_reg,
498                 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
499                 aux_irq_str);
500
501 #if defined(__ia64__)
502         if (!i8042_pnp_kbd_devices)
503                 i8042_nokbd = 1;
504         if (!i8042_pnp_aux_devices)
505                 i8042_noaux = 1;
506 #endif
507
508         if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
509               i8042_pnp_data_reg != i8042_data_reg) ||
510             !i8042_pnp_data_reg) {
511                 printk(KERN_WARNING
512                         "PNP: PS/2 controller has invalid data port %#x; "
513                         "using default %#x\n",
514                         i8042_pnp_data_reg, i8042_data_reg);
515                 i8042_pnp_data_reg = i8042_data_reg;
516                 pnp_data_busted = 1;
517         }
518
519         if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
520               i8042_pnp_command_reg != i8042_command_reg) ||
521             !i8042_pnp_command_reg) {
522                 printk(KERN_WARNING
523                         "PNP: PS/2 controller has invalid command port %#x; "
524                         "using default %#x\n",
525                         i8042_pnp_command_reg, i8042_command_reg);
526                 i8042_pnp_command_reg = i8042_command_reg;
527                 pnp_data_busted = 1;
528         }
529
530         if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
531                 printk(KERN_WARNING
532                         "PNP: PS/2 controller doesn't have KBD irq; "
533                         "using default %d\n", i8042_kbd_irq);
534                 i8042_pnp_kbd_irq = i8042_kbd_irq;
535                 pnp_data_busted = 1;
536         }
537
538         if (!i8042_noaux && !i8042_pnp_aux_irq) {
539                 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
540                         printk(KERN_WARNING
541                                 "PNP: PS/2 appears to have AUX port disabled, "
542                                 "if this is incorrect please boot with "
543                                 "i8042.nopnp\n");
544                         i8042_noaux = 1;
545                 } else {
546                         printk(KERN_WARNING
547                                 "PNP: PS/2 controller doesn't have AUX irq; "
548                                 "using default %d\n", i8042_aux_irq);
549                         i8042_pnp_aux_irq = i8042_aux_irq;
550                 }
551         }
552
553         i8042_data_reg = i8042_pnp_data_reg;
554         i8042_command_reg = i8042_pnp_command_reg;
555         i8042_kbd_irq = i8042_pnp_kbd_irq;
556         i8042_aux_irq = i8042_pnp_aux_irq;
557
558         return 0;
559 }
560
561 #else
562 static inline int i8042_pnp_init(void) { return 0; }
563 static inline void i8042_pnp_exit(void) { }
564 #endif
565
566 static int __init i8042_platform_init(void)
567 {
568         int retval;
569
570 /*
571  * On ix86 platforms touching the i8042 data register region can do really
572  * bad things. Because of this the region is always reserved on ix86 boxes.
573  *
574  *      if (!request_region(I8042_DATA_REG, 16, "i8042"))
575  *              return -EBUSY;
576  */
577
578         i8042_kbd_irq = I8042_MAP_IRQ(1);
579         i8042_aux_irq = I8042_MAP_IRQ(12);
580
581         retval = i8042_pnp_init();
582         if (retval)
583                 return retval;
584
585 #if defined(__ia64__)
586         i8042_reset = 1;
587 #endif
588
589 #ifdef CONFIG_X86
590         if (dmi_check_system(i8042_dmi_noloop_table))
591                 i8042_noloop = 1;
592
593         if (dmi_check_system(i8042_dmi_nomux_table))
594                 i8042_nomux = 1;
595
596         if (dmi_check_system(i8042_dmi_dritek_table))
597                 i8042_dritek = 1;
598 #endif /* CONFIG_X86 */
599
600         return retval;
601 }
602
603 static inline void i8042_platform_exit(void)
604 {
605         i8042_pnp_exit();
606 }
607
608 #endif /* _I8042_X86IA64IO_H */