OSDN Git Service

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