blob: 924e8ed7f2cf777f5d48767c18d5618027c031e6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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
Jiri Kosinac3a34f42008-05-28 01:10:52 -040066#ifdef CONFIG_X86
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
68#include <linux/dmi.h>
69
70static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
71 {
Dmitry Torokhov90245c12007-06-12 00:33:27 -040072 /* AUX LOOP command does not raise AUX IRQ */
Dmitry Torokhov87d91732008-07-19 00:35:43 -040073 .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 },
80 {
81 /* AUX LOOP command does not raise AUX IRQ */
Dmitry Torokhov90245c12007-06-12 00:33:27 -040082 .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 },
89 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 .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 },
Ben Collins6020baf2006-01-05 23:00:38 -0500105 {
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 },
Dmitry Torokhov8c4df742007-06-12 00:33:32 -0400113 {
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 },
Jiri Kosina8bf42152007-11-21 14:17:38 -0500122 {
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 },
Dmitry Torokhov89cdb8c2008-07-03 11:00:28 -0400130 {
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 },
Stefan Bader2c6f2cb2008-10-16 22:00:56 -0400138 {
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 },
Ozan Çağlayana6f66dd2008-12-20 04:04:51 -0500146 {
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 },
Dmitry Torokhov59cc1dd2009-04-07 23:53:26 -0700154 {
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 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 { }
163};
164
165/*
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500166 * Some Fujitsu notebooks are having trouble with touchpads if
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 * active multiplexing mode is activated. Luckily they don't have
168 * external PS/2 ports so we can safely disable it.
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500169 * ... apparently some Toshibas don't like MUX mode either and
170 * die horrible death on reboot.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 */
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 },
180 {
Dmitry Torokhovbb06ec3c2006-12-08 01:36:32 -0500181 .ident = "Fujitsu Lifebook P7010",
182 .matches = {
183 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
184 DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
185 },
186 },
187 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 .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 },
201 {
Dmitry Torokhovb4ff99b2005-05-28 02:12:10 -0500202 .ident = "Fujitsu Lifebook S6230",
203 .matches = {
204 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
205 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
206 },
207 },
208 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 .ident = "Fujitsu T70H",
210 .matches = {
211 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
212 DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
213 },
214 },
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500215 {
Vojtech Pavlik20f07942005-07-11 01:06:28 -0500216 .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 },
222 {
Dmitry Torokhov7545c242005-09-04 01:42:10 -0500223 .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 },
229 {
Jiri Kosina3f79b1e2008-01-30 16:34:52 -0500230 .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 },
236 {
Jiri Kosinaefd51842008-06-06 00:56:43 -0400237 .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 },
243 {
Dmitry Torokhov6e782582007-03-16 00:59:42 -0400244 /*
Dmitry Torokhovcc8310e2007-04-25 00:40:32 -0400245 * 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 },
254 {
255 /*
Dmitry Torokhov6e782582007-03-16 00:59:42 -0400256 * 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 },
265 {
Dmitry Torokhov9d9d50b2007-06-28 00:44:27 -0400266 /*
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 },
276 {
Elvis Pranskevichus749aea72007-09-04 23:18:21 -0400277 /*
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 },
286 {
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500287 .ident = "Toshiba P10",
288 .matches = {
289 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
290 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
291 },
292 },
Dmitry Torokhov865190c2005-07-11 01:06:06 -0500293 {
Dmitry Torokhova91eaa12006-09-14 01:31:06 -0400294 .ident = "Toshiba Equium A110",
295 .matches = {
296 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
297 DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
298 },
299 },
300 {
Dmitry Torokhov865190c2005-07-11 01:06:06 -0500301 .ident = "Alienware Sentia",
302 .matches = {
303 DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
304 DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
305 },
306 },
Dmitry Torokhov4eb38ac2005-12-21 00:51:51 -0500307 {
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 },
Vojtech Pavlik3dd01a82006-01-14 00:24:06 -0500314 {
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 },
Cjacker Huange2df4522006-08-08 23:38:22 -0400321 {
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 },
Jiri Kosina2a2dcd62008-03-10 03:08:54 -0700328 {
329 .ident = "Lenovo 3000 n100",
330 .matches = {
331 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Jiri Kosina9ce1ca22008-09-04 22:28:48 -0400332 DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
Jiri Kosina2a2dcd62008-03-10 03:08:54 -0700333 },
334 },
Jiri Kosina0376bce2008-07-03 10:45:38 -0400335 {
336 .ident = "Acer Aspire 1360",
337 .matches = {
338 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
339 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
340 },
341 },
Jiri Kosina5b5b43d2008-07-03 11:00:28 -0400342 {
343 .ident = "Gericom Bellagio",
344 .matches = {
345 DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
346 DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
347 },
348 },
Colin B Macdonald5bd8a052008-10-11 18:16:38 -0400349 {
350 .ident = "IBM 2656",
351 .matches = {
352 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
353 DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
354 },
355 },
Herton Ronaldo Krzesinski786b11c2008-11-11 09:37:14 -0500356 {
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 },
Dmitry Torokhov5f4ba042008-11-14 13:32:42 -0500363 {
364 .ident = "Compal HEL80I",
365 .matches = {
366 DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
367 DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
368 },
369 },
Jiri Kosina9334e902009-01-06 01:35:45 -0800370 {
371 .ident = "Dell Vostro 1510",
372 .matches = {
373 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
374 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
375 },
376 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 { }
378};
379
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700380static struct dmi_system_id __initdata i8042_dmi_reset_table[] = {
381 {
382 .ident = "MSI Wind U-100",
383 .matches = {
384 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
385 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
386 },
387 },
388 {
389 .ident = "LG Electronics X110",
390 .matches = {
391 DMI_MATCH(DMI_BOARD_NAME, "X110"),
392 DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
393 },
394 },
Yan Li9230ccb2009-06-28 22:30:56 -0700395 {
396 .ident = "Acer Aspire One 150",
397 .matches = {
398 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
399 DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
400 },
401 },
402 {
403 .ident = "Advent 4211",
404 .matches = {
405 DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
406 DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
407 },
408 },
409 {
410 .ident = "Medion Akoya Mini E1210",
411 .matches = {
412 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
413 DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
414 },
415 },
416 {
417 .ident = "Mivvy M310",
418 .matches = {
419 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
420 DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
421 },
422 },
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700423 { }
424};
425
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400426#ifdef CONFIG_PNP
427static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
428 {
429 .ident = "Intel MBO Desktop D845PESV",
430 .matches = {
431 DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
432 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
433 },
434 },
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700435 {
436 .ident = "MSI Wind U-100",
437 .matches = {
438 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
439 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
440 },
441 },
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400442 { }
443};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444#endif
445
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500446/*
447 * Some Wistron based laptops need us to explicitly enable the 'Dritek
448 * keyboard extension' to make their extra keys start generating scancodes.
449 * Originally, this was just confined to older laptops, but a few Acer laptops
450 * have turned up in 2007 that also need this again.
451 */
452static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
453 {
454 .ident = "Acer Aspire 5630",
455 .matches = {
456 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
457 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
458 },
459 },
460 {
461 .ident = "Acer Aspire 5650",
462 .matches = {
463 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
464 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
465 },
466 },
467 {
468 .ident = "Acer Aspire 5680",
469 .matches = {
470 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
471 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
472 },
473 },
474 {
Carlos Corbacho0e7e92f2008-07-07 08:55:31 -0400475 .ident = "Acer Aspire 5720",
476 .matches = {
477 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
478 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
479 },
480 },
481 {
Carlos Corbacho5799ddb2008-01-30 16:34:12 -0500482 .ident = "Acer Aspire 9110",
483 .matches = {
484 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
485 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
486 },
487 },
488 {
Bruno Prémont65e660a2008-05-20 13:47:28 -0400489 .ident = "Acer TravelMate 660",
490 .matches = {
491 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
492 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
493 },
494 },
495 {
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500496 .ident = "Acer TravelMate 2490",
497 .matches = {
498 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
499 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
500 },
501 },
Carlos Corbacho8e4ae102008-08-06 14:28:43 -0400502 {
503 .ident = "Acer TravelMate 4280",
504 .matches = {
505 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
506 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
507 },
508 },
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500509 { }
510};
511
512#endif /* CONFIG_X86 */
513
Linus Torvalds1da177e2005-04-16 15:20:36 -0700514#ifdef CONFIG_PNP
515#include <linux/pnp.h>
516
517static int i8042_pnp_kbd_registered;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500518static unsigned int i8042_pnp_kbd_devices;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700519static int i8042_pnp_aux_registered;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500520static unsigned int i8042_pnp_aux_devices;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521
522static int i8042_pnp_command_reg;
523static int i8042_pnp_data_reg;
524static int i8042_pnp_kbd_irq;
525static int i8042_pnp_aux_irq;
526
527static char i8042_pnp_kbd_name[32];
528static char i8042_pnp_aux_name[32];
529
530static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
531{
532 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
533 i8042_pnp_data_reg = pnp_port_start(dev,0);
534
535 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
536 i8042_pnp_command_reg = pnp_port_start(dev, 1);
537
538 if (pnp_irq_valid(dev,0))
539 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
540
Roel Kluin8c6deb92008-04-18 00:25:18 -0400541 strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 if (strlen(pnp_dev_name(dev))) {
Roel Kluin8c6deb92008-04-18 00:25:18 -0400543 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
544 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 }
546
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500547 i8042_pnp_kbd_devices++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 return 0;
549}
550
551static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
552{
553 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
554 i8042_pnp_data_reg = pnp_port_start(dev,0);
555
556 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
557 i8042_pnp_command_reg = pnp_port_start(dev, 1);
558
559 if (pnp_irq_valid(dev, 0))
560 i8042_pnp_aux_irq = pnp_irq(dev, 0);
561
Roel Kluin8c6deb92008-04-18 00:25:18 -0400562 strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 if (strlen(pnp_dev_name(dev))) {
Roel Kluin8c6deb92008-04-18 00:25:18 -0400564 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
565 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 }
567
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500568 i8042_pnp_aux_devices++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 return 0;
570}
571
572static struct pnp_device_id pnp_kbd_devids[] = {
573 { .id = "PNP0303", .driver_data = 0 },
574 { .id = "PNP030b", .driver_data = 0 },
575 { .id = "", },
576};
577
578static struct pnp_driver i8042_pnp_kbd_driver = {
579 .name = "i8042 kbd",
580 .id_table = pnp_kbd_devids,
581 .probe = i8042_pnp_kbd_probe,
582};
583
584static struct pnp_device_id pnp_aux_devids[] = {
Dmitry Torokhovb9973952007-04-25 00:40:53 -0400585 { .id = "FJC6000", .driver_data = 0 },
586 { .id = "FJC6001", .driver_data = 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 { .id = "PNP0f03", .driver_data = 0 },
588 { .id = "PNP0f0b", .driver_data = 0 },
589 { .id = "PNP0f0e", .driver_data = 0 },
590 { .id = "PNP0f12", .driver_data = 0 },
591 { .id = "PNP0f13", .driver_data = 0 },
592 { .id = "PNP0f19", .driver_data = 0 },
593 { .id = "PNP0f1c", .driver_data = 0 },
594 { .id = "SYN0801", .driver_data = 0 },
595 { .id = "", },
596};
597
598static struct pnp_driver i8042_pnp_aux_driver = {
599 .name = "i8042 aux",
600 .id_table = pnp_aux_devids,
601 .probe = i8042_pnp_aux_probe,
602};
603
604static void i8042_pnp_exit(void)
605{
Kurt Garloff74af42b2005-05-28 02:11:38 -0500606 if (i8042_pnp_kbd_registered) {
607 i8042_pnp_kbd_registered = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 pnp_unregister_driver(&i8042_pnp_kbd_driver);
Kurt Garloff74af42b2005-05-28 02:11:38 -0500609 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610
Kurt Garloff74af42b2005-05-28 02:11:38 -0500611 if (i8042_pnp_aux_registered) {
612 i8042_pnp_aux_registered = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 pnp_unregister_driver(&i8042_pnp_aux_driver);
Kurt Garloff74af42b2005-05-28 02:11:38 -0500614 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615}
616
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500617static int __init i8042_pnp_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618{
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500619 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400620 int pnp_data_busted = 0;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500621 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400623#ifdef CONFIG_X86
624 if (dmi_check_system(i8042_dmi_nopnp_table))
625 i8042_nopnp = 1;
626#endif
627
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 if (i8042_nopnp) {
Vojtech Pavlik39fa5802005-05-28 02:11:16 -0500629 printk(KERN_INFO "i8042: PNP detection disabled\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 return 0;
631 }
632
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500633 err = pnp_register_driver(&i8042_pnp_kbd_driver);
634 if (!err)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635 i8042_pnp_kbd_registered = 1;
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500636
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500637 err = pnp_register_driver(&i8042_pnp_aux_driver);
638 if (!err)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 i8042_pnp_aux_registered = 1;
640
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500641 if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 i8042_pnp_exit();
643#if defined(__ia64__)
644 return -ENODEV;
645#else
Dmitry Torokhov5a72afc2005-05-28 02:11:32 -0500646 printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 return 0;
648#endif
649 }
650
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500651 if (i8042_pnp_kbd_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500652 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
653 "%d", i8042_pnp_kbd_irq);
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500654 if (i8042_pnp_aux_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500655 snprintf(aux_irq_str, sizeof(aux_irq_str),
656 "%d", i8042_pnp_aux_irq);
657
658 printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500659 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500660 i8042_pnp_aux_name,
661 i8042_pnp_data_reg, i8042_pnp_command_reg,
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500662 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500663 aux_irq_str);
664
665#if defined(__ia64__)
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500666 if (!i8042_pnp_kbd_devices)
Dmitry Torokhov945ef0d2005-09-04 01:42:00 -0500667 i8042_nokbd = 1;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500668 if (!i8042_pnp_aux_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500669 i8042_noaux = 1;
670#endif
671
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400673 i8042_pnp_data_reg != i8042_data_reg) ||
674 !i8042_pnp_data_reg) {
675 printk(KERN_WARNING
676 "PNP: PS/2 controller has invalid data port %#x; "
677 "using default %#x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 i8042_pnp_data_reg, i8042_data_reg);
679 i8042_pnp_data_reg = i8042_data_reg;
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400680 pnp_data_busted = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681 }
682
683 if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400684 i8042_pnp_command_reg != i8042_command_reg) ||
685 !i8042_pnp_command_reg) {
686 printk(KERN_WARNING
687 "PNP: PS/2 controller has invalid command port %#x; "
688 "using default %#x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 i8042_pnp_command_reg, i8042_command_reg);
690 i8042_pnp_command_reg = i8042_command_reg;
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400691 pnp_data_busted = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 }
693
Dmitry Torokhov945ef0d2005-09-04 01:42:00 -0500694 if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400695 printk(KERN_WARNING
696 "PNP: PS/2 controller doesn't have KBD irq; "
697 "using default %d\n", i8042_kbd_irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 i8042_pnp_kbd_irq = i8042_kbd_irq;
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400699 pnp_data_busted = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700700 }
701
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500702 if (!i8042_noaux && !i8042_pnp_aux_irq) {
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400703 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
704 printk(KERN_WARNING
705 "PNP: PS/2 appears to have AUX port disabled, "
706 "if this is incorrect please boot with "
707 "i8042.nopnp\n");
708 i8042_noaux = 1;
709 } else {
710 printk(KERN_WARNING
711 "PNP: PS/2 controller doesn't have AUX irq; "
712 "using default %d\n", i8042_aux_irq);
713 i8042_pnp_aux_irq = i8042_aux_irq;
714 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 }
716
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717 i8042_data_reg = i8042_pnp_data_reg;
718 i8042_command_reg = i8042_pnp_command_reg;
719 i8042_kbd_irq = i8042_pnp_kbd_irq;
720 i8042_aux_irq = i8042_pnp_aux_irq;
721
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 return 0;
723}
724
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500725#else
726static inline int i8042_pnp_init(void) { return 0; }
727static inline void i8042_pnp_exit(void) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700728#endif
729
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500730static int __init i8042_platform_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731{
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500732 int retval;
733
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734/*
735 * On ix86 platforms touching the i8042 data register region can do really
736 * bad things. Because of this the region is always reserved on ix86 boxes.
737 *
738 * if (!request_region(I8042_DATA_REG, 16, "i8042"))
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500739 * return -EBUSY;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 */
741
742 i8042_kbd_irq = I8042_MAP_IRQ(1);
743 i8042_aux_irq = I8042_MAP_IRQ(12);
744
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500745 retval = i8042_pnp_init();
746 if (retval)
747 return retval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748
749#if defined(__ia64__)
750 i8042_reset = 1;
751#endif
752
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400753#ifdef CONFIG_X86
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700754 if (dmi_check_system(i8042_dmi_reset_table))
755 i8042_reset = 1;
756
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757 if (dmi_check_system(i8042_dmi_noloop_table))
758 i8042_noloop = 1;
759
760 if (dmi_check_system(i8042_dmi_nomux_table))
761 i8042_nomux = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700762
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500763 if (dmi_check_system(i8042_dmi_dritek_table))
764 i8042_dritek = 1;
765#endif /* CONFIG_X86 */
766
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500767 return retval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768}
769
770static inline void i8042_platform_exit(void)
771{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772 i8042_pnp_exit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773}
774
775#endif /* _I8042_X86IA64IO_H */