Linux Audio

Check our new training course

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