i8042-x86ia64io.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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, "Compaq"),
  86. DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
  87. DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
  88. },
  89. },
  90. {
  91. .matches = {
  92. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  93. DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
  94. DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
  95. },
  96. },
  97. {
  98. /* OQO Model 01 */
  99. .matches = {
  100. DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
  101. DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
  102. DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
  103. },
  104. },
  105. {
  106. /* ULI EV4873 - AUX LOOP does not work properly */
  107. .matches = {
  108. DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
  109. DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
  110. DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
  111. },
  112. },
  113. {
  114. /* Microsoft Virtual Machine */
  115. .matches = {
  116. DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
  117. DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
  118. DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
  119. },
  120. },
  121. {
  122. /* Medion MAM 2070 */
  123. .matches = {
  124. DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
  125. DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
  126. DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
  127. },
  128. },
  129. {
  130. /* Blue FB5601 */
  131. .matches = {
  132. DMI_MATCH(DMI_SYS_VENDOR, "blue"),
  133. DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
  134. DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
  135. },
  136. },
  137. {
  138. /* Gigabyte M912 */
  139. .matches = {
  140. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  141. DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
  142. DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
  143. },
  144. },
  145. {
  146. /* Gigabyte M1022M netbook */
  147. .matches = {
  148. DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
  149. DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
  150. DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
  151. },
  152. },
  153. {
  154. /* Gigabyte Spring Peak - defines wrong chassis type */
  155. .matches = {
  156. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  157. DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
  158. },
  159. },
  160. {
  161. /* Gigabyte T1005 - defines wrong chassis type ("Other") */
  162. .matches = {
  163. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  164. DMI_MATCH(DMI_PRODUCT_NAME, "T1005"),
  165. },
  166. },
  167. {
  168. /* Gigabyte T1005M/P - defines wrong chassis type ("Other") */
  169. .matches = {
  170. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  171. DMI_MATCH(DMI_PRODUCT_NAME, "T1005M/P"),
  172. },
  173. },
  174. {
  175. .matches = {
  176. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  177. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
  178. DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
  179. },
  180. },
  181. { }
  182. };
  183. /*
  184. * Some Fujitsu notebooks are having trouble with touchpads if
  185. * active multiplexing mode is activated. Luckily they don't have
  186. * external PS/2 ports so we can safely disable it.
  187. * ... apparently some Toshibas don't like MUX mode either and
  188. * die horrible death on reboot.
  189. */
  190. static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
  191. {
  192. /* Fujitsu Lifebook P7010/P7010D */
  193. .matches = {
  194. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  195. DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
  196. },
  197. },
  198. {
  199. /* Fujitsu Lifebook P7010 */
  200. .matches = {
  201. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  202. DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
  203. },
  204. },
  205. {
  206. /* Fujitsu Lifebook P5020D */
  207. .matches = {
  208. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  209. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
  210. },
  211. },
  212. {
  213. /* Fujitsu Lifebook S2000 */
  214. .matches = {
  215. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  216. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
  217. },
  218. },
  219. {
  220. /* Fujitsu Lifebook S6230 */
  221. .matches = {
  222. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  223. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
  224. },
  225. },
  226. {
  227. /* Fujitsu T70H */
  228. .matches = {
  229. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  230. DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
  231. },
  232. },
  233. {
  234. /* Fujitsu-Siemens Lifebook T3010 */
  235. .matches = {
  236. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  237. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
  238. },
  239. },
  240. {
  241. /* Fujitsu-Siemens Lifebook E4010 */
  242. .matches = {
  243. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  244. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
  245. },
  246. },
  247. {
  248. /* Fujitsu-Siemens Amilo Pro 2010 */
  249. .matches = {
  250. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  251. DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
  252. },
  253. },
  254. {
  255. /* Fujitsu-Siemens Amilo Pro 2030 */
  256. .matches = {
  257. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  258. DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
  259. },
  260. },
  261. {
  262. /*
  263. * No data is coming from the touchscreen unless KBC
  264. * is in legacy mode.
  265. */
  266. /* Panasonic CF-29 */
  267. .matches = {
  268. DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
  269. DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
  270. },
  271. },
  272. {
  273. /*
  274. * HP Pavilion DV4017EA -
  275. * errors on MUX ports are reported without raising AUXDATA
  276. * causing "spurious NAK" messages.
  277. */
  278. .matches = {
  279. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  280. DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
  281. },
  282. },
  283. {
  284. /*
  285. * HP Pavilion ZT1000 -
  286. * like DV4017EA does not raise AUXERR for errors on MUX ports.
  287. */
  288. .matches = {
  289. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  290. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
  291. DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
  292. },
  293. },
  294. {
  295. /*
  296. * HP Pavilion DV4270ca -
  297. * like DV4017EA does not raise AUXERR for errors on MUX ports.
  298. */
  299. .matches = {
  300. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  301. DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
  302. },
  303. },
  304. {
  305. .matches = {
  306. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  307. DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
  308. },
  309. },
  310. {
  311. .matches = {
  312. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  313. DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
  314. },
  315. },
  316. {
  317. .matches = {
  318. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  319. DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"),
  320. },
  321. },
  322. {
  323. .matches = {
  324. DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
  325. DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
  326. },
  327. },
  328. {
  329. /* Sharp Actius MM20 */
  330. .matches = {
  331. DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
  332. DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
  333. },
  334. },
  335. {
  336. /* Sony Vaio FS-115b */
  337. .matches = {
  338. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  339. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
  340. },
  341. },
  342. {
  343. /*
  344. * Sony Vaio FZ-240E -
  345. * reset and GET ID commands issued via KBD port are
  346. * sometimes being delivered to AUX3.
  347. */
  348. .matches = {
  349. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  350. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
  351. },
  352. },
  353. {
  354. /*
  355. * Most (all?) VAIOs do not have external PS/2 ports nor
  356. * they implement active multiplexing properly, and
  357. * MUX discovery usually messes up keyboard/touchpad.
  358. */
  359. .matches = {
  360. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  361. DMI_MATCH(DMI_BOARD_NAME, "VAIO"),
  362. },
  363. },
  364. {
  365. /* Amoi M636/A737 */
  366. .matches = {
  367. DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
  368. DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
  369. },
  370. },
  371. {
  372. /* Lenovo 3000 n100 */
  373. .matches = {
  374. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  375. DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
  376. },
  377. },
  378. {
  379. .matches = {
  380. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  381. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
  382. },
  383. },
  384. {
  385. /* Gericom Bellagio */
  386. .matches = {
  387. DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
  388. DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
  389. },
  390. },
  391. {
  392. /* IBM 2656 */
  393. .matches = {
  394. DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
  395. DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
  396. },
  397. },
  398. {
  399. /* Dell XPS M1530 */
  400. .matches = {
  401. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  402. DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
  403. },
  404. },
  405. {
  406. /* Compal HEL80I */
  407. .matches = {
  408. DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
  409. DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
  410. },
  411. },
  412. {
  413. /* Dell Vostro 1510 */
  414. .matches = {
  415. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  416. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
  417. },
  418. },
  419. {
  420. /* Acer Aspire 5536 */
  421. .matches = {
  422. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  423. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
  424. DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
  425. },
  426. },
  427. {
  428. /* Dell Vostro V13 */
  429. .matches = {
  430. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  431. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
  432. },
  433. },
  434. {
  435. /* Newer HP Pavilion dv4 models */
  436. .matches = {
  437. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  438. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
  439. },
  440. },
  441. { }
  442. };
  443. static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
  444. {
  445. /* MSI Wind U-100 */
  446. .matches = {
  447. DMI_MATCH(DMI_BOARD_NAME, "U-100"),
  448. DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
  449. },
  450. },
  451. {
  452. /* LG Electronics X110 */
  453. .matches = {
  454. DMI_MATCH(DMI_BOARD_NAME, "X110"),
  455. DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
  456. },
  457. },
  458. {
  459. /* Acer Aspire One 150 */
  460. .matches = {
  461. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  462. DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
  463. },
  464. },
  465. {
  466. /* Advent 4211 */
  467. .matches = {
  468. DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
  469. DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
  470. },
  471. },
  472. {
  473. /* Medion Akoya Mini E1210 */
  474. .matches = {
  475. DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
  476. DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
  477. },
  478. },
  479. {
  480. /* Medion Akoya E1222 */
  481. .matches = {
  482. DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
  483. DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
  484. },
  485. },
  486. {
  487. /* Mivvy M310 */
  488. .matches = {
  489. DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
  490. DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
  491. },
  492. },
  493. {
  494. /* Dell Vostro 1320 */
  495. .matches = {
  496. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  497. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
  498. },
  499. },
  500. {
  501. /* Dell Vostro 1520 */
  502. .matches = {
  503. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  504. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
  505. },
  506. },
  507. {
  508. /* Dell Vostro 1720 */
  509. .matches = {
  510. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  511. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
  512. },
  513. },
  514. {
  515. /* Lenovo Ideapad U455 */
  516. .matches = {
  517. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  518. DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
  519. },
  520. },
  521. { }
  522. };
  523. #ifdef CONFIG_PNP
  524. static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
  525. {
  526. /* Intel MBO Desktop D845PESV */
  527. .matches = {
  528. DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
  529. DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
  530. },
  531. },
  532. {
  533. /* MSI Wind U-100 */
  534. .matches = {
  535. DMI_MATCH(DMI_BOARD_NAME, "U-100"),
  536. DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
  537. },
  538. },
  539. { }
  540. };
  541. static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
  542. {
  543. .matches = {
  544. DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
  545. },
  546. },
  547. {
  548. .matches = {
  549. DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
  550. },
  551. },
  552. {
  553. .matches = {
  554. DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
  555. },
  556. },
  557. {
  558. .matches = {
  559. DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
  560. },
  561. },
  562. { }
  563. };
  564. #endif
  565. static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
  566. {
  567. /* Dell Vostro V13 */
  568. .matches = {
  569. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  570. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
  571. },
  572. },
  573. {
  574. /* Newer HP Pavilion dv4 models */
  575. .matches = {
  576. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  577. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
  578. },
  579. },
  580. { }
  581. };
  582. /*
  583. * Some Wistron based laptops need us to explicitly enable the 'Dritek
  584. * keyboard extension' to make their extra keys start generating scancodes.
  585. * Originally, this was just confined to older laptops, but a few Acer laptops
  586. * have turned up in 2007 that also need this again.
  587. */
  588. static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
  589. {
  590. /* Acer Aspire 5100 */
  591. .matches = {
  592. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  593. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
  594. },
  595. },
  596. {
  597. /* Acer Aspire 5610 */
  598. .matches = {
  599. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  600. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
  601. },
  602. },
  603. {
  604. /* Acer Aspire 5630 */
  605. .matches = {
  606. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  607. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
  608. },
  609. },
  610. {
  611. /* Acer Aspire 5650 */
  612. .matches = {
  613. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  614. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
  615. },
  616. },
  617. {
  618. /* Acer Aspire 5680 */
  619. .matches = {
  620. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  621. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
  622. },
  623. },
  624. {
  625. /* Acer Aspire 5720 */
  626. .matches = {
  627. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  628. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
  629. },
  630. },
  631. {
  632. /* Acer Aspire 9110 */
  633. .matches = {
  634. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  635. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
  636. },
  637. },
  638. {
  639. /* Acer TravelMate 660 */
  640. .matches = {
  641. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  642. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
  643. },
  644. },
  645. {
  646. /* Acer TravelMate 2490 */
  647. .matches = {
  648. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  649. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
  650. },
  651. },
  652. {
  653. /* Acer TravelMate 4280 */
  654. .matches = {
  655. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  656. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
  657. },
  658. },
  659. { }
  660. };
  661. #endif /* CONFIG_X86 */
  662. #ifdef CONFIG_PNP
  663. #include <linux/pnp.h>
  664. static bool i8042_pnp_kbd_registered;
  665. static unsigned int i8042_pnp_kbd_devices;
  666. static bool i8042_pnp_aux_registered;
  667. static unsigned int i8042_pnp_aux_devices;
  668. static int i8042_pnp_command_reg;
  669. static int i8042_pnp_data_reg;
  670. static int i8042_pnp_kbd_irq;
  671. static int i8042_pnp_aux_irq;
  672. static char i8042_pnp_kbd_name[32];
  673. static char i8042_pnp_aux_name[32];
  674. static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
  675. {
  676. if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
  677. i8042_pnp_data_reg = pnp_port_start(dev,0);
  678. if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
  679. i8042_pnp_command_reg = pnp_port_start(dev, 1);
  680. if (pnp_irq_valid(dev,0))
  681. i8042_pnp_kbd_irq = pnp_irq(dev, 0);
  682. strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
  683. if (strlen(pnp_dev_name(dev))) {
  684. strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
  685. strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
  686. }
  687. /* Keyboard ports are always supposed to be wakeup-enabled */
  688. device_set_wakeup_enable(&dev->dev, true);
  689. i8042_pnp_kbd_devices++;
  690. return 0;
  691. }
  692. static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
  693. {
  694. if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
  695. i8042_pnp_data_reg = pnp_port_start(dev,0);
  696. if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
  697. i8042_pnp_command_reg = pnp_port_start(dev, 1);
  698. if (pnp_irq_valid(dev, 0))
  699. i8042_pnp_aux_irq = pnp_irq(dev, 0);
  700. strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
  701. if (strlen(pnp_dev_name(dev))) {
  702. strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
  703. strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
  704. }
  705. i8042_pnp_aux_devices++;
  706. return 0;
  707. }
  708. static struct pnp_device_id pnp_kbd_devids[] = {
  709. { .id = "PNP0300", .driver_data = 0 },
  710. { .id = "PNP0301", .driver_data = 0 },
  711. { .id = "PNP0302", .driver_data = 0 },
  712. { .id = "PNP0303", .driver_data = 0 },
  713. { .id = "PNP0304", .driver_data = 0 },
  714. { .id = "PNP0305", .driver_data = 0 },
  715. { .id = "PNP0306", .driver_data = 0 },
  716. { .id = "PNP0309", .driver_data = 0 },
  717. { .id = "PNP030a", .driver_data = 0 },
  718. { .id = "PNP030b", .driver_data = 0 },
  719. { .id = "PNP0320", .driver_data = 0 },
  720. { .id = "PNP0343", .driver_data = 0 },
  721. { .id = "PNP0344", .driver_data = 0 },
  722. { .id = "PNP0345", .driver_data = 0 },
  723. { .id = "CPQA0D7", .driver_data = 0 },
  724. { .id = "", },
  725. };
  726. static struct pnp_driver i8042_pnp_kbd_driver = {
  727. .name = "i8042 kbd",
  728. .id_table = pnp_kbd_devids,
  729. .probe = i8042_pnp_kbd_probe,
  730. };
  731. static struct pnp_device_id pnp_aux_devids[] = {
  732. { .id = "AUI0200", .driver_data = 0 },
  733. { .id = "FJC6000", .driver_data = 0 },
  734. { .id = "FJC6001", .driver_data = 0 },
  735. { .id = "PNP0f03", .driver_data = 0 },
  736. { .id = "PNP0f0b", .driver_data = 0 },
  737. { .id = "PNP0f0e", .driver_data = 0 },
  738. { .id = "PNP0f12", .driver_data = 0 },
  739. { .id = "PNP0f13", .driver_data = 0 },
  740. { .id = "PNP0f19", .driver_data = 0 },
  741. { .id = "PNP0f1c", .driver_data = 0 },
  742. { .id = "SYN0801", .driver_data = 0 },
  743. { .id = "", },
  744. };
  745. static struct pnp_driver i8042_pnp_aux_driver = {
  746. .name = "i8042 aux",
  747. .id_table = pnp_aux_devids,
  748. .probe = i8042_pnp_aux_probe,
  749. };
  750. static void i8042_pnp_exit(void)
  751. {
  752. if (i8042_pnp_kbd_registered) {
  753. i8042_pnp_kbd_registered = false;
  754. pnp_unregister_driver(&i8042_pnp_kbd_driver);
  755. }
  756. if (i8042_pnp_aux_registered) {
  757. i8042_pnp_aux_registered = false;
  758. pnp_unregister_driver(&i8042_pnp_aux_driver);
  759. }
  760. }
  761. static int __init i8042_pnp_init(void)
  762. {
  763. char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
  764. bool pnp_data_busted = false;
  765. int err;
  766. #ifdef CONFIG_X86
  767. if (dmi_check_system(i8042_dmi_nopnp_table))
  768. i8042_nopnp = true;
  769. #endif
  770. if (i8042_nopnp) {
  771. pr_info("PNP detection disabled\n");
  772. return 0;
  773. }
  774. err = pnp_register_driver(&i8042_pnp_kbd_driver);
  775. if (!err)
  776. i8042_pnp_kbd_registered = true;
  777. err = pnp_register_driver(&i8042_pnp_aux_driver);
  778. if (!err)
  779. i8042_pnp_aux_registered = true;
  780. if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
  781. i8042_pnp_exit();
  782. #if defined(__ia64__)
  783. return -ENODEV;
  784. #else
  785. pr_info("PNP: No PS/2 controller found. Probing ports directly.\n");
  786. return 0;
  787. #endif
  788. }
  789. if (i8042_pnp_kbd_devices)
  790. snprintf(kbd_irq_str, sizeof(kbd_irq_str),
  791. "%d", i8042_pnp_kbd_irq);
  792. if (i8042_pnp_aux_devices)
  793. snprintf(aux_irq_str, sizeof(aux_irq_str),
  794. "%d", i8042_pnp_aux_irq);
  795. pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
  796. i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
  797. i8042_pnp_aux_name,
  798. i8042_pnp_data_reg, i8042_pnp_command_reg,
  799. kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
  800. aux_irq_str);
  801. #if defined(__ia64__)
  802. if (!i8042_pnp_kbd_devices)
  803. i8042_nokbd = true;
  804. if (!i8042_pnp_aux_devices)
  805. i8042_noaux = true;
  806. #endif
  807. if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
  808. i8042_pnp_data_reg != i8042_data_reg) ||
  809. !i8042_pnp_data_reg) {
  810. pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
  811. i8042_pnp_data_reg, i8042_data_reg);
  812. i8042_pnp_data_reg = i8042_data_reg;
  813. pnp_data_busted = true;
  814. }
  815. if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
  816. i8042_pnp_command_reg != i8042_command_reg) ||
  817. !i8042_pnp_command_reg) {
  818. pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n",
  819. i8042_pnp_command_reg, i8042_command_reg);
  820. i8042_pnp_command_reg = i8042_command_reg;
  821. pnp_data_busted = true;
  822. }
  823. if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
  824. pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n",
  825. i8042_kbd_irq);
  826. i8042_pnp_kbd_irq = i8042_kbd_irq;
  827. pnp_data_busted = true;
  828. }
  829. if (!i8042_noaux && !i8042_pnp_aux_irq) {
  830. if (!pnp_data_busted && i8042_pnp_kbd_irq) {
  831. pr_warn("PNP: PS/2 appears to have AUX port disabled, "
  832. "if this is incorrect please boot with i8042.nopnp\n");
  833. i8042_noaux = true;
  834. } else {
  835. pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n",
  836. i8042_aux_irq);
  837. i8042_pnp_aux_irq = i8042_aux_irq;
  838. }
  839. }
  840. i8042_data_reg = i8042_pnp_data_reg;
  841. i8042_command_reg = i8042_pnp_command_reg;
  842. i8042_kbd_irq = i8042_pnp_kbd_irq;
  843. i8042_aux_irq = i8042_pnp_aux_irq;
  844. #ifdef CONFIG_X86
  845. i8042_bypass_aux_irq_test = !pnp_data_busted &&
  846. dmi_check_system(i8042_dmi_laptop_table);
  847. #endif
  848. return 0;
  849. }
  850. #else
  851. static inline int i8042_pnp_init(void) { return 0; }
  852. static inline void i8042_pnp_exit(void) { }
  853. #endif
  854. static int __init i8042_platform_init(void)
  855. {
  856. int retval;
  857. #ifdef CONFIG_X86
  858. u8 a20_on = 0xdf;
  859. /* Just return if pre-detection shows no i8042 controller exist */
  860. if (!x86_platform.i8042_detect())
  861. return -ENODEV;
  862. #endif
  863. /*
  864. * On ix86 platforms touching the i8042 data register region can do really
  865. * bad things. Because of this the region is always reserved on ix86 boxes.
  866. *
  867. * if (!request_region(I8042_DATA_REG, 16, "i8042"))
  868. * return -EBUSY;
  869. */
  870. i8042_kbd_irq = I8042_MAP_IRQ(1);
  871. i8042_aux_irq = I8042_MAP_IRQ(12);
  872. retval = i8042_pnp_init();
  873. if (retval)
  874. return retval;
  875. #if defined(__ia64__)
  876. i8042_reset = true;
  877. #endif
  878. #ifdef CONFIG_X86
  879. if (dmi_check_system(i8042_dmi_reset_table))
  880. i8042_reset = true;
  881. if (dmi_check_system(i8042_dmi_noloop_table))
  882. i8042_noloop = true;
  883. if (dmi_check_system(i8042_dmi_nomux_table))
  884. i8042_nomux = true;
  885. if (dmi_check_system(i8042_dmi_notimeout_table))
  886. i8042_notimeout = true;
  887. if (dmi_check_system(i8042_dmi_dritek_table))
  888. i8042_dritek = true;
  889. /*
  890. * A20 was already enabled during early kernel init. But some buggy
  891. * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
  892. * resume from S3. So we do it here and hope that nothing breaks.
  893. */
  894. i8042_command(&a20_on, 0x10d1);
  895. i8042_command(NULL, 0x00ff); /* Null command for SMM firmware */
  896. #endif /* CONFIG_X86 */
  897. return retval;
  898. }
  899. static inline void i8042_platform_exit(void)
  900. {
  901. i8042_pnp_exit();
  902. }
  903. #endif /* _I8042_X86IA64IO_H */