i8042-x86ia64io.h 24 KB

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