i8042-x86ia64io.h 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324
  1. #ifndef _I8042_X86IA64IO_H
  2. #define _I8042_X86IA64IO_H
  3. /*
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License version 2 as published by
  6. * the Free Software Foundation.
  7. */
  8. #ifdef CONFIG_X86
  9. #include <asm/x86_init.h>
  10. #endif
  11. /*
  12. * Names.
  13. */
  14. #define I8042_KBD_PHYS_DESC "isa0060/serio0"
  15. #define I8042_AUX_PHYS_DESC "isa0060/serio1"
  16. #define I8042_MUX_PHYS_DESC "isa0060/serio%d"
  17. /*
  18. * IRQs.
  19. */
  20. #if defined(__ia64__)
  21. # define I8042_MAP_IRQ(x) isa_irq_to_vector((x))
  22. #else
  23. # define I8042_MAP_IRQ(x) (x)
  24. #endif
  25. #define I8042_KBD_IRQ i8042_kbd_irq
  26. #define I8042_AUX_IRQ i8042_aux_irq
  27. static int i8042_kbd_irq;
  28. static int i8042_aux_irq;
  29. /*
  30. * Register numbers.
  31. */
  32. #define I8042_COMMAND_REG i8042_command_reg
  33. #define I8042_STATUS_REG i8042_command_reg
  34. #define I8042_DATA_REG i8042_data_reg
  35. static int i8042_command_reg = 0x64;
  36. static int i8042_data_reg = 0x60;
  37. static inline int i8042_read_data(void)
  38. {
  39. return inb(I8042_DATA_REG);
  40. }
  41. static inline int i8042_read_status(void)
  42. {
  43. return inb(I8042_STATUS_REG);
  44. }
  45. static inline void i8042_write_data(int val)
  46. {
  47. outb(val, I8042_DATA_REG);
  48. }
  49. static inline void i8042_write_command(int val)
  50. {
  51. outb(val, I8042_COMMAND_REG);
  52. }
  53. #ifdef CONFIG_X86
  54. #include <linux/dmi.h>
  55. static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
  56. {
  57. /*
  58. * Arima-Rioworks HDAMB -
  59. * AUX LOOP command does not raise AUX IRQ
  60. */
  61. .matches = {
  62. DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
  63. DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
  64. DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
  65. },
  66. },
  67. {
  68. /* ASUS G1S */
  69. .matches = {
  70. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
  71. DMI_MATCH(DMI_BOARD_NAME, "G1S"),
  72. DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
  73. },
  74. },
  75. {
  76. /* ASUS P65UP5 - AUX LOOP command does not raise AUX IRQ */
  77. .matches = {
  78. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  79. DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
  80. DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
  81. },
  82. },
  83. {
  84. .matches = {
  85. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  86. DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"),
  87. },
  88. },
  89. {
  90. .matches = {
  91. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  92. DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
  93. DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
  94. },
  95. },
  96. {
  97. .matches = {
  98. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  99. DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
  100. DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
  101. },
  102. },
  103. {
  104. /* Dell Embedded Box PC 3000 */
  105. .matches = {
  106. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  107. DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
  108. },
  109. },
  110. {
  111. /* OQO Model 01 */
  112. .matches = {
  113. DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
  114. DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
  115. DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
  116. },
  117. },
  118. {
  119. /* ULI EV4873 - AUX LOOP does not work properly */
  120. .matches = {
  121. DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
  122. DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
  123. DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
  124. },
  125. },
  126. {
  127. /* Microsoft Virtual Machine */
  128. .matches = {
  129. DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
  130. DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
  131. DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
  132. },
  133. },
  134. {
  135. /* Medion MAM 2070 */
  136. .matches = {
  137. DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
  138. DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
  139. DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
  140. },
  141. },
  142. {
  143. /* Medion Akoya E7225 */
  144. .matches = {
  145. DMI_MATCH(DMI_SYS_VENDOR, "Medion"),
  146. DMI_MATCH(DMI_PRODUCT_NAME, "Akoya E7225"),
  147. DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
  148. },
  149. },
  150. {
  151. /* Blue FB5601 */
  152. .matches = {
  153. DMI_MATCH(DMI_SYS_VENDOR, "blue"),
  154. DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
  155. DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
  156. },
  157. },
  158. {
  159. /* Gigabyte M912 */
  160. .matches = {
  161. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  162. DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
  163. DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
  164. },
  165. },
  166. {
  167. /* Gigabyte M1022M netbook */
  168. .matches = {
  169. DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
  170. DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
  171. DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
  172. },
  173. },
  174. {
  175. /* Gigabyte Spring Peak - defines wrong chassis type */
  176. .matches = {
  177. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  178. DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
  179. },
  180. },
  181. {
  182. /* Gigabyte T1005 - defines wrong chassis type ("Other") */
  183. .matches = {
  184. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  185. DMI_MATCH(DMI_PRODUCT_NAME, "T1005"),
  186. },
  187. },
  188. {
  189. /* Gigabyte T1005M/P - defines wrong chassis type ("Other") */
  190. .matches = {
  191. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  192. DMI_MATCH(DMI_PRODUCT_NAME, "T1005M/P"),
  193. },
  194. },
  195. {
  196. .matches = {
  197. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  198. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
  199. DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
  200. },
  201. },
  202. {
  203. .matches = {
  204. DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"),
  205. DMI_MATCH(DMI_PRODUCT_NAME, "C15B"),
  206. },
  207. },
  208. {
  209. .matches = {
  210. DMI_MATCH(DMI_SYS_VENDOR, "ByteSpeed LLC"),
  211. DMI_MATCH(DMI_PRODUCT_NAME, "ByteSpeed Laptop C15B"),
  212. },
  213. },
  214. { }
  215. };
  216. /*
  217. * Some Fujitsu notebooks are having trouble with touchpads if
  218. * active multiplexing mode is activated. Luckily they don't have
  219. * external PS/2 ports so we can safely disable it.
  220. * ... apparently some Toshibas don't like MUX mode either and
  221. * die horrible death on reboot.
  222. */
  223. static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
  224. {
  225. /* Fujitsu Lifebook P7010/P7010D */
  226. .matches = {
  227. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  228. DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
  229. },
  230. },
  231. {
  232. /* Fujitsu Lifebook P7010 */
  233. .matches = {
  234. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  235. DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
  236. },
  237. },
  238. {
  239. /* Fujitsu Lifebook P5020D */
  240. .matches = {
  241. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  242. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
  243. },
  244. },
  245. {
  246. /* Fujitsu Lifebook S2000 */
  247. .matches = {
  248. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  249. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
  250. },
  251. },
  252. {
  253. /* Fujitsu Lifebook S6230 */
  254. .matches = {
  255. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  256. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
  257. },
  258. },
  259. {
  260. /* Fujitsu Lifebook U745 */
  261. .matches = {
  262. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  263. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"),
  264. },
  265. },
  266. {
  267. /* Fujitsu T70H */
  268. .matches = {
  269. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  270. DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
  271. },
  272. },
  273. {
  274. /* Fujitsu-Siemens Lifebook T3010 */
  275. .matches = {
  276. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  277. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
  278. },
  279. },
  280. {
  281. /* Fujitsu-Siemens Lifebook E4010 */
  282. .matches = {
  283. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  284. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
  285. },
  286. },
  287. {
  288. /* Fujitsu-Siemens Amilo Pro 2010 */
  289. .matches = {
  290. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  291. DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
  292. },
  293. },
  294. {
  295. /* Fujitsu-Siemens Amilo Pro 2030 */
  296. .matches = {
  297. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  298. DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
  299. },
  300. },
  301. {
  302. /*
  303. * No data is coming from the touchscreen unless KBC
  304. * is in legacy mode.
  305. */
  306. /* Panasonic CF-29 */
  307. .matches = {
  308. DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
  309. DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
  310. },
  311. },
  312. {
  313. /*
  314. * HP Pavilion DV4017EA -
  315. * errors on MUX ports are reported without raising AUXDATA
  316. * causing "spurious NAK" messages.
  317. */
  318. .matches = {
  319. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  320. DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
  321. },
  322. },
  323. {
  324. /*
  325. * HP Pavilion ZT1000 -
  326. * like DV4017EA does not raise AUXERR for errors on MUX ports.
  327. */
  328. .matches = {
  329. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  330. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
  331. DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
  332. },
  333. },
  334. {
  335. /*
  336. * HP Pavilion DV4270ca -
  337. * like DV4017EA does not raise AUXERR for errors on MUX ports.
  338. */
  339. .matches = {
  340. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  341. DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
  342. },
  343. },
  344. {
  345. .matches = {
  346. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  347. DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
  348. },
  349. },
  350. {
  351. .matches = {
  352. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  353. DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
  354. },
  355. },
  356. {
  357. .matches = {
  358. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  359. DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"),
  360. },
  361. },
  362. {
  363. .matches = {
  364. DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
  365. DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
  366. },
  367. },
  368. {
  369. /* Sharp Actius MM20 */
  370. .matches = {
  371. DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
  372. DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
  373. },
  374. },
  375. {
  376. /* Sony Vaio FS-115b */
  377. .matches = {
  378. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  379. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
  380. },
  381. },
  382. {
  383. /*
  384. * Sony Vaio FZ-240E -
  385. * reset and GET ID commands issued via KBD port are
  386. * sometimes being delivered to AUX3.
  387. */
  388. .matches = {
  389. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  390. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
  391. },
  392. },
  393. {
  394. /*
  395. * Most (all?) VAIOs do not have external PS/2 ports nor
  396. * they implement active multiplexing properly, and
  397. * MUX discovery usually messes up keyboard/touchpad.
  398. */
  399. .matches = {
  400. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  401. DMI_MATCH(DMI_BOARD_NAME, "VAIO"),
  402. },
  403. },
  404. {
  405. /* Amoi M636/A737 */
  406. .matches = {
  407. DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
  408. DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
  409. },
  410. },
  411. {
  412. /* Lenovo 3000 n100 */
  413. .matches = {
  414. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  415. DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
  416. },
  417. },
  418. {
  419. /* Lenovo XiaoXin Air 12 */
  420. .matches = {
  421. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  422. DMI_MATCH(DMI_PRODUCT_NAME, "80UN"),
  423. },
  424. },
  425. {
  426. .matches = {
  427. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  428. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
  429. },
  430. },
  431. {
  432. /* Acer Aspire 5710 */
  433. .matches = {
  434. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  435. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710"),
  436. },
  437. },
  438. {
  439. /* Acer Aspire 7738 */
  440. .matches = {
  441. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  442. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7738"),
  443. },
  444. },
  445. {
  446. /* Gericom Bellagio */
  447. .matches = {
  448. DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
  449. DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
  450. },
  451. },
  452. {
  453. /* IBM 2656 */
  454. .matches = {
  455. DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
  456. DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
  457. },
  458. },
  459. {
  460. /* Dell XPS M1530 */
  461. .matches = {
  462. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  463. DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
  464. },
  465. },
  466. {
  467. /* Compal HEL80I */
  468. .matches = {
  469. DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
  470. DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
  471. },
  472. },
  473. {
  474. /* Dell Vostro 1510 */
  475. .matches = {
  476. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  477. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
  478. },
  479. },
  480. {
  481. /* Acer Aspire 5536 */
  482. .matches = {
  483. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  484. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
  485. DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
  486. },
  487. },
  488. {
  489. /* Dell Vostro V13 */
  490. .matches = {
  491. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  492. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
  493. },
  494. },
  495. {
  496. /* Newer HP Pavilion dv4 models */
  497. .matches = {
  498. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  499. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
  500. },
  501. },
  502. {
  503. /* Asus X450LCP */
  504. .matches = {
  505. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  506. DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"),
  507. },
  508. },
  509. {
  510. /* Avatar AVIU-145A6 */
  511. .matches = {
  512. DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
  513. DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
  514. },
  515. },
  516. {
  517. /* TUXEDO BU1406 */
  518. .matches = {
  519. DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
  520. DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
  521. },
  522. },
  523. {
  524. /* Lenovo LaVie Z */
  525. .matches = {
  526. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  527. DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo LaVie Z"),
  528. },
  529. },
  530. {
  531. /*
  532. * Acer Aspire 5738z
  533. * Touchpad stops working in mux mode when dis- + re-enabled
  534. * with the touchpad enable/disable toggle hotkey
  535. */
  536. .matches = {
  537. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  538. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
  539. },
  540. },
  541. {
  542. /* Entroware Proteus */
  543. .matches = {
  544. DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
  545. DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
  546. DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
  547. },
  548. },
  549. { }
  550. };
  551. static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = {
  552. {
  553. /*
  554. * Sony Vaio VGN-CS series require MUX or the touch sensor
  555. * buttons will disturb touchpad operation
  556. */
  557. .matches = {
  558. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  559. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"),
  560. },
  561. },
  562. { }
  563. };
  564. /*
  565. * On some Asus laptops, just running self tests cause problems.
  566. */
  567. static const struct dmi_system_id i8042_dmi_noselftest_table[] = {
  568. {
  569. .matches = {
  570. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  571. DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
  572. },
  573. }, {
  574. .matches = {
  575. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  576. DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */
  577. },
  578. },
  579. { }
  580. };
  581. static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
  582. {
  583. /* MSI Wind U-100 */
  584. .matches = {
  585. DMI_MATCH(DMI_BOARD_NAME, "U-100"),
  586. DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
  587. },
  588. },
  589. {
  590. /* LG Electronics X110 */
  591. .matches = {
  592. DMI_MATCH(DMI_BOARD_NAME, "X110"),
  593. DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
  594. },
  595. },
  596. {
  597. /* Acer Aspire One 150 */
  598. .matches = {
  599. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  600. DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
  601. },
  602. },
  603. {
  604. .matches = {
  605. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  606. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A114-31"),
  607. },
  608. },
  609. {
  610. .matches = {
  611. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  612. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A314-31"),
  613. },
  614. },
  615. {
  616. .matches = {
  617. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  618. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A315-31"),
  619. },
  620. },
  621. {
  622. .matches = {
  623. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  624. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-132"),
  625. },
  626. },
  627. {
  628. .matches = {
  629. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  630. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-332"),
  631. },
  632. },
  633. {
  634. .matches = {
  635. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  636. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire ES1-432"),
  637. },
  638. },
  639. {
  640. .matches = {
  641. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  642. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate Spin B118-RN"),
  643. },
  644. },
  645. {
  646. /* Advent 4211 */
  647. .matches = {
  648. DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
  649. DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
  650. },
  651. },
  652. {
  653. /* Medion Akoya Mini E1210 */
  654. .matches = {
  655. DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
  656. DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
  657. },
  658. },
  659. {
  660. /* Medion Akoya E1222 */
  661. .matches = {
  662. DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
  663. DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
  664. },
  665. },
  666. {
  667. /* Mivvy M310 */
  668. .matches = {
  669. DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
  670. DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
  671. },
  672. },
  673. {
  674. /* Dell Vostro 1320 */
  675. .matches = {
  676. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  677. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
  678. },
  679. },
  680. {
  681. /* Dell Vostro 1520 */
  682. .matches = {
  683. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  684. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
  685. },
  686. },
  687. {
  688. /* Dell Vostro 1720 */
  689. .matches = {
  690. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  691. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
  692. },
  693. },
  694. {
  695. /* Lenovo Ideapad U455 */
  696. .matches = {
  697. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  698. DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
  699. },
  700. },
  701. {
  702. /* Lenovo ThinkPad L460 */
  703. .matches = {
  704. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  705. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"),
  706. },
  707. },
  708. {
  709. /* Clevo P650RS, 650RP6, Sager NP8152-S, and others */
  710. .matches = {
  711. DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
  712. DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
  713. },
  714. },
  715. {
  716. /* Lenovo ThinkPad Twist S230u */
  717. .matches = {
  718. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  719. DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
  720. },
  721. },
  722. {
  723. /* Entroware Proteus */
  724. .matches = {
  725. DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
  726. DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
  727. DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
  728. },
  729. },
  730. { }
  731. };
  732. #ifdef CONFIG_PNP
  733. static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
  734. {
  735. /* Intel MBO Desktop D845PESV */
  736. .matches = {
  737. DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
  738. DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
  739. },
  740. },
  741. {
  742. /*
  743. * Intel NUC D54250WYK - does not have i8042 controller but
  744. * declares PS/2 devices in DSDT.
  745. */
  746. .matches = {
  747. DMI_MATCH(DMI_BOARD_NAME, "D54250WYK"),
  748. DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
  749. },
  750. },
  751. {
  752. /* MSI Wind U-100 */
  753. .matches = {
  754. DMI_MATCH(DMI_BOARD_NAME, "U-100"),
  755. DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
  756. },
  757. },
  758. {
  759. /* Acer Aspire 5 A515 */
  760. .matches = {
  761. DMI_MATCH(DMI_BOARD_NAME, "Grumpy_PK"),
  762. DMI_MATCH(DMI_BOARD_VENDOR, "PK"),
  763. },
  764. },
  765. { }
  766. };
  767. static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
  768. {
  769. .matches = {
  770. DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
  771. },
  772. },
  773. {
  774. .matches = {
  775. DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
  776. },
  777. },
  778. {
  779. .matches = {
  780. DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
  781. },
  782. },
  783. {
  784. .matches = {
  785. DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
  786. },
  787. },
  788. { }
  789. };
  790. #endif
  791. static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
  792. {
  793. /* Dell Vostro V13 */
  794. .matches = {
  795. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  796. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
  797. },
  798. },
  799. {
  800. /* Newer HP Pavilion dv4 models */
  801. .matches = {
  802. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  803. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
  804. },
  805. },
  806. {
  807. /* Fujitsu A544 laptop */
  808. /* https://bugzilla.redhat.com/show_bug.cgi?id=1111138 */
  809. .matches = {
  810. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  811. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK A544"),
  812. },
  813. },
  814. {
  815. /* Fujitsu AH544 laptop */
  816. /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
  817. .matches = {
  818. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  819. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"),
  820. },
  821. },
  822. {
  823. /* Fujitsu U574 laptop */
  824. /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
  825. .matches = {
  826. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  827. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"),
  828. },
  829. },
  830. {
  831. /* Fujitsu UH554 laptop */
  832. .matches = {
  833. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  834. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK UH544"),
  835. },
  836. },
  837. { }
  838. };
  839. /*
  840. * Some Wistron based laptops need us to explicitly enable the 'Dritek
  841. * keyboard extension' to make their extra keys start generating scancodes.
  842. * Originally, this was just confined to older laptops, but a few Acer laptops
  843. * have turned up in 2007 that also need this again.
  844. */
  845. static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
  846. {
  847. /* Acer Aspire 5100 */
  848. .matches = {
  849. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  850. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
  851. },
  852. },
  853. {
  854. /* Acer Aspire 5610 */
  855. .matches = {
  856. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  857. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
  858. },
  859. },
  860. {
  861. /* Acer Aspire 5630 */
  862. .matches = {
  863. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  864. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
  865. },
  866. },
  867. {
  868. /* Acer Aspire 5650 */
  869. .matches = {
  870. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  871. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
  872. },
  873. },
  874. {
  875. /* Acer Aspire 5680 */
  876. .matches = {
  877. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  878. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
  879. },
  880. },
  881. {
  882. /* Acer Aspire 5720 */
  883. .matches = {
  884. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  885. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
  886. },
  887. },
  888. {
  889. /* Acer Aspire 9110 */
  890. .matches = {
  891. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  892. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
  893. },
  894. },
  895. {
  896. /* Acer TravelMate 660 */
  897. .matches = {
  898. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  899. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
  900. },
  901. },
  902. {
  903. /* Acer TravelMate 2490 */
  904. .matches = {
  905. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  906. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
  907. },
  908. },
  909. {
  910. /* Acer TravelMate 4280 */
  911. .matches = {
  912. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  913. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
  914. },
  915. },
  916. { }
  917. };
  918. /*
  919. * Some laptops need keyboard reset before probing for the trackpad to get
  920. * it detected, initialised & finally work.
  921. */
  922. static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = {
  923. {
  924. /* Gigabyte P35 v2 - Elantech touchpad */
  925. .matches = {
  926. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  927. DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"),
  928. },
  929. },
  930. {
  931. /* Aorus branded Gigabyte X3 Plus - Elantech touchpad */
  932. .matches = {
  933. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  934. DMI_MATCH(DMI_PRODUCT_NAME, "X3"),
  935. },
  936. },
  937. {
  938. /* Gigabyte P34 - Elantech touchpad */
  939. .matches = {
  940. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  941. DMI_MATCH(DMI_PRODUCT_NAME, "P34"),
  942. },
  943. },
  944. {
  945. /* Gigabyte P57 - Elantech touchpad */
  946. .matches = {
  947. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  948. DMI_MATCH(DMI_PRODUCT_NAME, "P57"),
  949. },
  950. },
  951. {
  952. /* Schenker XMG C504 - Elantech touchpad */
  953. .matches = {
  954. DMI_MATCH(DMI_SYS_VENDOR, "XMG"),
  955. DMI_MATCH(DMI_PRODUCT_NAME, "C504"),
  956. },
  957. },
  958. { }
  959. };
  960. #endif /* CONFIG_X86 */
  961. #ifdef CONFIG_PNP
  962. #include <linux/pnp.h>
  963. static bool i8042_pnp_kbd_registered;
  964. static unsigned int i8042_pnp_kbd_devices;
  965. static bool i8042_pnp_aux_registered;
  966. static unsigned int i8042_pnp_aux_devices;
  967. static int i8042_pnp_command_reg;
  968. static int i8042_pnp_data_reg;
  969. static int i8042_pnp_kbd_irq;
  970. static int i8042_pnp_aux_irq;
  971. static char i8042_pnp_kbd_name[32];
  972. static char i8042_pnp_aux_name[32];
  973. static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
  974. {
  975. strlcpy(dst, "PNP:", dst_size);
  976. while (id) {
  977. strlcat(dst, " ", dst_size);
  978. strlcat(dst, id->id, dst_size);
  979. id = id->next;
  980. }
  981. }
  982. static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
  983. {
  984. if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
  985. i8042_pnp_data_reg = pnp_port_start(dev,0);
  986. if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
  987. i8042_pnp_command_reg = pnp_port_start(dev, 1);
  988. if (pnp_irq_valid(dev,0))
  989. i8042_pnp_kbd_irq = pnp_irq(dev, 0);
  990. strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
  991. if (strlen(pnp_dev_name(dev))) {
  992. strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
  993. strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
  994. }
  995. i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
  996. sizeof(i8042_kbd_firmware_id));
  997. /* Keyboard ports are always supposed to be wakeup-enabled */
  998. device_set_wakeup_enable(&dev->dev, true);
  999. i8042_pnp_kbd_devices++;
  1000. return 0;
  1001. }
  1002. static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
  1003. {
  1004. if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
  1005. i8042_pnp_data_reg = pnp_port_start(dev,0);
  1006. if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
  1007. i8042_pnp_command_reg = pnp_port_start(dev, 1);
  1008. if (pnp_irq_valid(dev, 0))
  1009. i8042_pnp_aux_irq = pnp_irq(dev, 0);
  1010. strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
  1011. if (strlen(pnp_dev_name(dev))) {
  1012. strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
  1013. strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
  1014. }
  1015. i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
  1016. sizeof(i8042_aux_firmware_id));
  1017. i8042_pnp_aux_devices++;
  1018. return 0;
  1019. }
  1020. static const struct pnp_device_id pnp_kbd_devids[] = {
  1021. { .id = "PNP0300", .driver_data = 0 },
  1022. { .id = "PNP0301", .driver_data = 0 },
  1023. { .id = "PNP0302", .driver_data = 0 },
  1024. { .id = "PNP0303", .driver_data = 0 },
  1025. { .id = "PNP0304", .driver_data = 0 },
  1026. { .id = "PNP0305", .driver_data = 0 },
  1027. { .id = "PNP0306", .driver_data = 0 },
  1028. { .id = "PNP0309", .driver_data = 0 },
  1029. { .id = "PNP030a", .driver_data = 0 },
  1030. { .id = "PNP030b", .driver_data = 0 },
  1031. { .id = "PNP0320", .driver_data = 0 },
  1032. { .id = "PNP0343", .driver_data = 0 },
  1033. { .id = "PNP0344", .driver_data = 0 },
  1034. { .id = "PNP0345", .driver_data = 0 },
  1035. { .id = "CPQA0D7", .driver_data = 0 },
  1036. { .id = "", },
  1037. };
  1038. MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids);
  1039. static struct pnp_driver i8042_pnp_kbd_driver = {
  1040. .name = "i8042 kbd",
  1041. .id_table = pnp_kbd_devids,
  1042. .probe = i8042_pnp_kbd_probe,
  1043. .driver = {
  1044. .probe_type = PROBE_FORCE_SYNCHRONOUS,
  1045. .suppress_bind_attrs = true,
  1046. },
  1047. };
  1048. static const struct pnp_device_id pnp_aux_devids[] = {
  1049. { .id = "AUI0200", .driver_data = 0 },
  1050. { .id = "FJC6000", .driver_data = 0 },
  1051. { .id = "FJC6001", .driver_data = 0 },
  1052. { .id = "PNP0f03", .driver_data = 0 },
  1053. { .id = "PNP0f0b", .driver_data = 0 },
  1054. { .id = "PNP0f0e", .driver_data = 0 },
  1055. { .id = "PNP0f12", .driver_data = 0 },
  1056. { .id = "PNP0f13", .driver_data = 0 },
  1057. { .id = "PNP0f19", .driver_data = 0 },
  1058. { .id = "PNP0f1c", .driver_data = 0 },
  1059. { .id = "SYN0801", .driver_data = 0 },
  1060. { .id = "", },
  1061. };
  1062. MODULE_DEVICE_TABLE(pnp, pnp_aux_devids);
  1063. static struct pnp_driver i8042_pnp_aux_driver = {
  1064. .name = "i8042 aux",
  1065. .id_table = pnp_aux_devids,
  1066. .probe = i8042_pnp_aux_probe,
  1067. .driver = {
  1068. .probe_type = PROBE_FORCE_SYNCHRONOUS,
  1069. .suppress_bind_attrs = true,
  1070. },
  1071. };
  1072. static void i8042_pnp_exit(void)
  1073. {
  1074. if (i8042_pnp_kbd_registered) {
  1075. i8042_pnp_kbd_registered = false;
  1076. pnp_unregister_driver(&i8042_pnp_kbd_driver);
  1077. }
  1078. if (i8042_pnp_aux_registered) {
  1079. i8042_pnp_aux_registered = false;
  1080. pnp_unregister_driver(&i8042_pnp_aux_driver);
  1081. }
  1082. }
  1083. static int __init i8042_pnp_init(void)
  1084. {
  1085. char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
  1086. bool pnp_data_busted = false;
  1087. int err;
  1088. #ifdef CONFIG_X86
  1089. if (dmi_check_system(i8042_dmi_nopnp_table))
  1090. i8042_nopnp = true;
  1091. #endif
  1092. if (i8042_nopnp) {
  1093. pr_info("PNP detection disabled\n");
  1094. return 0;
  1095. }
  1096. err = pnp_register_driver(&i8042_pnp_kbd_driver);
  1097. if (!err)
  1098. i8042_pnp_kbd_registered = true;
  1099. err = pnp_register_driver(&i8042_pnp_aux_driver);
  1100. if (!err)
  1101. i8042_pnp_aux_registered = true;
  1102. if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
  1103. i8042_pnp_exit();
  1104. #if defined(__ia64__)
  1105. return -ENODEV;
  1106. #else
  1107. pr_info("PNP: No PS/2 controller found.\n");
  1108. if (x86_platform.legacy.i8042 !=
  1109. X86_LEGACY_I8042_EXPECTED_PRESENT)
  1110. return -ENODEV;
  1111. pr_info("Probing ports directly.\n");
  1112. return 0;
  1113. #endif
  1114. }
  1115. if (i8042_pnp_kbd_devices)
  1116. snprintf(kbd_irq_str, sizeof(kbd_irq_str),
  1117. "%d", i8042_pnp_kbd_irq);
  1118. if (i8042_pnp_aux_devices)
  1119. snprintf(aux_irq_str, sizeof(aux_irq_str),
  1120. "%d", i8042_pnp_aux_irq);
  1121. pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
  1122. i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
  1123. i8042_pnp_aux_name,
  1124. i8042_pnp_data_reg, i8042_pnp_command_reg,
  1125. kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
  1126. aux_irq_str);
  1127. #if defined(__ia64__)
  1128. if (!i8042_pnp_kbd_devices)
  1129. i8042_nokbd = true;
  1130. if (!i8042_pnp_aux_devices)
  1131. i8042_noaux = true;
  1132. #endif
  1133. if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
  1134. i8042_pnp_data_reg != i8042_data_reg) ||
  1135. !i8042_pnp_data_reg) {
  1136. pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
  1137. i8042_pnp_data_reg, i8042_data_reg);
  1138. i8042_pnp_data_reg = i8042_data_reg;
  1139. pnp_data_busted = true;
  1140. }
  1141. if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
  1142. i8042_pnp_command_reg != i8042_command_reg) ||
  1143. !i8042_pnp_command_reg) {
  1144. pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n",
  1145. i8042_pnp_command_reg, i8042_command_reg);
  1146. i8042_pnp_command_reg = i8042_command_reg;
  1147. pnp_data_busted = true;
  1148. }
  1149. if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
  1150. pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n",
  1151. i8042_kbd_irq);
  1152. i8042_pnp_kbd_irq = i8042_kbd_irq;
  1153. pnp_data_busted = true;
  1154. }
  1155. if (!i8042_noaux && !i8042_pnp_aux_irq) {
  1156. if (!pnp_data_busted && i8042_pnp_kbd_irq) {
  1157. pr_warn("PNP: PS/2 appears to have AUX port disabled, "
  1158. "if this is incorrect please boot with i8042.nopnp\n");
  1159. i8042_noaux = true;
  1160. } else {
  1161. pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n",
  1162. i8042_aux_irq);
  1163. i8042_pnp_aux_irq = i8042_aux_irq;
  1164. }
  1165. }
  1166. i8042_data_reg = i8042_pnp_data_reg;
  1167. i8042_command_reg = i8042_pnp_command_reg;
  1168. i8042_kbd_irq = i8042_pnp_kbd_irq;
  1169. i8042_aux_irq = i8042_pnp_aux_irq;
  1170. #ifdef CONFIG_X86
  1171. i8042_bypass_aux_irq_test = !pnp_data_busted &&
  1172. dmi_check_system(i8042_dmi_laptop_table);
  1173. #endif
  1174. return 0;
  1175. }
  1176. #else /* !CONFIG_PNP */
  1177. static inline int i8042_pnp_init(void) { return 0; }
  1178. static inline void i8042_pnp_exit(void) { }
  1179. #endif /* CONFIG_PNP */
  1180. static int __init i8042_platform_init(void)
  1181. {
  1182. int retval;
  1183. #ifdef CONFIG_X86
  1184. u8 a20_on = 0xdf;
  1185. /* Just return if platform does not have i8042 controller */
  1186. if (x86_platform.legacy.i8042 == X86_LEGACY_I8042_PLATFORM_ABSENT)
  1187. return -ENODEV;
  1188. #endif
  1189. /*
  1190. * On ix86 platforms touching the i8042 data register region can do really
  1191. * bad things. Because of this the region is always reserved on ix86 boxes.
  1192. *
  1193. * if (!request_region(I8042_DATA_REG, 16, "i8042"))
  1194. * return -EBUSY;
  1195. */
  1196. i8042_kbd_irq = I8042_MAP_IRQ(1);
  1197. i8042_aux_irq = I8042_MAP_IRQ(12);
  1198. retval = i8042_pnp_init();
  1199. if (retval)
  1200. return retval;
  1201. #if defined(__ia64__)
  1202. i8042_reset = I8042_RESET_ALWAYS;
  1203. #endif
  1204. #ifdef CONFIG_X86
  1205. /* Honor module parameter when value is not default */
  1206. if (i8042_reset == I8042_RESET_DEFAULT) {
  1207. if (dmi_check_system(i8042_dmi_reset_table))
  1208. i8042_reset = I8042_RESET_ALWAYS;
  1209. if (dmi_check_system(i8042_dmi_noselftest_table))
  1210. i8042_reset = I8042_RESET_NEVER;
  1211. }
  1212. if (dmi_check_system(i8042_dmi_noloop_table))
  1213. i8042_noloop = true;
  1214. if (dmi_check_system(i8042_dmi_nomux_table))
  1215. i8042_nomux = true;
  1216. if (dmi_check_system(i8042_dmi_forcemux_table))
  1217. i8042_nomux = false;
  1218. if (dmi_check_system(i8042_dmi_notimeout_table))
  1219. i8042_notimeout = true;
  1220. if (dmi_check_system(i8042_dmi_dritek_table))
  1221. i8042_dritek = true;
  1222. if (dmi_check_system(i8042_dmi_kbdreset_table))
  1223. i8042_kbdreset = true;
  1224. /*
  1225. * A20 was already enabled during early kernel init. But some buggy
  1226. * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
  1227. * resume from S3. So we do it here and hope that nothing breaks.
  1228. */
  1229. i8042_command(&a20_on, 0x10d1);
  1230. i8042_command(NULL, 0x00ff); /* Null command for SMM firmware */
  1231. #endif /* CONFIG_X86 */
  1232. return retval;
  1233. }
  1234. static inline void i8042_platform_exit(void)
  1235. {
  1236. i8042_pnp_exit();
  1237. }
  1238. #endif /* _I8042_X86IA64IO_H */