blob: ccbf23ece8e370cc2e59fa4fef47d8cfd9ed5a09 [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 {
Jory A. Pratt685aaca2009-08-03 09:32:34 -070081 .ident = "ASUS G1S",
82 .matches = {
83 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
84 DMI_MATCH(DMI_BOARD_NAME, "G1S"),
85 DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
86 },
87 },
88 {
Dmitry Torokhov87d91732008-07-19 00:35:43 -040089 /* AUX LOOP command does not raise AUX IRQ */
Dmitry Torokhov90245c12007-06-12 00:33:27 -040090 .ident = "ASUS P65UP5",
91 .matches = {
92 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
93 DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
94 DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
95 },
96 },
97 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 .ident = "Compaq Proliant 8500",
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 .ident = "Compaq Proliant DL760",
107 .matches = {
108 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
109 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
110 DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
111 },
112 },
Ben Collins6020baf2006-01-05 23:00:38 -0500113 {
114 .ident = "OQO Model 01",
115 .matches = {
116 DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
117 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
118 DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
119 },
120 },
Dmitry Torokhov8c4df742007-06-12 00:33:32 -0400121 {
122 /* AUX LOOP does not work properly */
123 .ident = "ULI EV4873",
124 .matches = {
125 DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
126 DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
127 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
128 },
129 },
Jiri Kosina8bf42152007-11-21 14:17:38 -0500130 {
131 .ident = "Microsoft Virtual Machine",
132 .matches = {
133 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
134 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
135 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
136 },
137 },
Dmitry Torokhov89cdb8c2008-07-03 11:00:28 -0400138 {
139 .ident = "Medion MAM 2070",
140 .matches = {
141 DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
142 DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
143 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
144 },
145 },
Stefan Bader2c6f2cb2008-10-16 22:00:56 -0400146 {
147 .ident = "Blue FB5601",
148 .matches = {
149 DMI_MATCH(DMI_SYS_VENDOR, "blue"),
150 DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
151 DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
152 },
153 },
Ozan Çağlayana6f66dd2008-12-20 04:04:51 -0500154 {
155 .ident = "Gigabyte M912",
156 .matches = {
157 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
158 DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
159 DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
160 },
161 },
Dmitry Torokhov59cc1dd2009-04-07 23:53:26 -0700162 {
163 .ident = "HP DV9700",
164 .matches = {
165 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
166 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
167 DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
168 },
169 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 { }
171};
172
173/*
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500174 * Some Fujitsu notebooks are having trouble with touchpads if
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 * active multiplexing mode is activated. Luckily they don't have
176 * external PS/2 ports so we can safely disable it.
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500177 * ... apparently some Toshibas don't like MUX mode either and
178 * die horrible death on reboot.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 */
180static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
181 {
182 .ident = "Fujitsu Lifebook P7010/P7010D",
183 .matches = {
184 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
185 DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
186 },
187 },
188 {
Dmitry Torokhovbb06ec3c2006-12-08 01:36:32 -0500189 .ident = "Fujitsu Lifebook P7010",
190 .matches = {
191 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
192 DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
193 },
194 },
195 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 .ident = "Fujitsu Lifebook P5020D",
197 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
199 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
200 },
201 },
202 {
203 .ident = "Fujitsu Lifebook S2000",
204 .matches = {
205 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
206 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
207 },
208 },
209 {
Dmitry Torokhovb4ff99b2005-05-28 02:12:10 -0500210 .ident = "Fujitsu Lifebook S6230",
211 .matches = {
212 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
213 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
214 },
215 },
216 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 .ident = "Fujitsu T70H",
218 .matches = {
219 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
220 DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
221 },
222 },
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500223 {
Vojtech Pavlik20f07942005-07-11 01:06:28 -0500224 .ident = "Fujitsu-Siemens Lifebook T3010",
225 .matches = {
226 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
227 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
228 },
229 },
230 {
Dmitry Torokhov7545c242005-09-04 01:42:10 -0500231 .ident = "Fujitsu-Siemens Lifebook E4010",
232 .matches = {
233 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
234 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
235 },
236 },
237 {
Jiri Kosina3f79b1e2008-01-30 16:34:52 -0500238 .ident = "Fujitsu-Siemens Amilo Pro 2010",
239 .matches = {
240 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
241 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
242 },
243 },
244 {
Jiri Kosinaefd51842008-06-06 00:56:43 -0400245 .ident = "Fujitsu-Siemens Amilo Pro 2030",
246 .matches = {
247 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
248 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
249 },
250 },
251 {
Dmitry Torokhov6e782582007-03-16 00:59:42 -0400252 /*
Dmitry Torokhovcc8310e2007-04-25 00:40:32 -0400253 * No data is coming from the touchscreen unless KBC
254 * is in legacy mode.
255 */
256 .ident = "Panasonic CF-29",
257 .matches = {
258 DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
259 DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
260 },
261 },
262 {
263 /*
Dmitry Torokhov6e782582007-03-16 00:59:42 -0400264 * Errors on MUX ports are reported without raising AUXDATA
265 * causing "spurious NAK" messages.
266 */
267 .ident = "HP Pavilion DV4017EA",
268 .matches = {
269 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
270 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
271 },
272 },
273 {
Dmitry Torokhov9d9d50b2007-06-28 00:44:27 -0400274 /*
275 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
276 */
277 .ident = "HP Pavilion ZT1000",
278 .matches = {
279 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
280 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
281 DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
282 },
283 },
284 {
Elvis Pranskevichus749aea72007-09-04 23:18:21 -0400285 /*
286 * Like DV4017EA does not raise AUXERR for errors on MUX ports.
287 */
288 .ident = "HP Pavilion DV4270ca",
289 .matches = {
290 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
291 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
292 },
293 },
294 {
Dmitry Torokhov59311de2005-05-28 02:12:05 -0500295 .ident = "Toshiba P10",
296 .matches = {
297 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
298 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
299 },
300 },
Dmitry Torokhov865190c2005-07-11 01:06:06 -0500301 {
Dmitry Torokhova91eaa12006-09-14 01:31:06 -0400302 .ident = "Toshiba Equium A110",
303 .matches = {
304 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
305 DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
306 },
307 },
308 {
Dmitry Torokhov865190c2005-07-11 01:06:06 -0500309 .ident = "Alienware Sentia",
310 .matches = {
311 DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
312 DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
313 },
314 },
Dmitry Torokhov4eb38ac2005-12-21 00:51:51 -0500315 {
316 .ident = "Sharp Actius MM20",
317 .matches = {
318 DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
319 DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
320 },
321 },
Vojtech Pavlik3dd01a82006-01-14 00:24:06 -0500322 {
323 .ident = "Sony Vaio FS-115b",
324 .matches = {
325 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
326 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
327 },
328 },
Cjacker Huange2df4522006-08-08 23:38:22 -0400329 {
330 .ident = "Amoi M636/A737",
331 .matches = {
332 DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
333 DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
334 },
335 },
Jiri Kosina2a2dcd62008-03-10 03:08:54 -0700336 {
337 .ident = "Lenovo 3000 n100",
338 .matches = {
339 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Jiri Kosina9ce1ca22008-09-04 22:28:48 -0400340 DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
Jiri Kosina2a2dcd62008-03-10 03:08:54 -0700341 },
342 },
Jiri Kosina0376bce2008-07-03 10:45:38 -0400343 {
344 .ident = "Acer Aspire 1360",
345 .matches = {
346 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
347 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
348 },
349 },
Jiri Kosina5b5b43d2008-07-03 11:00:28 -0400350 {
351 .ident = "Gericom Bellagio",
352 .matches = {
353 DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
354 DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
355 },
356 },
Colin B Macdonald5bd8a052008-10-11 18:16:38 -0400357 {
358 .ident = "IBM 2656",
359 .matches = {
360 DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
361 DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
362 },
363 },
Herton Ronaldo Krzesinski786b11c2008-11-11 09:37:14 -0500364 {
365 .ident = "Dell XPS M1530",
366 .matches = {
367 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
368 DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
369 },
370 },
Dmitry Torokhov5f4ba042008-11-14 13:32:42 -0500371 {
372 .ident = "Compal HEL80I",
373 .matches = {
374 DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
375 DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
376 },
377 },
Jiri Kosina9334e902009-01-06 01:35:45 -0800378 {
379 .ident = "Dell Vostro 1510",
380 .matches = {
381 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
382 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
383 },
384 },
Dmitry Torokhovced909f2009-08-25 19:24:10 -0700385 {
386 .ident = "Acer Aspire 5536",
387 .matches = {
388 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
389 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
390 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
391 },
392 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 { }
394};
395
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700396static struct dmi_system_id __initdata i8042_dmi_reset_table[] = {
397 {
398 .ident = "MSI Wind U-100",
399 .matches = {
400 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
401 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
402 },
403 },
404 {
405 .ident = "LG Electronics X110",
406 .matches = {
407 DMI_MATCH(DMI_BOARD_NAME, "X110"),
408 DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
409 },
410 },
Yan Li9230ccb2009-06-28 22:30:56 -0700411 {
412 .ident = "Acer Aspire One 150",
413 .matches = {
414 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
415 DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
416 },
417 },
418 {
419 .ident = "Advent 4211",
420 .matches = {
421 DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
422 DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
423 },
424 },
425 {
426 .ident = "Medion Akoya Mini E1210",
427 .matches = {
428 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
429 DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
430 },
431 },
432 {
433 .ident = "Mivvy M310",
434 .matches = {
435 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
436 DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
437 },
438 },
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700439 { }
440};
441
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400442#ifdef CONFIG_PNP
443static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
444 {
445 .ident = "Intel MBO Desktop D845PESV",
446 .matches = {
447 DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
448 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
449 },
450 },
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700451 {
452 .ident = "MSI Wind U-100",
453 .matches = {
454 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
455 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
456 },
457 },
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400458 { }
459};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460#endif
461
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500462/*
463 * Some Wistron based laptops need us to explicitly enable the 'Dritek
464 * keyboard extension' to make their extra keys start generating scancodes.
465 * Originally, this was just confined to older laptops, but a few Acer laptops
466 * have turned up in 2007 that also need this again.
467 */
468static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
469 {
470 .ident = "Acer Aspire 5630",
471 .matches = {
472 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
473 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
474 },
475 },
476 {
477 .ident = "Acer Aspire 5650",
478 .matches = {
479 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
480 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
481 },
482 },
483 {
484 .ident = "Acer Aspire 5680",
485 .matches = {
486 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
487 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
488 },
489 },
490 {
Carlos Corbacho0e7e92f2008-07-07 08:55:31 -0400491 .ident = "Acer Aspire 5720",
492 .matches = {
493 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
494 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
495 },
496 },
497 {
Carlos Corbacho5799ddb2008-01-30 16:34:12 -0500498 .ident = "Acer Aspire 9110",
499 .matches = {
500 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
501 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
502 },
503 },
504 {
Bruno Prémont65e660a2008-05-20 13:47:28 -0400505 .ident = "Acer TravelMate 660",
506 .matches = {
507 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
508 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
509 },
510 },
511 {
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500512 .ident = "Acer TravelMate 2490",
513 .matches = {
514 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
515 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
516 },
517 },
Carlos Corbacho8e4ae102008-08-06 14:28:43 -0400518 {
519 .ident = "Acer TravelMate 4280",
520 .matches = {
521 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
522 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
523 },
524 },
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500525 { }
526};
527
528#endif /* CONFIG_X86 */
529
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530#ifdef CONFIG_PNP
531#include <linux/pnp.h>
532
533static int i8042_pnp_kbd_registered;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500534static unsigned int i8042_pnp_kbd_devices;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535static int i8042_pnp_aux_registered;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500536static unsigned int i8042_pnp_aux_devices;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537
538static int i8042_pnp_command_reg;
539static int i8042_pnp_data_reg;
540static int i8042_pnp_kbd_irq;
541static int i8042_pnp_aux_irq;
542
543static char i8042_pnp_kbd_name[32];
544static char i8042_pnp_aux_name[32];
545
546static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
547{
548 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
549 i8042_pnp_data_reg = pnp_port_start(dev,0);
550
551 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
552 i8042_pnp_command_reg = pnp_port_start(dev, 1);
553
554 if (pnp_irq_valid(dev,0))
555 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
556
Roel Kluin8c6deb92008-04-18 00:25:18 -0400557 strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 if (strlen(pnp_dev_name(dev))) {
Roel Kluin8c6deb92008-04-18 00:25:18 -0400559 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
560 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 }
562
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500563 i8042_pnp_kbd_devices++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 return 0;
565}
566
567static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
568{
569 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
570 i8042_pnp_data_reg = pnp_port_start(dev,0);
571
572 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
573 i8042_pnp_command_reg = pnp_port_start(dev, 1);
574
575 if (pnp_irq_valid(dev, 0))
576 i8042_pnp_aux_irq = pnp_irq(dev, 0);
577
Roel Kluin8c6deb92008-04-18 00:25:18 -0400578 strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 if (strlen(pnp_dev_name(dev))) {
Roel Kluin8c6deb92008-04-18 00:25:18 -0400580 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
581 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 }
583
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500584 i8042_pnp_aux_devices++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 return 0;
586}
587
588static struct pnp_device_id pnp_kbd_devids[] = {
589 { .id = "PNP0303", .driver_data = 0 },
590 { .id = "PNP030b", .driver_data = 0 },
591 { .id = "", },
592};
593
594static struct pnp_driver i8042_pnp_kbd_driver = {
595 .name = "i8042 kbd",
596 .id_table = pnp_kbd_devids,
597 .probe = i8042_pnp_kbd_probe,
598};
599
600static struct pnp_device_id pnp_aux_devids[] = {
Dmitry Torokhovb9973952007-04-25 00:40:53 -0400601 { .id = "FJC6000", .driver_data = 0 },
602 { .id = "FJC6001", .driver_data = 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 { .id = "PNP0f03", .driver_data = 0 },
604 { .id = "PNP0f0b", .driver_data = 0 },
605 { .id = "PNP0f0e", .driver_data = 0 },
606 { .id = "PNP0f12", .driver_data = 0 },
607 { .id = "PNP0f13", .driver_data = 0 },
608 { .id = "PNP0f19", .driver_data = 0 },
609 { .id = "PNP0f1c", .driver_data = 0 },
610 { .id = "SYN0801", .driver_data = 0 },
611 { .id = "", },
612};
613
614static struct pnp_driver i8042_pnp_aux_driver = {
615 .name = "i8042 aux",
616 .id_table = pnp_aux_devids,
617 .probe = i8042_pnp_aux_probe,
618};
619
620static void i8042_pnp_exit(void)
621{
Kurt Garloff74af42b2005-05-28 02:11:38 -0500622 if (i8042_pnp_kbd_registered) {
623 i8042_pnp_kbd_registered = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 pnp_unregister_driver(&i8042_pnp_kbd_driver);
Kurt Garloff74af42b2005-05-28 02:11:38 -0500625 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626
Kurt Garloff74af42b2005-05-28 02:11:38 -0500627 if (i8042_pnp_aux_registered) {
628 i8042_pnp_aux_registered = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 pnp_unregister_driver(&i8042_pnp_aux_driver);
Kurt Garloff74af42b2005-05-28 02:11:38 -0500630 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631}
632
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500633static int __init i8042_pnp_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634{
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500635 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400636 int pnp_data_busted = 0;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500637 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400639#ifdef CONFIG_X86
640 if (dmi_check_system(i8042_dmi_nopnp_table))
641 i8042_nopnp = 1;
642#endif
643
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 if (i8042_nopnp) {
Vojtech Pavlik39fa5802005-05-28 02:11:16 -0500645 printk(KERN_INFO "i8042: PNP detection disabled\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 return 0;
647 }
648
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500649 err = pnp_register_driver(&i8042_pnp_kbd_driver);
650 if (!err)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 i8042_pnp_kbd_registered = 1;
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500652
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500653 err = pnp_register_driver(&i8042_pnp_aux_driver);
654 if (!err)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 i8042_pnp_aux_registered = 1;
656
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500657 if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 i8042_pnp_exit();
659#if defined(__ia64__)
660 return -ENODEV;
661#else
Dmitry Torokhov5a72afc2005-05-28 02:11:32 -0500662 printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 return 0;
664#endif
665 }
666
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500667 if (i8042_pnp_kbd_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500668 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
669 "%d", i8042_pnp_kbd_irq);
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500670 if (i8042_pnp_aux_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500671 snprintf(aux_irq_str, sizeof(aux_irq_str),
672 "%d", i8042_pnp_aux_irq);
673
674 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 -0500675 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500676 i8042_pnp_aux_name,
677 i8042_pnp_data_reg, i8042_pnp_command_reg,
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500678 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500679 aux_irq_str);
680
681#if defined(__ia64__)
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500682 if (!i8042_pnp_kbd_devices)
Dmitry Torokhov945ef0d2005-09-04 01:42:00 -0500683 i8042_nokbd = 1;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500684 if (!i8042_pnp_aux_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500685 i8042_noaux = 1;
686#endif
687
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400689 i8042_pnp_data_reg != i8042_data_reg) ||
690 !i8042_pnp_data_reg) {
691 printk(KERN_WARNING
692 "PNP: PS/2 controller has invalid data port %#x; "
693 "using default %#x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 i8042_pnp_data_reg, i8042_data_reg);
695 i8042_pnp_data_reg = i8042_data_reg;
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400696 pnp_data_busted = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697 }
698
699 if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400700 i8042_pnp_command_reg != i8042_command_reg) ||
701 !i8042_pnp_command_reg) {
702 printk(KERN_WARNING
703 "PNP: PS/2 controller has invalid command port %#x; "
704 "using default %#x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700705 i8042_pnp_command_reg, i8042_command_reg);
706 i8042_pnp_command_reg = i8042_command_reg;
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400707 pnp_data_busted = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708 }
709
Dmitry Torokhov945ef0d2005-09-04 01:42:00 -0500710 if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400711 printk(KERN_WARNING
712 "PNP: PS/2 controller doesn't have KBD irq; "
713 "using default %d\n", i8042_kbd_irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714 i8042_pnp_kbd_irq = i8042_kbd_irq;
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400715 pnp_data_busted = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716 }
717
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500718 if (!i8042_noaux && !i8042_pnp_aux_irq) {
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400719 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
720 printk(KERN_WARNING
721 "PNP: PS/2 appears to have AUX port disabled, "
722 "if this is incorrect please boot with "
723 "i8042.nopnp\n");
724 i8042_noaux = 1;
725 } else {
726 printk(KERN_WARNING
727 "PNP: PS/2 controller doesn't have AUX irq; "
728 "using default %d\n", i8042_aux_irq);
729 i8042_pnp_aux_irq = i8042_aux_irq;
730 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731 }
732
Linus Torvalds1da177e2005-04-16 15:20:36 -0700733 i8042_data_reg = i8042_pnp_data_reg;
734 i8042_command_reg = i8042_pnp_command_reg;
735 i8042_kbd_irq = i8042_pnp_kbd_irq;
736 i8042_aux_irq = i8042_pnp_aux_irq;
737
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738 return 0;
739}
740
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500741#else
742static inline int i8042_pnp_init(void) { return 0; }
743static inline void i8042_pnp_exit(void) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744#endif
745
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500746static int __init i8042_platform_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747{
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500748 int retval;
749
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750/*
751 * On ix86 platforms touching the i8042 data register region can do really
752 * bad things. Because of this the region is always reserved on ix86 boxes.
753 *
754 * if (!request_region(I8042_DATA_REG, 16, "i8042"))
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500755 * return -EBUSY;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756 */
757
758 i8042_kbd_irq = I8042_MAP_IRQ(1);
759 i8042_aux_irq = I8042_MAP_IRQ(12);
760
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500761 retval = i8042_pnp_init();
762 if (retval)
763 return retval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700764
765#if defined(__ia64__)
766 i8042_reset = 1;
767#endif
768
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400769#ifdef CONFIG_X86
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700770 if (dmi_check_system(i8042_dmi_reset_table))
771 i8042_reset = 1;
772
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773 if (dmi_check_system(i8042_dmi_noloop_table))
774 i8042_noloop = 1;
775
776 if (dmi_check_system(i8042_dmi_nomux_table))
777 i8042_nomux = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500779 if (dmi_check_system(i8042_dmi_dritek_table))
780 i8042_dritek = 1;
781#endif /* CONFIG_X86 */
782
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500783 return retval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784}
785
786static inline void i8042_platform_exit(void)
787{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700788 i8042_pnp_exit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789}
790
791#endif /* _I8042_X86IA64IO_H */