Merge branches 'pm-cpuidle', 'pm-core' and 'pm-sleep'
[linux-block.git] / drivers / input / serio / i8042-acpipnpio.h
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                 /* Amoi M636/A737 */
365                 .matches = {
366                         DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
367                         DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
368                 },
369                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
370         },
371         {
372                 .matches = {
373                         DMI_MATCH(DMI_SYS_VENDOR, "ByteSpeed LLC"),
374                         DMI_MATCH(DMI_PRODUCT_NAME, "ByteSpeed Laptop C15B"),
375                 },
376                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
377         },
378         {
379                 /* Compal HEL80I */
380                 .matches = {
381                         DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
382                         DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
383                 },
384                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
385         },
386         {
387                 .matches = {
388                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
389                         DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant"),
390                         DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
391                 },
392                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
393         },
394         {
395                 .matches = {
396                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
397                         DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant"),
398                         DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
399                 },
400                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
401         },
402         {
403                 /* Advent 4211 */
404                 .matches = {
405                         DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
406                         DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
407                 },
408                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
409         },
410         {
411                 /* Dell Embedded Box PC 3000 */
412                 .matches = {
413                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
414                         DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
415                 },
416                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
417         },
418         {
419                 /* Dell XPS M1530 */
420                 .matches = {
421                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
422                         DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
423                 },
424                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
425         },
426         {
427                 /* Dell Vostro 1510 */
428                 .matches = {
429                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
430                         DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
431                 },
432                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
433         },
434         {
435                 /* Dell Vostro V13 */
436                 .matches = {
437                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
438                         DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
439                 },
440                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_NOTIMEOUT)
441         },
442         {
443                 /* Dell Vostro 1320 */
444                 .matches = {
445                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
446                         DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
447                 },
448                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
449         },
450         {
451                 /* Dell Vostro 1520 */
452                 .matches = {
453                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
454                         DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
455                 },
456                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
457         },
458         {
459                 /* Dell Vostro 1720 */
460                 .matches = {
461                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
462                         DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
463                 },
464                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
465         },
466         {
467                 /* Entroware Proteus */
468                 .matches = {
469                         DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
470                         DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
471                         DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
472                 },
473                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS)
474         },
475         /*
476          * Some Fujitsu notebooks are having trouble with touchpads if
477          * active multiplexing mode is activated. Luckily they don't have
478          * external PS/2 ports so we can safely disable it.
479          * ... apparently some Toshibas don't like MUX mode either and
480          * die horrible death on reboot.
481          */
482         {
483                 /* Fujitsu Lifebook P7010/P7010D */
484                 .matches = {
485                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
486                         DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
487                 },
488                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
489         },
490         {
491                 /* Fujitsu Lifebook P5020D */
492                 .matches = {
493                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
494                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
495                 },
496                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
497         },
498         {
499                 /* Fujitsu Lifebook S2000 */
500                 .matches = {
501                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
502                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
503                 },
504                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
505         },
506         {
507                 /* Fujitsu Lifebook S6230 */
508                 .matches = {
509                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
510                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
511                 },
512                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
513         },
514         {
515                 /* Fujitsu Lifebook T725 laptop */
516                 .matches = {
517                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
518                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T725"),
519                 },
520                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_NOTIMEOUT)
521         },
522         {
523                 /* Fujitsu Lifebook U745 */
524                 .matches = {
525                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
526                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"),
527                 },
528                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
529         },
530         {
531                 /* Fujitsu T70H */
532                 .matches = {
533                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
534                         DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
535                 },
536                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
537         },
538         {
539                 /* Fujitsu A544 laptop */
540                 /* https://bugzilla.redhat.com/show_bug.cgi?id=1111138 */
541                 .matches = {
542                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
543                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK A544"),
544                 },
545                 .driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
546         },
547         {
548                 /* Fujitsu AH544 laptop */
549                 /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
550                 .matches = {
551                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
552                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"),
553                 },
554                 .driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
555         },
556         {
557                 /* Fujitsu U574 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 U574"),
562                 },
563                 .driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
564         },
565         {
566                 /* Fujitsu UH554 laptop */
567                 .matches = {
568                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
569                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK UH544"),
570                 },
571                 .driver_data = (void *)(SERIO_QUIRK_NOTIMEOUT)
572         },
573         {
574                 /* Fujitsu Lifebook P7010 */
575                 .matches = {
576                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
577                         DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
578                 },
579                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
580         },
581         {
582                 /* Fujitsu-Siemens Lifebook T3010 */
583                 .matches = {
584                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
585                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
586                 },
587                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
588         },
589         {
590                 /* Fujitsu-Siemens Lifebook E4010 */
591                 .matches = {
592                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
593                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
594                 },
595                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
596         },
597         {
598                 /* Fujitsu-Siemens Amilo Pro 2010 */
599                 .matches = {
600                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
601                         DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
602                 },
603                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
604         },
605         {
606                 /* Fujitsu-Siemens Amilo Pro 2030 */
607                 .matches = {
608                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
609                         DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
610                 },
611                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
612         },
613         {
614                 /* Gigabyte M912 */
615                 .matches = {
616                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
617                         DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
618                         DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
619                 },
620                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
621         },
622         {
623                 /* Gigabyte Spring Peak - defines wrong chassis type */
624                 .matches = {
625                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
626                         DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
627                 },
628                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
629         },
630         {
631                 /* Gigabyte T1005 - defines wrong chassis type ("Other") */
632                 .matches = {
633                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
634                         DMI_MATCH(DMI_PRODUCT_NAME, "T1005"),
635                 },
636                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
637         },
638         {
639                 /* Gigabyte T1005M/P - defines wrong chassis type ("Other") */
640                 .matches = {
641                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
642                         DMI_MATCH(DMI_PRODUCT_NAME, "T1005M/P"),
643                 },
644                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
645         },
646         /*
647          * Some laptops need keyboard reset before probing for the trackpad to get
648          * it detected, initialised & finally work.
649          */
650         {
651                 /* Gigabyte P35 v2 - Elantech touchpad */
652                 .matches = {
653                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
654                         DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"),
655                 },
656                 .driver_data = (void *)(SERIO_QUIRK_KBDRESET)
657         },
658                 {
659                 /* Aorus branded Gigabyte X3 Plus - Elantech touchpad */
660                 .matches = {
661                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
662                         DMI_MATCH(DMI_PRODUCT_NAME, "X3"),
663                 },
664                 .driver_data = (void *)(SERIO_QUIRK_KBDRESET)
665         },
666         {
667                 /* Gigabyte P34 - Elantech touchpad */
668                 .matches = {
669                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
670                         DMI_MATCH(DMI_PRODUCT_NAME, "P34"),
671                 },
672                 .driver_data = (void *)(SERIO_QUIRK_KBDRESET)
673         },
674         {
675                 /* Gigabyte P57 - Elantech touchpad */
676                 .matches = {
677                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
678                         DMI_MATCH(DMI_PRODUCT_NAME, "P57"),
679                 },
680                 .driver_data = (void *)(SERIO_QUIRK_KBDRESET)
681         },
682         {
683                 /* Gericom Bellagio */
684                 .matches = {
685                         DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
686                         DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
687                 },
688                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
689         },
690         {
691                 /* Gigabyte M1022M netbook */
692                 .matches = {
693                         DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
694                         DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
695                         DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
696                 },
697                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
698         },
699         {
700                 .matches = {
701                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
702                         DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
703                         DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
704                 },
705                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
706         },
707         {
708                 /*
709                  * HP Pavilion DV4017EA -
710                  * errors on MUX ports are reported without raising AUXDATA
711                  * causing "spurious NAK" messages.
712                  */
713                 .matches = {
714                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
715                         DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
716                 },
717                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
718         },
719         {
720                 /*
721                  * HP Pavilion ZT1000 -
722                  * like DV4017EA does not raise AUXERR for errors on MUX ports.
723                  */
724                 .matches = {
725                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
726                         DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
727                         DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
728                 },
729                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
730         },
731         {
732                 /*
733                  * HP Pavilion DV4270ca -
734                  * like DV4017EA does not raise AUXERR for errors on MUX ports.
735                  */
736                 .matches = {
737                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
738                         DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
739                 },
740                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
741         },
742         {
743                 /* Newer HP Pavilion dv4 models */
744                 .matches = {
745                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
746                         DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
747                 },
748                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_NOTIMEOUT)
749         },
750         {
751                 /* IBM 2656 */
752                 .matches = {
753                         DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
754                         DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
755                 },
756                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
757         },
758         {
759                 /* Avatar AVIU-145A6 */
760                 .matches = {
761                         DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
762                         DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
763                 },
764                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
765         },
766         {
767                 /* Intel MBO Desktop D845PESV */
768                 .matches = {
769                         DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
770                         DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
771                 },
772                 .driver_data = (void *)(SERIO_QUIRK_NOPNP)
773         },
774         {
775                 /*
776                  * Intel NUC D54250WYK - does not have i8042 controller but
777                  * declares PS/2 devices in DSDT.
778                  */
779                 .matches = {
780                         DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
781                         DMI_MATCH(DMI_BOARD_NAME, "D54250WYK"),
782                 },
783                 .driver_data = (void *)(SERIO_QUIRK_NOPNP)
784         },
785         {
786                 /* Lenovo 3000 n100 */
787                 .matches = {
788                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
789                         DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
790                 },
791                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
792         },
793         {
794                 /* Lenovo XiaoXin Air 12 */
795                 .matches = {
796                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
797                         DMI_MATCH(DMI_PRODUCT_NAME, "80UN"),
798                 },
799                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
800         },
801         {
802                 /* Lenovo LaVie Z */
803                 .matches = {
804                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
805                         DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo LaVie Z"),
806                 },
807                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
808         },
809         {
810                 /* Lenovo Ideapad U455 */
811                 .matches = {
812                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
813                         DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
814                 },
815                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
816         },
817         {
818                 /* Lenovo ThinkPad L460 */
819                 .matches = {
820                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
821                         DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"),
822                 },
823                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
824         },
825         {
826                 /* Lenovo ThinkPad Twist S230u */
827                 .matches = {
828                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
829                         DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
830                 },
831                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
832         },
833         {
834                 /* LG Electronics X110 */
835                 .matches = {
836                         DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
837                         DMI_MATCH(DMI_BOARD_NAME, "X110"),
838                 },
839                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
840         },
841         {
842                 /* Medion Akoya Mini E1210 */
843                 .matches = {
844                         DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
845                         DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
846                 },
847                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
848         },
849         {
850                 /* Medion Akoya E1222 */
851                 .matches = {
852                         DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
853                         DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
854                 },
855                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
856         },
857         {
858                 /* MSI Wind U-100 */
859                 .matches = {
860                         DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
861                         DMI_MATCH(DMI_BOARD_NAME, "U-100"),
862                 },
863                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS | SERIO_QUIRK_NOPNP)
864         },
865         {
866                 /*
867                  * No data is coming from the touchscreen unless KBC
868                  * is in legacy mode.
869                  */
870                 /* Panasonic CF-29 */
871                 .matches = {
872                         DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
873                         DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
874                 },
875                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
876         },
877         {
878                 /* Medion Akoya E7225 */
879                 .matches = {
880                         DMI_MATCH(DMI_SYS_VENDOR, "Medion"),
881                         DMI_MATCH(DMI_PRODUCT_NAME, "Akoya E7225"),
882                         DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
883                 },
884                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
885         },
886         {
887                 /* Microsoft Virtual Machine */
888                 .matches = {
889                         DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
890                         DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
891                         DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
892                 },
893                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
894         },
895         {
896                 /* Medion MAM 2070 */
897                 .matches = {
898                         DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
899                         DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
900                         DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
901                 },
902                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
903         },
904         {
905                 /* TUXEDO BU1406 */
906                 .matches = {
907                         DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
908                         DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
909                 },
910                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
911         },
912         {
913                 /* OQO Model 01 */
914                 .matches = {
915                         DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
916                         DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
917                         DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
918                 },
919                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
920         },
921         {
922                 .matches = {
923                         DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"),
924                         DMI_MATCH(DMI_PRODUCT_NAME, "C15B"),
925                 },
926                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
927         },
928         {
929                 /* Acer Aspire 5 A515 */
930                 .matches = {
931                         DMI_MATCH(DMI_BOARD_VENDOR, "PK"),
932                         DMI_MATCH(DMI_BOARD_NAME, "Grumpy_PK"),
933                 },
934                 .driver_data = (void *)(SERIO_QUIRK_NOPNP)
935         },
936         {
937                 /* ULI EV4873 - AUX LOOP does not work properly */
938                 .matches = {
939                         DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
940                         DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
941                         DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
942                 },
943                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
944         },
945         {
946                 /*
947                  * Arima-Rioworks HDAMB -
948                  * AUX LOOP command does not raise AUX IRQ
949                  */
950                 .matches = {
951                         DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
952                         DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
953                         DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
954                 },
955                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
956         },
957         {
958                 /* Sharp Actius MM20 */
959                 .matches = {
960                         DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
961                         DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
962                 },
963                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
964         },
965         {
966                 /*
967                  * Sony Vaio FZ-240E -
968                  * reset and GET ID commands issued via KBD port are
969                  * sometimes being delivered to AUX3.
970                  */
971                 .matches = {
972                         DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
973                         DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
974                 },
975                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
976         },
977         {
978                 /*
979                  * Most (all?) VAIOs do not have external PS/2 ports nor
980                  * they implement active multiplexing properly, and
981                  * MUX discovery usually messes up keyboard/touchpad.
982                  */
983                 .matches = {
984                         DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
985                         DMI_MATCH(DMI_BOARD_NAME, "VAIO"),
986                 },
987                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
988         },
989         {
990                 /* Sony Vaio FS-115b */
991                 .matches = {
992                         DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
993                         DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
994                 },
995                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
996         },
997         {
998                 /*
999                  * Sony Vaio VGN-CS series require MUX or the touch sensor
1000                  * buttons will disturb touchpad operation
1001                  */
1002                 .matches = {
1003                         DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
1004                         DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"),
1005                 },
1006                 .driver_data = (void *)(SERIO_QUIRK_FORCEMUX)
1007         },
1008         {
1009                 .matches = {
1010                         DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1011                         DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
1012                 },
1013                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
1014         },
1015         {
1016                 .matches = {
1017                         DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1018                         DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
1019                 },
1020                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
1021         },
1022         {
1023                 .matches = {
1024                         DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1025                         DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"),
1026                 },
1027                 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
1028         },
1029         /*
1030          * A lot of modern Clevo barebones have touchpad and/or keyboard issues
1031          * after suspend fixable with nomux + reset + noloop + nopnp. Luckily,
1032          * none of them have an external PS/2 port so this can safely be set for
1033          * all of them. These two are based on a Clevo design, but have the
1034          * board_name changed.
1035          */
1036         {
1037                 .matches = {
1038                         DMI_MATCH(DMI_BOARD_VENDOR, "TUXEDO"),
1039                         DMI_MATCH(DMI_BOARD_NAME, "AURA1501"),
1040                 },
1041                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1042                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1043         },
1044         {
1045                 .matches = {
1046                         DMI_MATCH(DMI_BOARD_VENDOR, "TUXEDO"),
1047                         DMI_MATCH(DMI_BOARD_NAME, "EDUBOOK1502"),
1048                 },
1049                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1050                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1051         },
1052         {
1053                 /* Mivvy M310 */
1054                 .matches = {
1055                         DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
1056                         DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
1057                 },
1058                 .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
1059         },
1060         /*
1061          * Some laptops need keyboard reset before probing for the trackpad to get
1062          * it detected, initialised & finally work.
1063          */
1064         {
1065                 /* Schenker XMG C504 - Elantech touchpad */
1066                 .matches = {
1067                         DMI_MATCH(DMI_SYS_VENDOR, "XMG"),
1068                         DMI_MATCH(DMI_PRODUCT_NAME, "C504"),
1069                 },
1070                 .driver_data = (void *)(SERIO_QUIRK_KBDRESET)
1071         },
1072         {
1073                 /* Blue FB5601 */
1074                 .matches = {
1075                         DMI_MATCH(DMI_SYS_VENDOR, "blue"),
1076                         DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
1077                         DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
1078                 },
1079                 .driver_data = (void *)(SERIO_QUIRK_NOLOOP)
1080         },
1081         /*
1082          * A lot of modern Clevo barebones have touchpad and/or keyboard issues
1083          * after suspend fixable with nomux + reset + noloop + nopnp. Luckily,
1084          * none of them have an external PS/2 port so this can safely be set for
1085          * all of them.
1086          * Clevo barebones come with board_vendor and/or system_vendor set to
1087          * either the very generic string "Notebook" and/or a different value
1088          * for each individual reseller. The only somewhat universal way to
1089          * identify them is by board_name.
1090          */
1091         {
1092                 .matches = {
1093                         DMI_MATCH(DMI_BOARD_NAME, "LAPQC71A"),
1094                 },
1095                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1096                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1097         },
1098         {
1099                 .matches = {
1100                         DMI_MATCH(DMI_BOARD_NAME, "LAPQC71B"),
1101                 },
1102                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1103                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1104         },
1105         {
1106                 .matches = {
1107                         DMI_MATCH(DMI_BOARD_NAME, "N140CU"),
1108                 },
1109                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1110                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1111         },
1112         {
1113                 .matches = {
1114                         DMI_MATCH(DMI_BOARD_NAME, "N141CU"),
1115                 },
1116                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1117                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1118         },
1119         {
1120                 .matches = {
1121                         DMI_MATCH(DMI_BOARD_NAME, "NH5xAx"),
1122                 },
1123                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1124                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1125         },
1126         {
1127                 .matches = {
1128                         DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"),
1129                 },
1130                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1131                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1132         },
1133         /*
1134          * At least one modern Clevo barebone has the touchpad connected both
1135          * via PS/2 and i2c interface. This causes a race condition between the
1136          * psmouse and i2c-hid driver. Since the full capability of the touchpad
1137          * is available via the i2c interface and the device has no external
1138          * PS/2 port, it is safe to just ignore all ps2 mouses here to avoid
1139          * this issue. The known affected device is the
1140          * TUXEDO InfinityBook S17 Gen6 / Clevo NS70MU which comes with one of
1141          * the two different dmi strings below. NS50MU is not a typo!
1142          */
1143         {
1144                 .matches = {
1145                         DMI_MATCH(DMI_BOARD_NAME, "NS50MU"),
1146                 },
1147                 .driver_data = (void *)(SERIO_QUIRK_NOAUX | SERIO_QUIRK_NOMUX |
1148                                         SERIO_QUIRK_RESET_ALWAYS | SERIO_QUIRK_NOLOOP |
1149                                         SERIO_QUIRK_NOPNP)
1150         },
1151         {
1152                 .matches = {
1153                         DMI_MATCH(DMI_BOARD_NAME, "NS50_70MU"),
1154                 },
1155                 .driver_data = (void *)(SERIO_QUIRK_NOAUX | SERIO_QUIRK_NOMUX |
1156                                         SERIO_QUIRK_RESET_ALWAYS | SERIO_QUIRK_NOLOOP |
1157                                         SERIO_QUIRK_NOPNP)
1158         },
1159         {
1160                 .matches = {
1161                         DMI_MATCH(DMI_BOARD_NAME, "NJ50_70CU"),
1162                 },
1163                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1164                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1165         },
1166         {
1167                 /*
1168                  * This is only a partial board_name and might be followed by
1169                  * another letter or number. DMI_MATCH however does do partial
1170                  * matching.
1171                  */
1172                 .matches = {
1173                         DMI_MATCH(DMI_PRODUCT_NAME, "P65xH"),
1174                 },
1175                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1176                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1177         },
1178         {
1179                 /* Clevo P650RS, 650RP6, Sager NP8152-S, and others */
1180                 .matches = {
1181                         DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
1182                 },
1183                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1184                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1185         },
1186         {
1187                 /*
1188                  * This is only a partial board_name and might be followed by
1189                  * another letter or number. DMI_MATCH however does do partial
1190                  * matching.
1191                  */
1192                 .matches = {
1193                         DMI_MATCH(DMI_PRODUCT_NAME, "P65_P67H"),
1194                 },
1195                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1196                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1197         },
1198         {
1199                 /*
1200                  * This is only a partial board_name and might be followed by
1201                  * another letter or number. DMI_MATCH however does do partial
1202                  * matching.
1203                  */
1204                 .matches = {
1205                         DMI_MATCH(DMI_PRODUCT_NAME, "P65_67RP"),
1206                 },
1207                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1208                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1209         },
1210         {
1211                 /*
1212                  * This is only a partial board_name and might be followed by
1213                  * another letter or number. DMI_MATCH however does do partial
1214                  * matching.
1215                  */
1216                 .matches = {
1217                         DMI_MATCH(DMI_PRODUCT_NAME, "P65_67RS"),
1218                 },
1219                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1220                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1221         },
1222         {
1223                 /*
1224                  * This is only a partial board_name and might be followed by
1225                  * another letter or number. DMI_MATCH however does do partial
1226                  * matching.
1227                  */
1228                 .matches = {
1229                         DMI_MATCH(DMI_PRODUCT_NAME, "P67xRP"),
1230                 },
1231                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1232                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1233         },
1234         {
1235                 .matches = {
1236                         DMI_MATCH(DMI_BOARD_NAME, "PB50_70DFx,DDx"),
1237                 },
1238                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1239                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1240         },
1241         {
1242                 .matches = {
1243                         DMI_MATCH(DMI_BOARD_NAME, "PCX0DX"),
1244                 },
1245                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1246                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1247         },
1248         {
1249                 .matches = {
1250                         DMI_MATCH(DMI_BOARD_NAME, "X170SM"),
1251                 },
1252                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1253                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1254         },
1255         {
1256                 .matches = {
1257                         DMI_MATCH(DMI_BOARD_NAME, "X170KM-G"),
1258                 },
1259                 .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
1260                                         SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
1261         },
1262         { }
1263 };
1264
1265 #ifdef CONFIG_PNP
1266 static const struct dmi_system_id i8042_dmi_laptop_table[] __initconst = {
1267         {
1268                 .matches = {
1269                         DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
1270                 },
1271         },
1272         {
1273                 .matches = {
1274                         DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
1275                 },
1276         },
1277         {
1278                 .matches = {
1279                         DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
1280                 },
1281         },
1282         {
1283                 .matches = {
1284                         DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
1285                 },
1286         },
1287         { }
1288 };
1289 #endif
1290
1291 #endif /* CONFIG_X86 */
1292
1293 #ifdef CONFIG_PNP
1294 #include <linux/pnp.h>
1295
1296 static bool i8042_pnp_kbd_registered;
1297 static unsigned int i8042_pnp_kbd_devices;
1298 static bool i8042_pnp_aux_registered;
1299 static unsigned int i8042_pnp_aux_devices;
1300
1301 static int i8042_pnp_command_reg;
1302 static int i8042_pnp_data_reg;
1303 static int i8042_pnp_kbd_irq;
1304 static int i8042_pnp_aux_irq;
1305
1306 static char i8042_pnp_kbd_name[32];
1307 static char i8042_pnp_aux_name[32];
1308
1309 static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
1310 {
1311         strscpy(dst, "PNP:", dst_size);
1312
1313         while (id) {
1314                 strlcat(dst, " ", dst_size);
1315                 strlcat(dst, id->id, dst_size);
1316                 id = id->next;
1317         }
1318 }
1319
1320 static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
1321 {
1322         if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
1323                 i8042_pnp_data_reg = pnp_port_start(dev,0);
1324
1325         if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
1326                 i8042_pnp_command_reg = pnp_port_start(dev, 1);
1327
1328         if (pnp_irq_valid(dev,0))
1329                 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
1330
1331         strscpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
1332         if (strlen(pnp_dev_name(dev))) {
1333                 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
1334                 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
1335         }
1336         i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
1337                                sizeof(i8042_kbd_firmware_id));
1338         i8042_kbd_fwnode = dev_fwnode(&dev->dev);
1339
1340         /* Keyboard ports are always supposed to be wakeup-enabled */
1341         device_set_wakeup_enable(&dev->dev, true);
1342
1343         i8042_pnp_kbd_devices++;
1344         return 0;
1345 }
1346
1347 static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
1348 {
1349         if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
1350                 i8042_pnp_data_reg = pnp_port_start(dev,0);
1351
1352         if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
1353                 i8042_pnp_command_reg = pnp_port_start(dev, 1);
1354
1355         if (pnp_irq_valid(dev, 0))
1356                 i8042_pnp_aux_irq = pnp_irq(dev, 0);
1357
1358         strscpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
1359         if (strlen(pnp_dev_name(dev))) {
1360                 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
1361                 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
1362         }
1363         i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
1364                                sizeof(i8042_aux_firmware_id));
1365
1366         i8042_pnp_aux_devices++;
1367         return 0;
1368 }
1369
1370 static const struct pnp_device_id pnp_kbd_devids[] = {
1371         { .id = "PNP0300", .driver_data = 0 },
1372         { .id = "PNP0301", .driver_data = 0 },
1373         { .id = "PNP0302", .driver_data = 0 },
1374         { .id = "PNP0303", .driver_data = 0 },
1375         { .id = "PNP0304", .driver_data = 0 },
1376         { .id = "PNP0305", .driver_data = 0 },
1377         { .id = "PNP0306", .driver_data = 0 },
1378         { .id = "PNP0309", .driver_data = 0 },
1379         { .id = "PNP030a", .driver_data = 0 },
1380         { .id = "PNP030b", .driver_data = 0 },
1381         { .id = "PNP0320", .driver_data = 0 },
1382         { .id = "PNP0343", .driver_data = 0 },
1383         { .id = "PNP0344", .driver_data = 0 },
1384         { .id = "PNP0345", .driver_data = 0 },
1385         { .id = "CPQA0D7", .driver_data = 0 },
1386         { .id = "", },
1387 };
1388 MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids);
1389
1390 static struct pnp_driver i8042_pnp_kbd_driver = {
1391         .name           = "i8042 kbd",
1392         .id_table       = pnp_kbd_devids,
1393         .probe          = i8042_pnp_kbd_probe,
1394         .driver         = {
1395                 .probe_type = PROBE_FORCE_SYNCHRONOUS,
1396                 .suppress_bind_attrs = true,
1397         },
1398 };
1399
1400 static const struct pnp_device_id pnp_aux_devids[] = {
1401         { .id = "AUI0200", .driver_data = 0 },
1402         { .id = "FJC6000", .driver_data = 0 },
1403         { .id = "FJC6001", .driver_data = 0 },
1404         { .id = "PNP0f03", .driver_data = 0 },
1405         { .id = "PNP0f0b", .driver_data = 0 },
1406         { .id = "PNP0f0e", .driver_data = 0 },
1407         { .id = "PNP0f12", .driver_data = 0 },
1408         { .id = "PNP0f13", .driver_data = 0 },
1409         { .id = "PNP0f19", .driver_data = 0 },
1410         { .id = "PNP0f1c", .driver_data = 0 },
1411         { .id = "SYN0801", .driver_data = 0 },
1412         { .id = "", },
1413 };
1414 MODULE_DEVICE_TABLE(pnp, pnp_aux_devids);
1415
1416 static struct pnp_driver i8042_pnp_aux_driver = {
1417         .name           = "i8042 aux",
1418         .id_table       = pnp_aux_devids,
1419         .probe          = i8042_pnp_aux_probe,
1420         .driver         = {
1421                 .probe_type = PROBE_FORCE_SYNCHRONOUS,
1422                 .suppress_bind_attrs = true,
1423         },
1424 };
1425
1426 static void i8042_pnp_exit(void)
1427 {
1428         if (i8042_pnp_kbd_registered) {
1429                 i8042_pnp_kbd_registered = false;
1430                 pnp_unregister_driver(&i8042_pnp_kbd_driver);
1431         }
1432
1433         if (i8042_pnp_aux_registered) {
1434                 i8042_pnp_aux_registered = false;
1435                 pnp_unregister_driver(&i8042_pnp_aux_driver);
1436         }
1437 }
1438
1439 static int __init i8042_pnp_init(void)
1440 {
1441         char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
1442         bool pnp_data_busted = false;
1443         int err;
1444
1445         if (i8042_nopnp) {
1446                 pr_info("PNP detection disabled\n");
1447                 return 0;
1448         }
1449
1450         err = pnp_register_driver(&i8042_pnp_kbd_driver);
1451         if (!err)
1452                 i8042_pnp_kbd_registered = true;
1453
1454         err = pnp_register_driver(&i8042_pnp_aux_driver);
1455         if (!err)
1456                 i8042_pnp_aux_registered = true;
1457
1458         if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
1459                 i8042_pnp_exit();
1460 #if defined(__ia64__)
1461                 return -ENODEV;
1462 #else
1463                 pr_info("PNP: No PS/2 controller found.\n");
1464 #if defined(__loongarch__)
1465                 if (acpi_disabled == 0)
1466                         return -ENODEV;
1467 #else
1468                 if (x86_platform.legacy.i8042 !=
1469                                 X86_LEGACY_I8042_EXPECTED_PRESENT)
1470                         return -ENODEV;
1471 #endif
1472                 pr_info("Probing ports directly.\n");
1473                 return 0;
1474 #endif
1475         }
1476
1477         if (i8042_pnp_kbd_devices)
1478                 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
1479                         "%d", i8042_pnp_kbd_irq);
1480         if (i8042_pnp_aux_devices)
1481                 snprintf(aux_irq_str, sizeof(aux_irq_str),
1482                         "%d", i8042_pnp_aux_irq);
1483
1484         pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
1485                 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
1486                 i8042_pnp_aux_name,
1487                 i8042_pnp_data_reg, i8042_pnp_command_reg,
1488                 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
1489                 aux_irq_str);
1490
1491 #if defined(__ia64__)
1492         if (!i8042_pnp_kbd_devices)
1493                 i8042_nokbd = true;
1494         if (!i8042_pnp_aux_devices)
1495                 i8042_noaux = true;
1496 #endif
1497
1498         if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
1499               i8042_pnp_data_reg != i8042_data_reg) ||
1500             !i8042_pnp_data_reg) {
1501                 pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
1502                         i8042_pnp_data_reg, i8042_data_reg);
1503                 i8042_pnp_data_reg = i8042_data_reg;
1504                 pnp_data_busted = true;
1505         }
1506
1507         if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
1508               i8042_pnp_command_reg != i8042_command_reg) ||
1509             !i8042_pnp_command_reg) {
1510                 pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n",
1511                         i8042_pnp_command_reg, i8042_command_reg);
1512                 i8042_pnp_command_reg = i8042_command_reg;
1513                 pnp_data_busted = true;
1514         }
1515
1516         if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
1517                 pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n",
1518                         i8042_kbd_irq);
1519                 i8042_pnp_kbd_irq = i8042_kbd_irq;
1520                 pnp_data_busted = true;
1521         }
1522
1523         if (!i8042_noaux && !i8042_pnp_aux_irq) {
1524                 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
1525                         pr_warn("PNP: PS/2 appears to have AUX port disabled, "
1526                                 "if this is incorrect please boot with i8042.nopnp\n");
1527                         i8042_noaux = true;
1528                 } else {
1529                         pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n",
1530                                 i8042_aux_irq);
1531                         i8042_pnp_aux_irq = i8042_aux_irq;
1532                 }
1533         }
1534
1535         i8042_data_reg = i8042_pnp_data_reg;
1536         i8042_command_reg = i8042_pnp_command_reg;
1537         i8042_kbd_irq = i8042_pnp_kbd_irq;
1538         i8042_aux_irq = i8042_pnp_aux_irq;
1539
1540 #ifdef CONFIG_X86
1541         i8042_bypass_aux_irq_test = !pnp_data_busted &&
1542                                     dmi_check_system(i8042_dmi_laptop_table);
1543 #endif
1544
1545         return 0;
1546 }
1547
1548 #else  /* !CONFIG_PNP */
1549 static inline int i8042_pnp_init(void) { return 0; }
1550 static inline void i8042_pnp_exit(void) { }
1551 #endif /* CONFIG_PNP */
1552
1553
1554 #ifdef CONFIG_X86
1555 static void __init i8042_check_quirks(void)
1556 {
1557         const struct dmi_system_id *device_quirk_info;
1558         uintptr_t quirks;
1559
1560         device_quirk_info = dmi_first_match(i8042_dmi_quirk_table);
1561         if (!device_quirk_info)
1562                 return;
1563
1564         quirks = (uintptr_t)device_quirk_info->driver_data;
1565
1566         if (quirks & SERIO_QUIRK_NOKBD)
1567                 i8042_nokbd = true;
1568         if (quirks & SERIO_QUIRK_NOAUX)
1569                 i8042_noaux = true;
1570         if (quirks & SERIO_QUIRK_NOMUX)
1571                 i8042_nomux = true;
1572         if (quirks & SERIO_QUIRK_FORCEMUX)
1573                 i8042_nomux = false;
1574         if (quirks & SERIO_QUIRK_UNLOCK)
1575                 i8042_unlock = true;
1576         if (quirks & SERIO_QUIRK_PROBE_DEFER)
1577                 i8042_probe_defer = true;
1578         /* Honor module parameter when value is not default */
1579         if (i8042_reset == I8042_RESET_DEFAULT) {
1580                 if (quirks & SERIO_QUIRK_RESET_ALWAYS)
1581                         i8042_reset = I8042_RESET_ALWAYS;
1582                 if (quirks & SERIO_QUIRK_RESET_NEVER)
1583                         i8042_reset = I8042_RESET_NEVER;
1584         }
1585         if (quirks & SERIO_QUIRK_DIECT)
1586                 i8042_direct = true;
1587         if (quirks & SERIO_QUIRK_DUMBKBD)
1588                 i8042_dumbkbd = true;
1589         if (quirks & SERIO_QUIRK_NOLOOP)
1590                 i8042_noloop = true;
1591         if (quirks & SERIO_QUIRK_NOTIMEOUT)
1592                 i8042_notimeout = true;
1593         if (quirks & SERIO_QUIRK_KBDRESET)
1594                 i8042_kbdreset = true;
1595         if (quirks & SERIO_QUIRK_DRITEK)
1596                 i8042_dritek = true;
1597 #ifdef CONFIG_PNP
1598         if (quirks & SERIO_QUIRK_NOPNP)
1599                 i8042_nopnp = true;
1600 #endif
1601 }
1602 #else
1603 static inline void i8042_check_quirks(void) {}
1604 #endif
1605
1606 static int __init i8042_platform_init(void)
1607 {
1608         int retval;
1609
1610 #ifdef CONFIG_X86
1611         u8 a20_on = 0xdf;
1612         /* Just return if platform does not have i8042 controller */
1613         if (x86_platform.legacy.i8042 == X86_LEGACY_I8042_PLATFORM_ABSENT)
1614                 return -ENODEV;
1615 #endif
1616
1617 /*
1618  * On ix86 platforms touching the i8042 data register region can do really
1619  * bad things. Because of this the region is always reserved on ix86 boxes.
1620  *
1621  *      if (!request_region(I8042_DATA_REG, 16, "i8042"))
1622  *              return -EBUSY;
1623  */
1624
1625         i8042_kbd_irq = I8042_MAP_IRQ(1);
1626         i8042_aux_irq = I8042_MAP_IRQ(12);
1627
1628 #if defined(__ia64__)
1629         i8042_reset = I8042_RESET_ALWAYS;
1630 #endif
1631
1632         i8042_check_quirks();
1633
1634         pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
1635                 i8042_nokbd ? " nokbd" : "",
1636                 i8042_noaux ? " noaux" : "",
1637                 i8042_nomux ? " nomux" : "",
1638                 i8042_unlock ? " unlock" : "",
1639                 i8042_probe_defer ? "probe_defer" : "",
1640                 i8042_reset == I8042_RESET_DEFAULT ?
1641                         "" : i8042_reset == I8042_RESET_ALWAYS ?
1642                                 " reset_always" : " reset_never",
1643                 i8042_direct ? " direct" : "",
1644                 i8042_dumbkbd ? " dumbkbd" : "",
1645                 i8042_noloop ? " noloop" : "",
1646                 i8042_notimeout ? " notimeout" : "",
1647                 i8042_kbdreset ? " kbdreset" : "",
1648 #ifdef CONFIG_X86
1649                 i8042_dritek ? " dritek" : "",
1650 #else
1651                 "",
1652 #endif
1653 #ifdef CONFIG_PNP
1654                 i8042_nopnp ? " nopnp" : "");
1655 #else
1656                 "");
1657 #endif
1658
1659         retval = i8042_pnp_init();
1660         if (retval)
1661                 return retval;
1662
1663 #ifdef CONFIG_X86
1664         /*
1665          * A20 was already enabled during early kernel init. But some buggy
1666          * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
1667          * resume from S3. So we do it here and hope that nothing breaks.
1668          */
1669         i8042_command(&a20_on, 0x10d1);
1670         i8042_command(NULL, 0x00ff);    /* Null command for SMM firmware */
1671 #endif /* CONFIG_X86 */
1672
1673         return retval;
1674 }
1675
1676 static inline void i8042_platform_exit(void)
1677 {
1678         i8042_pnp_exit();
1679 }
1680
1681 #endif /* _I8042_ACPIPNPIO_H */