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