File Index
Files and directories
Sign in
FILE

i8042-acpipnpio.h

File preview with syntax highlighting.

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