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