blob: aa9b299f4e261737e33dad6af4cf323ee31b87f8 [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
Feng Tang5cdfa1c2010-07-07 13:02:16 -070010#ifdef CONFIG_X86
11#include <asm/x86_init.h>
12#endif
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014/*
15 * Names.
16 */
17
18#define I8042_KBD_PHYS_DESC "isa0060/serio0"
19#define I8042_AUX_PHYS_DESC "isa0060/serio1"
20#define I8042_MUX_PHYS_DESC "isa0060/serio%d"
21
22/*
23 * IRQs.
24 */
25
26#if defined(__ia64__)
27# define I8042_MAP_IRQ(x) isa_irq_to_vector((x))
28#else
29# define I8042_MAP_IRQ(x) (x)
30#endif
31
32#define I8042_KBD_IRQ i8042_kbd_irq
33#define I8042_AUX_IRQ i8042_aux_irq
34
35static int i8042_kbd_irq;
36static int i8042_aux_irq;
37
38/*
39 * Register numbers.
40 */
41
42#define I8042_COMMAND_REG i8042_command_reg
43#define I8042_STATUS_REG i8042_command_reg
44#define I8042_DATA_REG i8042_data_reg
45
46static int i8042_command_reg = 0x64;
47static int i8042_data_reg = 0x60;
48
49
50static inline int i8042_read_data(void)
51{
52 return inb(I8042_DATA_REG);
53}
54
55static inline int i8042_read_status(void)
56{
57 return inb(I8042_STATUS_REG);
58}
59
60static inline void i8042_write_data(int val)
61{
62 outb(val, I8042_DATA_REG);
63}
64
65static inline void i8042_write_command(int val)
66{
67 outb(val, I8042_COMMAND_REG);
68}
69
Jiri Kosinac3a34f42008-05-28 01:10:52 -040070#ifdef CONFIG_X86
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
72#include <linux/dmi.h>
73
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -080074static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -080076 /*
77 * Arima-Rioworks HDAMB -
78 * AUX LOOP command does not raise AUX IRQ
79 */
Dmitry Torokhov87d91732008-07-19 00:35:43 -040080 .matches = {
81 DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
82 DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
83 DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
84 },
85 },
86 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -080087 /* ASUS G1S */
Jory A. Pratt685aaca2009-08-03 09:32:34 -070088 .matches = {
89 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
90 DMI_MATCH(DMI_BOARD_NAME, "G1S"),
91 DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
92 },
93 },
94 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -080095 /* ASUS P65UP5 - AUX LOOP command does not raise AUX IRQ */
Dmitry Torokhov90245c12007-06-12 00:33:27 -040096 .matches = {
97 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
98 DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
99 DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
100 },
101 },
102 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 .matches = {
Hans de Goede9ff84a12014-10-11 11:27:37 -0700104 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
105 DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"),
106 },
107 },
108 {
109 .matches = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
111 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
112 DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
113 },
114 },
115 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 .matches = {
117 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
118 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
119 DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
120 },
121 },
Ben Collins6020baf2006-01-05 23:00:38 -0500122 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800123 /* OQO Model 01 */
Ben Collins6020baf2006-01-05 23:00:38 -0500124 .matches = {
125 DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
126 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
127 DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
128 },
129 },
Dmitry Torokhov8c4df742007-06-12 00:33:32 -0400130 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800131 /* ULI EV4873 - AUX LOOP does not work properly */
Dmitry Torokhov8c4df742007-06-12 00:33:32 -0400132 .matches = {
133 DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
134 DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
135 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
136 },
137 },
Jiri Kosina8bf42152007-11-21 14:17:38 -0500138 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800139 /* Microsoft Virtual Machine */
Jiri Kosina8bf42152007-11-21 14:17:38 -0500140 .matches = {
141 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
142 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
143 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
144 },
145 },
Dmitry Torokhov89cdb8c2008-07-03 11:00:28 -0400146 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800147 /* Medion MAM 2070 */
Dmitry Torokhov89cdb8c2008-07-03 11:00:28 -0400148 .matches = {
149 DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
150 DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
151 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
152 },
153 },
Stefan Bader2c6f2cb2008-10-16 22:00:56 -0400154 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800155 /* Blue FB5601 */
Stefan Bader2c6f2cb2008-10-16 22:00:56 -0400156 .matches = {
157 DMI_MATCH(DMI_SYS_VENDOR, "blue"),
158 DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
159 DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
160 },
161 },
Ozan Çağlayana6f66dd2008-12-20 04:04:51 -0500162 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800163 /* Gigabyte M912 */
Ozan Çağlayana6f66dd2008-12-20 04:04:51 -0500164 .matches = {
165 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
166 DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
167 DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
168 },
169 },
Dmitry Torokhov59cc1dd2009-04-07 23:53:26 -0700170 {
Dmitry Torokhova61cd032009-12-13 00:34:06 -0800171 /* Gigabyte M1022M netbook */
172 .matches = {
173 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
174 DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
175 DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
176 },
177 },
178 {
Kamal Mostafa3e1bbc82010-07-19 11:00:52 -0700179 /* Gigabyte Spring Peak - defines wrong chassis type */
180 .matches = {
181 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
182 DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
183 },
184 },
185 {
Dmitry Torokhov7b125b92012-08-21 21:57:15 -0700186 /* Gigabyte T1005 - defines wrong chassis type ("Other") */
187 .matches = {
188 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
189 DMI_MATCH(DMI_PRODUCT_NAME, "T1005"),
190 },
191 },
192 {
193 /* Gigabyte T1005M/P - defines wrong chassis type ("Other") */
194 .matches = {
195 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
196 DMI_MATCH(DMI_PRODUCT_NAME, "T1005M/P"),
197 },
198 },
199 {
Dmitry Torokhov59cc1dd2009-04-07 23:53:26 -0700200 .matches = {
201 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
202 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
203 DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
204 },
205 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 { }
207};
208
209/*
Dmitry Torokhov68da1662014-10-10 12:19:03 -0700210 * Some laptops do implement active multiplexing mode correctly;
211 * unfortunately they are in minority.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 */
Dmitry Torokhov68da1662014-10-10 12:19:03 -0700213static const struct dmi_system_id __initconst i8042_dmi_mux_table[] = {
Jiri Kosinaefd51842008-06-06 00:56:43 -0400214 {
Dmitry Torokhov6e782582007-03-16 00:59:42 -0400215 /*
Dmitry Torokhov68da1662014-10-10 12:19:03 -0700216 * Panasonic CF-18 needs to be in MUX mode since the
217 * touchscreen is on serio3 and it also has touchpad.
Dmitry Torokhov6e782582007-03-16 00:59:42 -0400218 */
Dmitry Torokhov6e782582007-03-16 00:59:42 -0400219 .matches = {
Dmitry Torokhov68da1662014-10-10 12:19:03 -0700220 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
Hans de Goeded2682112014-09-11 10:10:26 -0700221 },
222 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 { }
224};
225
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800226static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700227 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800228 /* MSI Wind U-100 */
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700229 .matches = {
230 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
231 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
232 },
233 },
234 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800235 /* LG Electronics X110 */
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700236 .matches = {
237 DMI_MATCH(DMI_BOARD_NAME, "X110"),
238 DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
239 },
240 },
Yan Li9230ccb2009-06-28 22:30:56 -0700241 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800242 /* Acer Aspire One 150 */
Yan Li9230ccb2009-06-28 22:30:56 -0700243 .matches = {
244 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
245 DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
246 },
247 },
248 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800249 /* Advent 4211 */
Yan Li9230ccb2009-06-28 22:30:56 -0700250 .matches = {
251 DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
252 DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
253 },
254 },
255 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800256 /* Medion Akoya Mini E1210 */
Yan Li9230ccb2009-06-28 22:30:56 -0700257 .matches = {
258 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
259 DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
260 },
261 },
262 {
Christoph Fritz31968ec2010-03-13 22:26:23 -0800263 /* Medion Akoya E1222 */
264 .matches = {
265 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
266 DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
267 },
268 },
269 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800270 /* Mivvy M310 */
Yan Li9230ccb2009-06-28 22:30:56 -0700271 .matches = {
272 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
273 DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
274 },
275 },
Anisse Astier049e2d12009-12-01 01:14:25 -0800276 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800277 /* Dell Vostro 1320 */
Anisse Astier049e2d12009-12-01 01:14:25 -0800278 .matches = {
279 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
280 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
281 },
282 },
283 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800284 /* Dell Vostro 1520 */
Anisse Astier049e2d12009-12-01 01:14:25 -0800285 .matches = {
286 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
287 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
288 },
289 },
290 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800291 /* Dell Vostro 1720 */
Anisse Astier049e2d12009-12-01 01:14:25 -0800292 .matches = {
293 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
294 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
295 },
296 },
Igor Murzov82b982c2012-02-03 00:19:07 -0800297 {
298 /* Lenovo Ideapad U455 */
299 .matches = {
300 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
301 DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
302 },
303 },
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700304 { }
305};
306
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400307#ifdef CONFIG_PNP
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800308static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400309 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800310 /* Intel MBO Desktop D845PESV */
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400311 .matches = {
312 DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
313 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
314 },
315 },
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700316 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800317 /* MSI Wind U-100 */
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700318 .matches = {
319 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
320 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
321 },
322 },
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400323 { }
324};
Dmitry Torokhov1c7827a2009-09-03 21:45:34 -0700325
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800326static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
Dmitry Torokhov1c7827a2009-09-03 21:45:34 -0700327 {
Dmitry Torokhov1c7827a2009-09-03 21:45:34 -0700328 .matches = {
329 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
330 },
331 },
332 {
Dmitry Torokhov1c7827a2009-09-03 21:45:34 -0700333 .matches = {
334 DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
335 },
336 },
337 {
Dmitry Torokhov1c7827a2009-09-03 21:45:34 -0700338 .matches = {
339 DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
340 },
341 },
342 {
Dmitry Torokhov1c7827a2009-09-03 21:45:34 -0700343 .matches = {
344 DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
345 },
346 },
347 { }
348};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349#endif
350
Jiri Kosinaf8313ef2011-01-08 01:37:26 -0800351static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
352 {
353 /* Dell Vostro V13 */
354 .matches = {
355 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
356 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
357 },
358 },
Tomas Miljenovićb42c90972011-11-04 23:59:49 -0700359 {
360 /* Newer HP Pavilion dv4 models */
361 .matches = {
362 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
363 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
364 },
365 },
Hans de Goedecc18a692014-09-10 13:53:37 -0700366 {
Hans de Goede993b3a32014-10-24 14:55:24 -0700367 /* Fujitsu A544 laptop */
368 /* https://bugzilla.redhat.com/show_bug.cgi?id=1111138 */
369 .matches = {
370 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
371 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK A544"),
372 },
373 },
374 {
375 /* Fujitsu AH544 laptop */
376 /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
377 .matches = {
378 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
379 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"),
380 },
381 },
382 {
Hans de Goedecc18a692014-09-10 13:53:37 -0700383 /* Fujitsu U574 laptop */
384 /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
385 .matches = {
386 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
387 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"),
388 },
389 },
Jiri Kosinaf8313ef2011-01-08 01:37:26 -0800390 { }
391};
392
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500393/*
394 * Some Wistron based laptops need us to explicitly enable the 'Dritek
395 * keyboard extension' to make their extra keys start generating scancodes.
396 * Originally, this was just confined to older laptops, but a few Acer laptops
397 * have turned up in 2007 that also need this again.
398 */
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800399static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500400 {
Pali Rohára06a09c2010-12-27 17:21:45 -0800401 /* Acer Aspire 5100 */
402 .matches = {
403 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
404 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
405 },
406 },
407 {
Elliott Sales de Andradee6edbdc2010-01-10 23:59:05 -0800408 /* Acer Aspire 5610 */
409 .matches = {
410 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
411 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
412 },
413 },
414 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800415 /* Acer Aspire 5630 */
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500416 .matches = {
417 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
418 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
419 },
420 },
421 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800422 /* Acer Aspire 5650 */
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500423 .matches = {
424 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
425 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
426 },
427 },
428 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800429 /* Acer Aspire 5680 */
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500430 .matches = {
431 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
432 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
433 },
434 },
435 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800436 /* Acer Aspire 5720 */
Carlos Corbacho0e7e92f2008-07-07 08:55:31 -0400437 .matches = {
438 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
439 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
440 },
441 },
442 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800443 /* Acer Aspire 9110 */
Carlos Corbacho5799ddb2008-01-30 16:34:12 -0500444 .matches = {
445 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
446 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
447 },
448 },
449 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800450 /* Acer TravelMate 660 */
Bruno Prémont65e660a2008-05-20 13:47:28 -0400451 .matches = {
452 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
453 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
454 },
455 },
456 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800457 /* Acer TravelMate 2490 */
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500458 .matches = {
459 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
460 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
461 },
462 },
Carlos Corbacho8e4ae102008-08-06 14:28:43 -0400463 {
Dmitry Torokhovf909b1d2009-12-04 10:24:19 -0800464 /* Acer TravelMate 4280 */
Carlos Corbacho8e4ae102008-08-06 14:28:43 -0400465 .matches = {
466 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
467 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
468 },
469 },
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500470 { }
471};
472
473#endif /* CONFIG_X86 */
474
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475#ifdef CONFIG_PNP
476#include <linux/pnp.h>
477
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700478static bool i8042_pnp_kbd_registered;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500479static unsigned int i8042_pnp_kbd_devices;
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700480static bool i8042_pnp_aux_registered;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500481static unsigned int i8042_pnp_aux_devices;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482
483static int i8042_pnp_command_reg;
484static int i8042_pnp_data_reg;
485static int i8042_pnp_kbd_irq;
486static int i8042_pnp_aux_irq;
487
488static char i8042_pnp_kbd_name[32];
489static char i8042_pnp_aux_name[32];
490
Hans de Goedea7c58682014-04-19 20:47:35 -0700491static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
492{
493 strlcpy(dst, "PNP:", dst_size);
494
495 while (id) {
496 strlcat(dst, " ", dst_size);
497 strlcat(dst, id->id, dst_size);
498 id = id->next;
499 }
500}
501
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
503{
504 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
505 i8042_pnp_data_reg = pnp_port_start(dev,0);
506
507 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
508 i8042_pnp_command_reg = pnp_port_start(dev, 1);
509
510 if (pnp_irq_valid(dev,0))
511 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
512
Roel Kluin8c6deb92008-04-18 00:25:18 -0400513 strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700514 if (strlen(pnp_dev_name(dev))) {
Roel Kluin8c6deb92008-04-18 00:25:18 -0400515 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
516 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 }
Hans de Goedea7c58682014-04-19 20:47:35 -0700518 i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
519 sizeof(i8042_kbd_firmware_id));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520
Alan Stern3e6e15a2010-03-08 23:42:46 -0800521 /* Keyboard ports are always supposed to be wakeup-enabled */
522 device_set_wakeup_enable(&dev->dev, true);
523
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500524 i8042_pnp_kbd_devices++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525 return 0;
526}
527
528static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
529{
530 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
531 i8042_pnp_data_reg = pnp_port_start(dev,0);
532
533 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
534 i8042_pnp_command_reg = pnp_port_start(dev, 1);
535
536 if (pnp_irq_valid(dev, 0))
537 i8042_pnp_aux_irq = pnp_irq(dev, 0);
538
Roel Kluin8c6deb92008-04-18 00:25:18 -0400539 strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 if (strlen(pnp_dev_name(dev))) {
Roel Kluin8c6deb92008-04-18 00:25:18 -0400541 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
542 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 }
Hans de Goedea7c58682014-04-19 20:47:35 -0700544 i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
545 sizeof(i8042_aux_firmware_id));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500547 i8042_pnp_aux_devices++;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 return 0;
549}
550
551static struct pnp_device_id pnp_kbd_devids[] = {
Matthew Garrett09fac072010-05-19 10:11:13 -0700552 { .id = "PNP0300", .driver_data = 0 },
553 { .id = "PNP0301", .driver_data = 0 },
554 { .id = "PNP0302", .driver_data = 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555 { .id = "PNP0303", .driver_data = 0 },
Matthew Garrett09fac072010-05-19 10:11:13 -0700556 { .id = "PNP0304", .driver_data = 0 },
557 { .id = "PNP0305", .driver_data = 0 },
558 { .id = "PNP0306", .driver_data = 0 },
559 { .id = "PNP0309", .driver_data = 0 },
560 { .id = "PNP030a", .driver_data = 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 { .id = "PNP030b", .driver_data = 0 },
Matthew Garrett09fac072010-05-19 10:11:13 -0700562 { .id = "PNP0320", .driver_data = 0 },
563 { .id = "PNP0343", .driver_data = 0 },
564 { .id = "PNP0344", .driver_data = 0 },
565 { .id = "PNP0345", .driver_data = 0 },
566 { .id = "CPQA0D7", .driver_data = 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 { .id = "", },
568};
Tom Gundersen78551272013-10-31 00:33:54 -0700569MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570
571static struct pnp_driver i8042_pnp_kbd_driver = {
572 .name = "i8042 kbd",
573 .id_table = pnp_kbd_devids,
574 .probe = i8042_pnp_kbd_probe,
575};
576
577static struct pnp_device_id pnp_aux_devids[] = {
Matthew Garrettdba06b82010-05-19 10:11:13 -0700578 { .id = "AUI0200", .driver_data = 0 },
Dmitry Torokhovb9973952007-04-25 00:40:53 -0400579 { .id = "FJC6000", .driver_data = 0 },
580 { .id = "FJC6001", .driver_data = 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 { .id = "PNP0f03", .driver_data = 0 },
582 { .id = "PNP0f0b", .driver_data = 0 },
583 { .id = "PNP0f0e", .driver_data = 0 },
584 { .id = "PNP0f12", .driver_data = 0 },
585 { .id = "PNP0f13", .driver_data = 0 },
586 { .id = "PNP0f19", .driver_data = 0 },
587 { .id = "PNP0f1c", .driver_data = 0 },
588 { .id = "SYN0801", .driver_data = 0 },
589 { .id = "", },
590};
Tom Gundersen78551272013-10-31 00:33:54 -0700591MODULE_DEVICE_TABLE(pnp, pnp_aux_devids);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592
593static struct pnp_driver i8042_pnp_aux_driver = {
594 .name = "i8042 aux",
595 .id_table = pnp_aux_devids,
596 .probe = i8042_pnp_aux_probe,
597};
598
599static void i8042_pnp_exit(void)
600{
Kurt Garloff74af42b2005-05-28 02:11:38 -0500601 if (i8042_pnp_kbd_registered) {
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700602 i8042_pnp_kbd_registered = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 pnp_unregister_driver(&i8042_pnp_kbd_driver);
Kurt Garloff74af42b2005-05-28 02:11:38 -0500604 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700605
Kurt Garloff74af42b2005-05-28 02:11:38 -0500606 if (i8042_pnp_aux_registered) {
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700607 i8042_pnp_aux_registered = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 pnp_unregister_driver(&i8042_pnp_aux_driver);
Kurt Garloff74af42b2005-05-28 02:11:38 -0500609 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610}
611
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500612static int __init i8042_pnp_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613{
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500614 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
Dmitry Torokhov7dcc9c22009-10-12 21:34:25 -0700615 bool pnp_data_busted = false;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500616 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400618#ifdef CONFIG_X86
619 if (dmi_check_system(i8042_dmi_nopnp_table))
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700620 i8042_nopnp = true;
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400621#endif
622
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 if (i8042_nopnp) {
Joe Perches4eb3c302010-11-29 23:33:07 -0800624 pr_info("PNP detection disabled\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 return 0;
626 }
627
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500628 err = pnp_register_driver(&i8042_pnp_kbd_driver);
629 if (!err)
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700630 i8042_pnp_kbd_registered = true;
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500631
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500632 err = pnp_register_driver(&i8042_pnp_aux_driver);
633 if (!err)
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700634 i8042_pnp_aux_registered = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500636 if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 i8042_pnp_exit();
638#if defined(__ia64__)
639 return -ENODEV;
640#else
Joe Perches4eb3c302010-11-29 23:33:07 -0800641 pr_info("PNP: No PS/2 controller found. Probing ports directly.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 return 0;
643#endif
644 }
645
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500646 if (i8042_pnp_kbd_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500647 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
648 "%d", i8042_pnp_kbd_irq);
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500649 if (i8042_pnp_aux_devices)
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500650 snprintf(aux_irq_str, sizeof(aux_irq_str),
651 "%d", i8042_pnp_aux_irq);
652
Joe Perches4eb3c302010-11-29 23:33:07 -0800653 pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500654 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500655 i8042_pnp_aux_name,
656 i8042_pnp_data_reg, i8042_pnp_command_reg,
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500657 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500658 aux_irq_str);
659
660#if defined(__ia64__)
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500661 if (!i8042_pnp_kbd_devices)
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700662 i8042_nokbd = true;
Bjorn Helgaas2bfc3c62006-03-14 00:12:24 -0500663 if (!i8042_pnp_aux_devices)
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700664 i8042_noaux = true;
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500665#endif
666
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667 if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400668 i8042_pnp_data_reg != i8042_data_reg) ||
669 !i8042_pnp_data_reg) {
Joe Perches4eb3c302010-11-29 23:33:07 -0800670 pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 i8042_pnp_data_reg, i8042_data_reg);
672 i8042_pnp_data_reg = i8042_data_reg;
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700673 pnp_data_busted = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 }
675
676 if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400677 i8042_pnp_command_reg != i8042_command_reg) ||
678 !i8042_pnp_command_reg) {
Joe Perches4eb3c302010-11-29 23:33:07 -0800679 pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 i8042_pnp_command_reg, i8042_command_reg);
681 i8042_pnp_command_reg = i8042_command_reg;
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700682 pnp_data_busted = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 }
684
Dmitry Torokhov945ef0d2005-09-04 01:42:00 -0500685 if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
Joe Perches4eb3c302010-11-29 23:33:07 -0800686 pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n",
687 i8042_kbd_irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 i8042_pnp_kbd_irq = i8042_kbd_irq;
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700689 pnp_data_busted = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 }
691
Dmitry Torokhovc3d31e72005-09-04 01:41:51 -0500692 if (!i8042_noaux && !i8042_pnp_aux_irq) {
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400693 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
Joe Perches4eb3c302010-11-29 23:33:07 -0800694 pr_warn("PNP: PS/2 appears to have AUX port disabled, "
695 "if this is incorrect please boot with i8042.nopnp\n");
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700696 i8042_noaux = true;
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400697 } else {
Joe Perches4eb3c302010-11-29 23:33:07 -0800698 pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n",
699 i8042_aux_irq);
Dmitry Torokhov080c6522007-07-18 00:38:01 -0400700 i8042_pnp_aux_irq = i8042_aux_irq;
701 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 }
703
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704 i8042_data_reg = i8042_pnp_data_reg;
705 i8042_command_reg = i8042_pnp_command_reg;
706 i8042_kbd_irq = i8042_pnp_kbd_irq;
707 i8042_aux_irq = i8042_pnp_aux_irq;
708
Dmitry Torokhov1c7827a2009-09-03 21:45:34 -0700709#ifdef CONFIG_X86
710 i8042_bypass_aux_irq_test = !pnp_data_busted &&
711 dmi_check_system(i8042_dmi_laptop_table);
712#endif
713
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714 return 0;
715}
716
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500717#else
718static inline int i8042_pnp_init(void) { return 0; }
719static inline void i8042_pnp_exit(void) { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720#endif
721
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500722static int __init i8042_platform_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723{
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500724 int retval;
725
Feng Tang5cdfa1c2010-07-07 13:02:16 -0700726#ifdef CONFIG_X86
Ondrej Zaryad686522012-12-11 22:18:05 +0100727 u8 a20_on = 0xdf;
Feng Tang5cdfa1c2010-07-07 13:02:16 -0700728 /* Just return if pre-detection shows no i8042 controller exist */
729 if (!x86_platform.i8042_detect())
730 return -ENODEV;
731#endif
732
Linus Torvalds1da177e2005-04-16 15:20:36 -0700733/*
734 * On ix86 platforms touching the i8042 data register region can do really
735 * bad things. Because of this the region is always reserved on ix86 boxes.
736 *
737 * if (!request_region(I8042_DATA_REG, 16, "i8042"))
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500738 * return -EBUSY;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739 */
740
741 i8042_kbd_irq = I8042_MAP_IRQ(1);
742 i8042_aux_irq = I8042_MAP_IRQ(12);
743
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500744 retval = i8042_pnp_init();
745 if (retval)
746 return retval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747
748#if defined(__ia64__)
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700749 i8042_reset = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750#endif
751
Jiri Kosinac3a34f42008-05-28 01:10:52 -0400752#ifdef CONFIG_X86
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700753 if (dmi_check_system(i8042_dmi_reset_table))
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700754 i8042_reset = true;
Arjan van de Ven7c46e232009-04-11 16:50:13 -0700755
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756 if (dmi_check_system(i8042_dmi_noloop_table))
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700757 i8042_noloop = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700758
Dmitry Torokhov68da1662014-10-10 12:19:03 -0700759 if (dmi_check_system(i8042_dmi_mux_table))
760 i8042_nomux = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761
Jiri Kosinaf8313ef2011-01-08 01:37:26 -0800762 if (dmi_check_system(i8042_dmi_notimeout_table))
763 i8042_notimeout = true;
764
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500765 if (dmi_check_system(i8042_dmi_dritek_table))
Dmitry Torokhov386b3842009-09-09 19:08:16 -0700766 i8042_dritek = true;
Ondrej Zaryad686522012-12-11 22:18:05 +0100767
768 /*
769 * A20 was already enabled during early kernel init. But some buggy
770 * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
771 * resume from S3. So we do it here and hope that nothing breaks.
772 */
773 i8042_command(&a20_on, 0x10d1);
774 i8042_command(NULL, 0x00ff); /* Null command for SMM firmware */
Carlos Corbacho8987fec2008-01-21 01:04:40 -0500775#endif /* CONFIG_X86 */
776
Dmitry Torokhov8d5987a2005-09-04 01:41:38 -0500777 return retval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778}
779
780static inline void i8042_platform_exit(void)
781{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782 i8042_pnp_exit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783}
784
785#endif /* _I8042_X86IA64IO_H */