1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _I8042_ACPIPNPIO_H
3 #define _I8042_ACPIPNPIO_H
4 
5 
6 #ifdef CONFIG_X86
7 #include <asm/x86_init.h>
8 #endif
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 
i8042_read_data(void)46 static inline int i8042_read_data(void)
47 {
48 	return inb(I8042_DATA_REG);
49 }
50 
i8042_read_status(void)51 static inline int i8042_read_status(void)
52 {
53 	return inb(I8042_STATUS_REG);
54 }
55 
i8042_write_data(int val)56 static inline void i8042_write_data(int val)
57 {
58 	outb(val, I8042_DATA_REG);
59 }
60 
i8042_write_command(int val)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 #define SERIO_QUIRK_NOKBD		BIT(0)
71 #define SERIO_QUIRK_NOAUX		BIT(1)
72 #define SERIO_QUIRK_NOMUX		BIT(2)
73 #define SERIO_QUIRK_FORCEMUX		BIT(3)
74 #define SERIO_QUIRK_UNLOCK		BIT(4)
75 #define SERIO_QUIRK_PROBE_DEFER		BIT(5)
76 #define SERIO_QUIRK_RESET_ALWAYS	BIT(6)
77 #define SERIO_QUIRK_RESET_NEVER		BIT(7)
78 #define SERIO_QUIRK_DIECT		BIT(8)
79 #define SERIO_QUIRK_DUMBKBD		BIT(9)
80 #define SERIO_QUIRK_NOLOOP		BIT(10)
81 #define SERIO_QUIRK_NOTIMEOUT		BIT(11)
82 #define SERIO_QUIRK_KBDRESET		BIT(12)
83 #define SERIO_QUIRK_DRITEK		BIT(13)
84 #define SERIO_QUIRK_NOPNP		BIT(14)
85 
86 /* Quirk table for different mainboards. Options similar or identical to i8042
87  * module parameters.
88  * ORDERING IS IMPORTANT! The first match will be apllied and the rest ignored.
89  * This allows entries to overwrite vendor wide quirks on a per device basis.
90  * Where this is irrelevant, entries are sorted case sensitive by DMI_SYS_VENDOR
91  * and/or DMI_BOARD_VENDOR to make it easier to avoid dublicate entries.
92  */
93 static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
94 	{
95 		.matches = {
96 			DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
97 			DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
98 		},
99 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
100 	},
101 	{
102 		.matches = {
103 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
104 			DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"),
105 		},
106 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
107 	},
108 	{
109 		/* Asus X450LCP */
110 		.matches = {
111 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
112 			DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"),
113 		},
114 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_NEVER)
115 	},
116 	{
117 		/* ASUS ZenBook UX425UA */
118 		.matches = {
119 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
120 			DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX425UA"),
121 		},
122 		.driver_data = (void *)(SERIO_QUIRK_PROBE_DEFER | SERIO_QUIRK_RESET_NEVER)
123 	},
124 	{
125 		/* ASUS ZenBook UM325UA */
126 		.matches = {
127 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
128 			DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"),
129 		},
130 		.driver_data = (void *)(SERIO_QUIRK_PROBE_DEFER | SERIO_QUIRK_RESET_NEVER)
131 	},
132 	/*
133 	 * On some Asus laptops, just running self tests cause problems.
134 	 */
135 	{
136 		.matches = {
137 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
138 			DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
139 		},
140 		.driver_data = (void *)(SERIO_QUIRK_RESET_NEVER)
141 	},
142 	{
143 		.matches = {
144 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
145 			DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */
146 		},
147 		.driver_data = (void *)(SERIO_QUIRK_RESET_NEVER)
148 	},
149 	{
150 		/* ASUS P65UP5 - AUX LOOP command does not raise AUX IRQ */
151 		.matches = {
152 			DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
153 			DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
154 			DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
155 		},
156 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
157 	},
158 	{
159 		/* ASUS G1S */
160 		.matches = {
161 			DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
162 			DMI_MATCH(DMI_BOARD_NAME, "G1S"),
163 			DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
164 		},
165 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
166 	},
167 	{
168 		.matches = {
169 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
170 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
171 		},
172 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
173 	},
174 	{
175 		/* Acer Aspire 5710 */
176 		.matches = {
177 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
178 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710"),
179 		},
180 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
181 	},
182 	{
183 		/* Acer Aspire 7738 */
184 		.matches = {
185 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
186 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7738"),
187 		},
188 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
189 	},
190 	{
191 		/* Acer Aspire 5536 */
192 		.matches = {
193 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
194 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
195 			DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
196 		},
197 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
198 	},
199 	{
200 		/*
201 		 * Acer Aspire 5738z
202 		 * Touchpad stops working in mux mode when dis- + re-enabled
203 		 * with the touchpad enable/disable toggle hotkey
204 		 */
205 		.matches = {
206 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
207 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
208 		},
209 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
210 	},
211 	{
212 		/* Acer Aspire One 150 */
213 		.matches = {
214 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
215 			DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
216 		},
217 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
218 	},
219 	{
220 		.matches = {
221 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
222 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A114-31"),
223 		},
224 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
225 	},
226 	{
227 		.matches = {
228 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
229 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A314-31"),
230 		},
231 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
232 	},
233 	{
234 		.matches = {
235 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
236 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-31"),
237 		},
238 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
239 	},
240 	{
241 		.matches = {
242 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
243 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-132"),
244 		},
245 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
246 	},
247 	{
248 		.matches = {
249 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
250 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-332"),
251 		},
252 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
253 	},
254 	{
255 		.matches = {
256 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
257 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-432"),
258 		},
259 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
260 	},
261 	{
262 		.matches = {
263 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
264 			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate Spin B118-RN"),
265 		},
266 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
267 	},
268 	/*
269 	 * Some Wistron based laptops need us to explicitly enable the 'Dritek
270 	 * keyboard extension' to make their extra keys start generating scancodes.
271 	 * Originally, this was just confined to older laptops, but a few Acer laptops
272 	 * have turned up in 2007 that also need this again.
273 	 */
274 	{
275 		/* Acer Aspire 5100 */
276 		.matches = {
277 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
278 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
279 		},
280 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
281 	},
282 	{
283 		/* Acer Aspire 5610 */
284 		.matches = {
285 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
286 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
287 		},
288 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
289 	},
290 	{
291 		/* Acer Aspire 5630 */
292 		.matches = {
293 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
294 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
295 		},
296 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
297 	},
298 	{
299 		/* Acer Aspire 5650 */
300 		.matches = {
301 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
302 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
303 		},
304 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
305 	},
306 	{
307 		/* Acer Aspire 5680 */
308 		.matches = {
309 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
310 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
311 		},
312 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
313 	},
314 	{
315 		/* Acer Aspire 5720 */
316 		.matches = {
317 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
318 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
319 		},
320 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
321 	},
322 	{
323 		/* Acer Aspire 9110 */
324 		.matches = {
325 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
326 			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
327 		},
328 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
329 	},
330 	{
331 		/* Acer TravelMate 660 */
332 		.matches = {
333 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
334 			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
335 		},
336 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
337 	},
338 	{
339 		/* Acer TravelMate 2490 */
340 		.matches = {
341 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
342 			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
343 		},
344 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
345 	},
346 	{
347 		/* Acer TravelMate 4280 */
348 		.matches = {
349 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
350 			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
351 		},
352 		.driver_data = (void *)(SERIO_QUIRK_DRITEK)
353 	},
354 	{
355 		/* Acer TravelMate P459-G2-M */
356 		.matches = {
357 			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
358 			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate P459-G2-M"),
359 		},
360 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
361 	},
362 	{
363 		/* Amoi M636/A737 */
364 		.matches = {
365 			DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
366 			DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
367 		},
368 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
369 	},
370 	{
371 		.matches = {
372 			DMI_MATCH(DMI_SYS_VENDOR, "ByteSpeed LLC"),
373 			DMI_MATCH(DMI_PRODUCT_NAME, "ByteSpeed Laptop C15B"),
374 		},
375 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
376 	},
377 	{
378 		/* Compal HEL80I */
379 		.matches = {
380 			DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
381 			DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
382 		},
383 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
384 	},
385 	{
386 		.matches = {
387 			DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
388 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant"),
389 			DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
390 		},
391 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
392 	},
393 	{
394 		.matches = {
395 			DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
396 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant"),
397 			DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
398 		},
399 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
400 	},
401 	{
402 		/* Advent 4211 */
403 		.matches = {
404 			DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
405 			DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
406 		},
407 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
408 	},
409 	{
410 		/* Dell Embedded Box PC 3000 */
411 		.matches = {
412 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
413 			DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
414 		},
415 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
416 	},
417 	{
418 		/* Dell XPS M1530 */
419 		.matches = {
420 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
421 			DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
422 		},
423 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
424 	},
425 	{
426 		/* Dell Vostro 1510 */
427 		.matches = {
428 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
429 			DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
430 		},
431 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
432 	},
433 	{
434 		/* Dell Vostro V13 */
435 		.matches = {
436 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
437 			DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
438 		},
439 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_NOTIMEOUT)
440 	},
441 	{
442 		/* Dell Vostro 1320 */
443 		.matches = {
444 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
445 			DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
446 		},
447 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
448 	},
449 	{
450 		/* Dell Vostro 1520 */
451 		.matches = {
452 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
453 			DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
454 		},
455 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
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 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
464 	},
465 	{
466 		/* Entroware Proteus */
467 		.matches = {
468 			DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
469 			DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
470 			DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
471 		},
472 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS)
473 	},
474 	/*
475 	 * Some Fujitsu notebooks are having trouble with touchpads if
476 	 * active multiplexing mode is activated. Luckily they don't have
477 	 * external PS/2 ports so we can safely disable it.
478 	 * ... apparently some Toshibas don't like MUX mode either and
479 	 * die horrible death on reboot.
480 	 */
481 	{
482 		/* Fujitsu Lifebook P7010/P7010D */
483 		.matches = {
484 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
485 			DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
486 		},
487 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
488 	},
489 	{
490 		/* Fujitsu Lifebook P5020D */
491 		.matches = {
492 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
493 			DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
494 		},
495 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
496 	},
497 	{
498 		/* Fujitsu Lifebook S2000 */
499 		.matches = {
500 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
501 			DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
502 		},
503 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
504 	},
505 	{
506 		/* Fujitsu Lifebook S6230 */
507 		.matches = {
508 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
509 			DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
510 		},
511 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
512 	},
513 	{
514 		/* Fujitsu Lifebook T725 laptop */
515 		.matches = {
516 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
517 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"),
518 		},
519 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_NOTIMEOUT)
520 	},
521 	{
522 		/* Fujitsu Lifebook U745 */
523 		.matches = {
524 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
525 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"),
526 		},
527 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
528 	},
529 	{
530 		/* Fujitsu T70H */
531 		.matches = {
532 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
533 			DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
534 		},
535 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
536 	},
537 	{
538 		/* Fujitsu A544 laptop */
539 		/* https://bugzilla.redhat.com/show_bug.cgi?id=1111138 */
540 		.matches = {
541 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
542 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK A544"),
543 		},
544 		.driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
545 	},
546 	{
547 		/* Fujitsu AH544 laptop */
548 		/* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
549 		.matches = {
550 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
551 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"),
552 		},
553 		.driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
554 	},
555 	{
556 		/* Fujitsu U574 laptop */
557 		/* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
558 		.matches = {
559 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
560 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"),
561 		},
562 		.driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
563 	},
564 	{
565 		/* Fujitsu UH554 laptop */
566 		.matches = {
567 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
568 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK UH544"),
569 		},
570 		.driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
571 	},
572 	{
573 		/* Fujitsu Lifebook P7010 */
574 		.matches = {
575 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
576 			DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
577 		},
578 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
579 	},
580 	{
581 		/* Fujitsu-Siemens Lifebook T3010 */
582 		.matches = {
583 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
584 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
585 		},
586 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
587 	},
588 	{
589 		/* Fujitsu-Siemens Lifebook E4010 */
590 		.matches = {
591 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
592 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
593 		},
594 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
595 	},
596 	{
597 		/* Fujitsu-Siemens Amilo Pro 2010 */
598 		.matches = {
599 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
600 			DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
601 		},
602 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
603 	},
604 	{
605 		/* Fujitsu-Siemens Amilo Pro 2030 */
606 		.matches = {
607 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
608 			DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
609 		},
610 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
611 	},
612 	{
613 		/* Fujitsu Lifebook A574/H */
614 		.matches = {
615 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
616 			DMI_MATCH(DMI_PRODUCT_NAME, "FMVA0501PZ"),
617 		},
618 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
619 	},
620 	{
621 		/* Fujitsu Lifebook E5411 */
622 		.matches = {
623 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU CLIENT COMPUTING LIMITED"),
624 			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E5411"),
625 		},
626 		.driver_data = (void *)(SERIO_QUIRK_NOAUX)
627 	},
628 	{
629 		/* Gigabyte M912 */
630 		.matches = {
631 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
632 			DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
633 			DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
634 		},
635 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
636 	},
637 	{
638 		/* Gigabyte Spring Peak - defines wrong chassis type */
639 		.matches = {
640 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
641 			DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
642 		},
643 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
644 	},
645 	{
646 		/* Gigabyte T1005 - defines wrong chassis type ("Other") */
647 		.matches = {
648 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
649 			DMI_MATCH(DMI_PRODUCT_NAME, "T1005"),
650 		},
651 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
652 	},
653 	{
654 		/* Gigabyte T1005M/P - defines wrong chassis type ("Other") */
655 		.matches = {
656 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
657 			DMI_MATCH(DMI_PRODUCT_NAME, "T1005M/P"),
658 		},
659 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
660 	},
661 	/*
662 	 * Some laptops need keyboard reset before probing for the trackpad to get
663 	 * it detected, initialised & finally work.
664 	 */
665 	{
666 		/* Gigabyte P35 v2 - Elantech touchpad */
667 		.matches = {
668 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
669 			DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"),
670 		},
671 		.driver_data = (void *)(SERIO_QUIRK_KBDRESET)
672 	},
673 		{
674 		/* Aorus branded Gigabyte X3 Plus - Elantech touchpad */
675 		.matches = {
676 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
677 			DMI_MATCH(DMI_PRODUCT_NAME, "X3"),
678 		},
679 		.driver_data = (void *)(SERIO_QUIRK_KBDRESET)
680 	},
681 	{
682 		/* Gigabyte P34 - Elantech touchpad */
683 		.matches = {
684 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
685 			DMI_MATCH(DMI_PRODUCT_NAME, "P34"),
686 		},
687 		.driver_data = (void *)(SERIO_QUIRK_KBDRESET)
688 	},
689 	{
690 		/* Gigabyte P57 - Elantech touchpad */
691 		.matches = {
692 			DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
693 			DMI_MATCH(DMI_PRODUCT_NAME, "P57"),
694 		},
695 		.driver_data = (void *)(SERIO_QUIRK_KBDRESET)
696 	},
697 	{
698 		/* Gericom Bellagio */
699 		.matches = {
700 			DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
701 			DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
702 		},
703 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
704 	},
705 	{
706 		/* Gigabyte M1022M netbook */
707 		.matches = {
708 			DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
709 			DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
710 			DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
711 		},
712 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
713 	},
714 	{
715 		.matches = {
716 			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
717 			DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
718 			DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
719 		},
720 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
721 	},
722 	{
723 		/*
724 		 * HP Pavilion DV4017EA -
725 		 * errors on MUX ports are reported without raising AUXDATA
726 		 * causing "spurious NAK" messages.
727 		 */
728 		.matches = {
729 			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
730 			DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
731 		},
732 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
733 	},
734 	{
735 		/*
736 		 * HP Pavilion ZT1000 -
737 		 * like DV4017EA does not raise AUXERR for errors on MUX ports.
738 		 */
739 		.matches = {
740 			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
741 			DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
742 			DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
743 		},
744 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
745 	},
746 	{
747 		/*
748 		 * HP Pavilion DV4270ca -
749 		 * like DV4017EA does not raise AUXERR for errors on MUX ports.
750 		 */
751 		.matches = {
752 			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
753 			DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
754 		},
755 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
756 	},
757 	{
758 		/* Newer HP Pavilion dv4 models */
759 		.matches = {
760 			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
761 			DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
762 		},
763 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_NOTIMEOUT)
764 	},
765 	{
766 		/* IBM 2656 */
767 		.matches = {
768 			DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
769 			DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
770 		},
771 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
772 	},
773 	{
774 		/* Avatar AVIU-145A6 */
775 		.matches = {
776 			DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
777 			DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
778 		},
779 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
780 	},
781 	{
782 		/* Intel MBO Desktop D845PESV */
783 		.matches = {
784 			DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
785 			DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
786 		},
787 		.driver_data = (void *)(SERIO_QUIRK_NOPNP)
788 	},
789 	{
790 		/*
791 		 * Intel NUC D54250WYK - does not have i8042 controller but
792 		 * declares PS/2 devices in DSDT.
793 		 */
794 		.matches = {
795 			DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
796 			DMI_MATCH(DMI_BOARD_NAME, "D54250WYK"),
797 		},
798 		.driver_data = (void *)(SERIO_QUIRK_NOPNP)
799 	},
800 	{
801 		/* Lenovo 3000 n100 */
802 		.matches = {
803 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
804 			DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
805 		},
806 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
807 	},
808 	{
809 		/* Lenovo XiaoXin Air 12 */
810 		.matches = {
811 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
812 			DMI_MATCH(DMI_PRODUCT_NAME, "80UN"),
813 		},
814 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
815 	},
816 	{
817 		/* Lenovo LaVie Z */
818 		.matches = {
819 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
820 			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo LaVie Z"),
821 		},
822 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
823 	},
824 	{
825 		/* Lenovo Ideapad U455 */
826 		.matches = {
827 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
828 			DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
829 		},
830 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
831 	},
832 	{
833 		/* Lenovo ThinkPad L460 */
834 		.matches = {
835 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
836 			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"),
837 		},
838 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
839 	},
840 	{
841 		/* Lenovo ThinkPad Twist S230u */
842 		.matches = {
843 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
844 			DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
845 		},
846 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
847 	},
848 	{
849 		/* LG Electronics X110 */
850 		.matches = {
851 			DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
852 			DMI_MATCH(DMI_BOARD_NAME, "X110"),
853 		},
854 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
855 	},
856 	{
857 		/* Medion Akoya Mini E1210 */
858 		.matches = {
859 			DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
860 			DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
861 		},
862 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
863 	},
864 	{
865 		/* Medion Akoya E1222 */
866 		.matches = {
867 			DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
868 			DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
869 		},
870 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
871 	},
872 	{
873 		/* MSI Wind U-100 */
874 		.matches = {
875 			DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
876 			DMI_MATCH(DMI_BOARD_NAME, "U-100"),
877 		},
878 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS | SERIO_QUIRK_NOPNP)
879 	},
880 	{
881 		/*
882 		 * No data is coming from the touchscreen unless KBC
883 		 * is in legacy mode.
884 		 */
885 		/* Panasonic CF-29 */
886 		.matches = {
887 			DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
888 			DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
889 		},
890 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
891 	},
892 	{
893 		/* Medion Akoya E7225 */
894 		.matches = {
895 			DMI_MATCH(DMI_SYS_VENDOR, "Medion"),
896 			DMI_MATCH(DMI_PRODUCT_NAME, "Akoya E7225"),
897 			DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
898 		},
899 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
900 	},
901 	{
902 		/* Microsoft Virtual Machine */
903 		.matches = {
904 			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
905 			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
906 			DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
907 		},
908 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
909 	},
910 	{
911 		/* Medion MAM 2070 */
912 		.matches = {
913 			DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
914 			DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
915 			DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
916 		},
917 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
918 	},
919 	{
920 		/* TUXEDO BU1406 */
921 		.matches = {
922 			DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
923 			DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
924 		},
925 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
926 	},
927 	{
928 		/* Clevo P650RS, 650RP6, Sager NP8152-S, and others */
929 		.matches = {
930 			DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
931 			DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
932 		},
933 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
934 	},
935 	{
936 		/* OQO Model 01 */
937 		.matches = {
938 			DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
939 			DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
940 			DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
941 		},
942 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
943 	},
944 	{
945 		.matches = {
946 			DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"),
947 			DMI_MATCH(DMI_PRODUCT_NAME, "C15B"),
948 		},
949 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
950 	},
951 	{
952 		/* Acer Aspire 5 A515 */
953 		.matches = {
954 			DMI_MATCH(DMI_BOARD_VENDOR, "PK"),
955 			DMI_MATCH(DMI_BOARD_NAME, "Grumpy_PK"),
956 		},
957 		.driver_data = (void *)(SERIO_QUIRK_NOPNP)
958 	},
959 	{
960 		/* ULI EV4873 - AUX LOOP does not work properly */
961 		.matches = {
962 			DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
963 			DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
964 			DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
965 		},
966 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
967 	},
968 	{
969 		/*
970 		 * Arima-Rioworks HDAMB -
971 		 * AUX LOOP command does not raise AUX IRQ
972 		 */
973 		.matches = {
974 			DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
975 			DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
976 			DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
977 		},
978 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
979 	},
980 	{
981 		/* Sharp Actius MM20 */
982 		.matches = {
983 			DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
984 			DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
985 		},
986 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
987 	},
988 	{
989 		/*
990 		 * Sony Vaio FZ-240E -
991 		 * reset and GET ID commands issued via KBD port are
992 		 * sometimes being delivered to AUX3.
993 		 */
994 		.matches = {
995 			DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
996 			DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
997 		},
998 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
999 	},
1000 	{
1001 		/*
1002 		 * Most (all?) VAIOs do not have external PS/2 ports nor
1003 		 * they implement active multiplexing properly, and
1004 		 * MUX discovery usually messes up keyboard/touchpad.
1005 		 */
1006 		.matches = {
1007 			DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
1008 			DMI_MATCH(DMI_BOARD_NAME, "VAIO"),
1009 		},
1010 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
1011 	},
1012 	{
1013 		/* Sony Vaio FS-115b */
1014 		.matches = {
1015 			DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
1016 			DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
1017 		},
1018 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
1019 	},
1020 	{
1021 		/*
1022 		 * Sony Vaio VGN-CS series require MUX or the touch sensor
1023 		 * buttons will disturb touchpad operation
1024 		 */
1025 		.matches = {
1026 			DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
1027 			DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"),
1028 		},
1029 		.driver_data = (void *)(SERIO_QUIRK_FORCEMUX)
1030 	},
1031 	{
1032 		.matches = {
1033 			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1034 			DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
1035 		},
1036 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
1037 	},
1038 	{
1039 		.matches = {
1040 			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1041 			DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
1042 		},
1043 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
1044 	},
1045 	{
1046 		.matches = {
1047 			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1048 			DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"),
1049 		},
1050 		.driver_data = (void *)(SERIO_QUIRK_NOMUX)
1051 	},
1052 	/*
1053 	 * A lot of modern Clevo barebones have touchpad and/or keyboard issues
1054 	 * after suspend fixable with nomux + reset + noloop + nopnp. Luckily,
1055 	 * none of them have an external PS/2 port so this can safely be set for
1056 	 * all of them. These two are based on a Clevo design, but have the
1057 	 * board_name changed.
1058 	 */
1059 	{
1060 		.matches = {
1061 			DMI_MATCH(DMI_BOARD_VENDOR, "TUXEDO"),
1062 			DMI_MATCH(DMI_BOARD_NAME, "AURA1501"),
1063 		},
1064 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1065 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1066 	},
1067 	{
1068 		.matches = {
1069 			DMI_MATCH(DMI_BOARD_VENDOR, "TUXEDO"),
1070 			DMI_MATCH(DMI_BOARD_NAME, "EDUBOOK1502"),
1071 		},
1072 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1073 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1074 	},
1075 	{
1076 		/* Mivvy M310 */
1077 		.matches = {
1078 			DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
1079 			DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
1080 		},
1081 		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
1082 	},
1083 	/*
1084 	 * Some laptops need keyboard reset before probing for the trackpad to get
1085 	 * it detected, initialised & finally work.
1086 	 */
1087 	{
1088 		/* Schenker XMG C504 - Elantech touchpad */
1089 		.matches = {
1090 			DMI_MATCH(DMI_SYS_VENDOR, "XMG"),
1091 			DMI_MATCH(DMI_PRODUCT_NAME, "C504"),
1092 		},
1093 		.driver_data = (void *)(SERIO_QUIRK_KBDRESET)
1094 	},
1095 	{
1096 		/* Blue FB5601 */
1097 		.matches = {
1098 			DMI_MATCH(DMI_SYS_VENDOR, "blue"),
1099 			DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
1100 			DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
1101 		},
1102 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
1103 	},
1104 	/*
1105 	 * A lot of modern Clevo barebones have touchpad and/or keyboard issues
1106 	 * after suspend fixable with nomux + reset + noloop + nopnp. Luckily,
1107 	 * none of them have an external PS/2 port so this can safely be set for
1108 	 * all of them.
1109 	 * Clevo barebones come with board_vendor and/or system_vendor set to
1110 	 * either the very generic string "Notebook" and/or a different value
1111 	 * for each individual reseller. The only somewhat universal way to
1112 	 * identify them is by board_name.
1113 	 */
1114 	{
1115 		.matches = {
1116 			DMI_MATCH(DMI_BOARD_NAME, "LAPQC71A"),
1117 		},
1118 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1119 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1120 	},
1121 	{
1122 		.matches = {
1123 			DMI_MATCH(DMI_BOARD_NAME, "LAPQC71B"),
1124 		},
1125 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1126 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1127 	},
1128 	{
1129 		.matches = {
1130 			DMI_MATCH(DMI_BOARD_NAME, "N140CU"),
1131 		},
1132 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1133 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1134 	},
1135 	{
1136 		.matches = {
1137 			DMI_MATCH(DMI_BOARD_NAME, "N141CU"),
1138 		},
1139 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1140 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1141 	},
1142 	{
1143 		.matches = {
1144 			DMI_MATCH(DMI_BOARD_NAME, "NH5xAx"),
1145 		},
1146 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1147 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1148 	},
1149 	{
1150 		.matches = {
1151 			DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"),
1152 		},
1153 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1154 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1155 	},
1156 	/*
1157 	 * At least one modern Clevo barebone has the touchpad connected both
1158 	 * via PS/2 and i2c interface. This causes a race condition between the
1159 	 * psmouse and i2c-hid driver. Since the full capability of the touchpad
1160 	 * is available via the i2c interface and the device has no external
1161 	 * PS/2 port, it is safe to just ignore all ps2 mouses here to avoid
1162 	 * this issue. The known affected device is the
1163 	 * TUXEDO InfinityBook S17 Gen6 / Clevo NS70MU which comes with one of
1164 	 * the two different dmi strings below. NS50MU is not a typo!
1165 	 */
1166 	{
1167 		.matches = {
1168 			DMI_MATCH(DMI_BOARD_NAME, "NS50MU"),
1169 		},
1170 		.driver_data = (void *)(SERIO_QUIRK_NOAUX | SERIO_QUIRK_NOMUX |
1171 					SERIO_QUIRK_RESET_ALWAYS | SERIO_QUIRK_NOLOOP |
1172 					SERIO_QUIRK_NOPNP)
1173 	},
1174 	{
1175 		.matches = {
1176 			DMI_MATCH(DMI_BOARD_NAME, "NS50_70MU"),
1177 		},
1178 		.driver_data = (void *)(SERIO_QUIRK_NOAUX | SERIO_QUIRK_NOMUX |
1179 					SERIO_QUIRK_RESET_ALWAYS | SERIO_QUIRK_NOLOOP |
1180 					SERIO_QUIRK_NOPNP)
1181 	},
1182 	{
1183 		.matches = {
1184 			DMI_MATCH(DMI_BOARD_NAME, "NS5x_7xPU"),
1185 		},
1186 		.driver_data = (void *)(SERIO_QUIRK_NOAUX)
1187 	},
1188 	{
1189 		.matches = {
1190 			DMI_MATCH(DMI_BOARD_NAME, "NJ50_70CU"),
1191 		},
1192 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1193 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1194 	},
1195 	{
1196 		.matches = {
1197 			DMI_MATCH(DMI_BOARD_NAME, "PB50_70DFx,DDx"),
1198 		},
1199 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1200 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1201 	},
1202 	{
1203 		.matches = {
1204 			DMI_MATCH(DMI_BOARD_NAME, "PCX0DX"),
1205 		},
1206 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1207 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1208 	},
1209 	/* See comment on TUXEDO InfinityBook S17 Gen6 / Clevo NS70MU above */
1210 	{
1211 		.matches = {
1212 			DMI_MATCH(DMI_BOARD_NAME, "PD5x_7xPNP_PNR_PNN_PNT"),
1213 		},
1214 		.driver_data = (void *)(SERIO_QUIRK_NOAUX)
1215 	},
1216 	{
1217 		.matches = {
1218 			DMI_MATCH(DMI_BOARD_NAME, "X170SM"),
1219 		},
1220 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1221 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1222 	},
1223 	{
1224 		.matches = {
1225 			DMI_MATCH(DMI_BOARD_NAME, "X170KM-G"),
1226 		},
1227 		.driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1228 					SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1229 	},
1230 	{ }
1231 };
1232 
1233 #ifdef CONFIG_PNP
1234 static const struct dmi_system_id i8042_dmi_laptop_table[] __initconst = {
1235 	{
1236 		.matches = {
1237 			DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
1238 		},
1239 	},
1240 	{
1241 		.matches = {
1242 			DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
1243 		},
1244 	},
1245 	{
1246 		.matches = {
1247 			DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
1248 		},
1249 	},
1250 	{
1251 		.matches = {
1252 			DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
1253 		},
1254 	},
1255 	{ }
1256 };
1257 #endif
1258 
1259 #endif /* CONFIG_X86 */
1260 
1261 #ifdef CONFIG_PNP
1262 #include <linux/pnp.h>
1263 
1264 static bool i8042_pnp_kbd_registered;
1265 static unsigned int i8042_pnp_kbd_devices;
1266 static bool i8042_pnp_aux_registered;
1267 static unsigned int i8042_pnp_aux_devices;
1268 
1269 static int i8042_pnp_command_reg;
1270 static int i8042_pnp_data_reg;
1271 static int i8042_pnp_kbd_irq;
1272 static int i8042_pnp_aux_irq;
1273 
1274 static char i8042_pnp_kbd_name[32];
1275 static char i8042_pnp_aux_name[32];
1276 
i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)1277 static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
1278 {
1279 	strlcpy(dst, "PNP:", dst_size);
1280 
1281 	while (id) {
1282 		strlcat(dst, " ", dst_size);
1283 		strlcat(dst, id->id, dst_size);
1284 		id = id->next;
1285 	}
1286 }
1287 
i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)1288 static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
1289 {
1290 	if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
1291 		i8042_pnp_data_reg = pnp_port_start(dev,0);
1292 
1293 	if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
1294 		i8042_pnp_command_reg = pnp_port_start(dev, 1);
1295 
1296 	if (pnp_irq_valid(dev,0))
1297 		i8042_pnp_kbd_irq = pnp_irq(dev, 0);
1298 
1299 	strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
1300 	if (strlen(pnp_dev_name(dev))) {
1301 		strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
1302 		strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
1303 	}
1304 	i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
1305 			       sizeof(i8042_kbd_firmware_id));
1306 	i8042_kbd_fwnode = dev_fwnode(&dev->dev);
1307 
1308 	/* Keyboard ports are always supposed to be wakeup-enabled */
1309 	device_set_wakeup_enable(&dev->dev, true);
1310 
1311 	i8042_pnp_kbd_devices++;
1312 	return 0;
1313 }
1314 
i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)1315 static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
1316 {
1317 	if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
1318 		i8042_pnp_data_reg = pnp_port_start(dev,0);
1319 
1320 	if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
1321 		i8042_pnp_command_reg = pnp_port_start(dev, 1);
1322 
1323 	if (pnp_irq_valid(dev, 0))
1324 		i8042_pnp_aux_irq = pnp_irq(dev, 0);
1325 
1326 	strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
1327 	if (strlen(pnp_dev_name(dev))) {
1328 		strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
1329 		strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
1330 	}
1331 	i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
1332 			       sizeof(i8042_aux_firmware_id));
1333 
1334 	i8042_pnp_aux_devices++;
1335 	return 0;
1336 }
1337 
1338 static const struct pnp_device_id pnp_kbd_devids[] = {
1339 	{ .id = "PNP0300", .driver_data = 0 },
1340 	{ .id = "PNP0301", .driver_data = 0 },
1341 	{ .id = "PNP0302", .driver_data = 0 },
1342 	{ .id = "PNP0303", .driver_data = 0 },
1343 	{ .id = "PNP0304", .driver_data = 0 },
1344 	{ .id = "PNP0305", .driver_data = 0 },
1345 	{ .id = "PNP0306", .driver_data = 0 },
1346 	{ .id = "PNP0309", .driver_data = 0 },
1347 	{ .id = "PNP030a", .driver_data = 0 },
1348 	{ .id = "PNP030b", .driver_data = 0 },
1349 	{ .id = "PNP0320", .driver_data = 0 },
1350 	{ .id = "PNP0343", .driver_data = 0 },
1351 	{ .id = "PNP0344", .driver_data = 0 },
1352 	{ .id = "PNP0345", .driver_data = 0 },
1353 	{ .id = "CPQA0D7", .driver_data = 0 },
1354 	{ .id = "", },
1355 };
1356 MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids);
1357 
1358 static struct pnp_driver i8042_pnp_kbd_driver = {
1359 	.name           = "i8042 kbd",
1360 	.id_table       = pnp_kbd_devids,
1361 	.probe          = i8042_pnp_kbd_probe,
1362 	.driver         = {
1363 		.probe_type = PROBE_FORCE_SYNCHRONOUS,
1364 		.suppress_bind_attrs = true,
1365 	},
1366 };
1367 
1368 static const struct pnp_device_id pnp_aux_devids[] = {
1369 	{ .id = "AUI0200", .driver_data = 0 },
1370 	{ .id = "FJC6000", .driver_data = 0 },
1371 	{ .id = "FJC6001", .driver_data = 0 },
1372 	{ .id = "PNP0f03", .driver_data = 0 },
1373 	{ .id = "PNP0f0b", .driver_data = 0 },
1374 	{ .id = "PNP0f0e", .driver_data = 0 },
1375 	{ .id = "PNP0f12", .driver_data = 0 },
1376 	{ .id = "PNP0f13", .driver_data = 0 },
1377 	{ .id = "PNP0f19", .driver_data = 0 },
1378 	{ .id = "PNP0f1c", .driver_data = 0 },
1379 	{ .id = "SYN0801", .driver_data = 0 },
1380 	{ .id = "", },
1381 };
1382 MODULE_DEVICE_TABLE(pnp, pnp_aux_devids);
1383 
1384 static struct pnp_driver i8042_pnp_aux_driver = {
1385 	.name           = "i8042 aux",
1386 	.id_table       = pnp_aux_devids,
1387 	.probe          = i8042_pnp_aux_probe,
1388 	.driver         = {
1389 		.probe_type = PROBE_FORCE_SYNCHRONOUS,
1390 		.suppress_bind_attrs = true,
1391 	},
1392 };
1393 
i8042_pnp_exit(void)1394 static void i8042_pnp_exit(void)
1395 {
1396 	if (i8042_pnp_kbd_registered) {
1397 		i8042_pnp_kbd_registered = false;
1398 		pnp_unregister_driver(&i8042_pnp_kbd_driver);
1399 	}
1400 
1401 	if (i8042_pnp_aux_registered) {
1402 		i8042_pnp_aux_registered = false;
1403 		pnp_unregister_driver(&i8042_pnp_aux_driver);
1404 	}
1405 }
1406 
i8042_pnp_init(void)1407 static int __init i8042_pnp_init(void)
1408 {
1409 	char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
1410 	bool pnp_data_busted = false;
1411 	int err;
1412 
1413 	if (i8042_nopnp) {
1414 		pr_info("PNP detection disabled\n");
1415 		return 0;
1416 	}
1417 
1418 	err = pnp_register_driver(&i8042_pnp_kbd_driver);
1419 	if (!err)
1420 		i8042_pnp_kbd_registered = true;
1421 
1422 	err = pnp_register_driver(&i8042_pnp_aux_driver);
1423 	if (!err)
1424 		i8042_pnp_aux_registered = true;
1425 
1426 	if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
1427 		i8042_pnp_exit();
1428 #if defined(__ia64__)
1429 		return -ENODEV;
1430 #else
1431 		pr_info("PNP: No PS/2 controller found.\n");
1432 		if (x86_platform.legacy.i8042 !=
1433 				X86_LEGACY_I8042_EXPECTED_PRESENT)
1434 			return -ENODEV;
1435 		pr_info("Probing ports directly.\n");
1436 		return 0;
1437 #endif
1438 	}
1439 
1440 	if (i8042_pnp_kbd_devices)
1441 		snprintf(kbd_irq_str, sizeof(kbd_irq_str),
1442 			"%d", i8042_pnp_kbd_irq);
1443 	if (i8042_pnp_aux_devices)
1444 		snprintf(aux_irq_str, sizeof(aux_irq_str),
1445 			"%d", i8042_pnp_aux_irq);
1446 
1447 	pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
1448 		i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
1449 		i8042_pnp_aux_name,
1450 		i8042_pnp_data_reg, i8042_pnp_command_reg,
1451 		kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
1452 		aux_irq_str);
1453 
1454 #if defined(__ia64__)
1455 	if (!i8042_pnp_kbd_devices)
1456 		i8042_nokbd = true;
1457 	if (!i8042_pnp_aux_devices)
1458 		i8042_noaux = true;
1459 #endif
1460 
1461 	if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
1462 	      i8042_pnp_data_reg != i8042_data_reg) ||
1463 	    !i8042_pnp_data_reg) {
1464 		pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
1465 			i8042_pnp_data_reg, i8042_data_reg);
1466 		i8042_pnp_data_reg = i8042_data_reg;
1467 		pnp_data_busted = true;
1468 	}
1469 
1470 	if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
1471 	      i8042_pnp_command_reg != i8042_command_reg) ||
1472 	    !i8042_pnp_command_reg) {
1473 		pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n",
1474 			i8042_pnp_command_reg, i8042_command_reg);
1475 		i8042_pnp_command_reg = i8042_command_reg;
1476 		pnp_data_busted = true;
1477 	}
1478 
1479 	if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
1480 		pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n",
1481 			i8042_kbd_irq);
1482 		i8042_pnp_kbd_irq = i8042_kbd_irq;
1483 		pnp_data_busted = true;
1484 	}
1485 
1486 	if (!i8042_noaux && !i8042_pnp_aux_irq) {
1487 		if (!pnp_data_busted && i8042_pnp_kbd_irq) {
1488 			pr_warn("PNP: PS/2 appears to have AUX port disabled, "
1489 				"if this is incorrect please boot with i8042.nopnp\n");
1490 			i8042_noaux = true;
1491 		} else {
1492 			pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n",
1493 				i8042_aux_irq);
1494 			i8042_pnp_aux_irq = i8042_aux_irq;
1495 		}
1496 	}
1497 
1498 	i8042_data_reg = i8042_pnp_data_reg;
1499 	i8042_command_reg = i8042_pnp_command_reg;
1500 	i8042_kbd_irq = i8042_pnp_kbd_irq;
1501 	i8042_aux_irq = i8042_pnp_aux_irq;
1502 
1503 #ifdef CONFIG_X86
1504 	i8042_bypass_aux_irq_test = !pnp_data_busted &&
1505 				    dmi_check_system(i8042_dmi_laptop_table);
1506 #endif
1507 
1508 	return 0;
1509 }
1510 
1511 #else  /* !CONFIG_PNP */
i8042_pnp_init(void)1512 static inline int i8042_pnp_init(void) { return 0; }
i8042_pnp_exit(void)1513 static inline void i8042_pnp_exit(void) { }
1514 #endif /* CONFIG_PNP */
1515 
1516 
1517 #ifdef CONFIG_X86
i8042_check_quirks(void)1518 static void __init i8042_check_quirks(void)
1519 {
1520 	const struct dmi_system_id *device_quirk_info;
1521 	uintptr_t quirks;
1522 
1523 	device_quirk_info = dmi_first_match(i8042_dmi_quirk_table);
1524 	if (!device_quirk_info)
1525 		return;
1526 
1527 	quirks = (uintptr_t)device_quirk_info->driver_data;
1528 
1529 	if (quirks & SERIO_QUIRK_NOKBD)
1530 		i8042_nokbd = true;
1531 	if (quirks & SERIO_QUIRK_NOAUX)
1532 		i8042_noaux = true;
1533 	if (quirks & SERIO_QUIRK_NOMUX)
1534 		i8042_nomux = true;
1535 	if (quirks & SERIO_QUIRK_FORCEMUX)
1536 		i8042_nomux = false;
1537 	if (quirks & SERIO_QUIRK_UNLOCK)
1538 		i8042_unlock = true;
1539 	if (quirks & SERIO_QUIRK_PROBE_DEFER)
1540 		i8042_probe_defer = true;
1541 	/* Honor module parameter when value is not default */
1542 	if (i8042_reset == I8042_RESET_DEFAULT) {
1543 		if (quirks & SERIO_QUIRK_RESET_ALWAYS)
1544 			i8042_reset = I8042_RESET_ALWAYS;
1545 		if (quirks & SERIO_QUIRK_RESET_NEVER)
1546 			i8042_reset = I8042_RESET_NEVER;
1547 	}
1548 	if (quirks & SERIO_QUIRK_DIECT)
1549 		i8042_direct = true;
1550 	if (quirks & SERIO_QUIRK_DUMBKBD)
1551 		i8042_dumbkbd = true;
1552 	if (quirks & SERIO_QUIRK_NOLOOP)
1553 		i8042_noloop = true;
1554 	if (quirks & SERIO_QUIRK_NOTIMEOUT)
1555 		i8042_notimeout = true;
1556 	if (quirks & SERIO_QUIRK_KBDRESET)
1557 		i8042_kbdreset = true;
1558 	if (quirks & SERIO_QUIRK_DRITEK)
1559 		i8042_dritek = true;
1560 #ifdef CONFIG_PNP
1561 	if (quirks & SERIO_QUIRK_NOPNP)
1562 		i8042_nopnp = true;
1563 #endif
1564 }
1565 #else
i8042_check_quirks(void)1566 static inline void i8042_check_quirks(void) {}
1567 #endif
1568 
i8042_platform_init(void)1569 static int __init i8042_platform_init(void)
1570 {
1571 	int retval;
1572 
1573 #ifdef CONFIG_X86
1574 	u8 a20_on = 0xdf;
1575 	/* Just return if platform does not have i8042 controller */
1576 	if (x86_platform.legacy.i8042 == X86_LEGACY_I8042_PLATFORM_ABSENT)
1577 		return -ENODEV;
1578 #endif
1579 
1580 /*
1581  * On ix86 platforms touching the i8042 data register region can do really
1582  * bad things. Because of this the region is always reserved on ix86 boxes.
1583  *
1584  *	if (!request_region(I8042_DATA_REG, 16, "i8042"))
1585  *		return -EBUSY;
1586  */
1587 
1588 	i8042_kbd_irq = I8042_MAP_IRQ(1);
1589 	i8042_aux_irq = I8042_MAP_IRQ(12);
1590 
1591 #if defined(__ia64__)
1592 	i8042_reset = I8042_RESET_ALWAYS;
1593 #endif
1594 
1595 	i8042_check_quirks();
1596 
1597 	retval = i8042_pnp_init();
1598 	if (retval)
1599 		return retval;
1600 
1601 #ifdef CONFIG_X86
1602 	/*
1603 	 * A20 was already enabled during early kernel init. But some buggy
1604 	 * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
1605 	 * resume from S3. So we do it here and hope that nothing breaks.
1606 	 */
1607 	i8042_command(&a20_on, 0x10d1);
1608 	i8042_command(NULL, 0x00ff);	/* Null command for SMM firmware */
1609 #endif /* CONFIG_X86 */
1610 
1611 	return retval;
1612 }
1613 
i8042_platform_exit(void)1614 static inline void i8042_platform_exit(void)
1615 {
1616 	i8042_pnp_exit();
1617 }
1618 
1619 #endif /* _I8042_ACPIPNPIO_H */
1620