i8042-x86ia64io.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  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. /*
  9. * Names.
  10. */
  11. #define I8042_KBD_PHYS_DESC "isa0060/serio0"
  12. #define I8042_AUX_PHYS_DESC "isa0060/serio1"
  13. #define I8042_MUX_PHYS_DESC "isa0060/serio%d"
  14. /*
  15. * IRQs.
  16. */
  17. #if defined(__ia64__)
  18. # define I8042_MAP_IRQ(x) isa_irq_to_vector((x))
  19. #else
  20. # define I8042_MAP_IRQ(x) (x)
  21. #endif
  22. #define I8042_KBD_IRQ i8042_kbd_irq
  23. #define I8042_AUX_IRQ i8042_aux_irq
  24. static int i8042_kbd_irq;
  25. static int i8042_aux_irq;
  26. /*
  27. * Register numbers.
  28. */
  29. #define I8042_COMMAND_REG i8042_command_reg
  30. #define I8042_STATUS_REG i8042_command_reg
  31. #define I8042_DATA_REG i8042_data_reg
  32. static int i8042_command_reg = 0x64;
  33. static int i8042_data_reg = 0x60;
  34. static inline int i8042_read_data(void)
  35. {
  36. return inb(I8042_DATA_REG);
  37. }
  38. static inline int i8042_read_status(void)
  39. {
  40. return inb(I8042_STATUS_REG);
  41. }
  42. static inline void i8042_write_data(int val)
  43. {
  44. outb(val, I8042_DATA_REG);
  45. }
  46. static inline void i8042_write_command(int val)
  47. {
  48. outb(val, I8042_COMMAND_REG);
  49. }
  50. #ifdef CONFIG_X86
  51. #include <linux/dmi.h>
  52. static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
  53. {
  54. /* AUX LOOP command does not raise AUX IRQ */
  55. .ident = "Arima-Rioworks HDAMB",
  56. .matches = {
  57. DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
  58. DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
  59. DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
  60. },
  61. },
  62. {
  63. .ident = "ASUS G1S",
  64. .matches = {
  65. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
  66. DMI_MATCH(DMI_BOARD_NAME, "G1S"),
  67. DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
  68. },
  69. },
  70. {
  71. /* AUX LOOP command does not raise AUX IRQ */
  72. .ident = "ASUS P65UP5",
  73. .matches = {
  74. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  75. DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
  76. DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
  77. },
  78. },
  79. {
  80. .ident = "Compaq Proliant 8500",
  81. .matches = {
  82. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  83. DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
  84. DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
  85. },
  86. },
  87. {
  88. .ident = "Compaq Proliant DL760",
  89. .matches = {
  90. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  91. DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
  92. DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
  93. },
  94. },
  95. {
  96. .ident = "OQO Model 01",
  97. .matches = {
  98. DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
  99. DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
  100. DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
  101. },
  102. },
  103. {
  104. /* AUX LOOP does not work properly */
  105. .ident = "ULI EV4873",
  106. .matches = {
  107. DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
  108. DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
  109. DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
  110. },
  111. },
  112. {
  113. .ident = "Microsoft Virtual Machine",
  114. .matches = {
  115. DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
  116. DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
  117. DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
  118. },
  119. },
  120. {
  121. .ident = "Medion MAM 2070",
  122. .matches = {
  123. DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
  124. DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
  125. DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
  126. },
  127. },
  128. {
  129. .ident = "Blue FB5601",
  130. .matches = {
  131. DMI_MATCH(DMI_SYS_VENDOR, "blue"),
  132. DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
  133. DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
  134. },
  135. },
  136. {
  137. .ident = "Gigabyte M912",
  138. .matches = {
  139. DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
  140. DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
  141. DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
  142. },
  143. },
  144. {
  145. .ident = "HP DV9700",
  146. .matches = {
  147. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  148. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
  149. DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
  150. },
  151. },
  152. { }
  153. };
  154. /*
  155. * Some Fujitsu notebooks are having trouble with touchpads if
  156. * active multiplexing mode is activated. Luckily they don't have
  157. * external PS/2 ports so we can safely disable it.
  158. * ... apparently some Toshibas don't like MUX mode either and
  159. * die horrible death on reboot.
  160. */
  161. static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
  162. {
  163. .ident = "Fujitsu Lifebook P7010/P7010D",
  164. .matches = {
  165. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  166. DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
  167. },
  168. },
  169. {
  170. .ident = "Fujitsu Lifebook P7010",
  171. .matches = {
  172. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  173. DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
  174. },
  175. },
  176. {
  177. .ident = "Fujitsu Lifebook P5020D",
  178. .matches = {
  179. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  180. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
  181. },
  182. },
  183. {
  184. .ident = "Fujitsu Lifebook S2000",
  185. .matches = {
  186. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  187. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
  188. },
  189. },
  190. {
  191. .ident = "Fujitsu Lifebook S6230",
  192. .matches = {
  193. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  194. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
  195. },
  196. },
  197. {
  198. .ident = "Fujitsu T70H",
  199. .matches = {
  200. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  201. DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
  202. },
  203. },
  204. {
  205. .ident = "Fujitsu-Siemens Lifebook T3010",
  206. .matches = {
  207. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  208. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
  209. },
  210. },
  211. {
  212. .ident = "Fujitsu-Siemens Lifebook E4010",
  213. .matches = {
  214. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  215. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
  216. },
  217. },
  218. {
  219. .ident = "Fujitsu-Siemens Amilo Pro 2010",
  220. .matches = {
  221. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  222. DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
  223. },
  224. },
  225. {
  226. .ident = "Fujitsu-Siemens Amilo Pro 2030",
  227. .matches = {
  228. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  229. DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
  230. },
  231. },
  232. {
  233. /*
  234. * No data is coming from the touchscreen unless KBC
  235. * is in legacy mode.
  236. */
  237. .ident = "Panasonic CF-29",
  238. .matches = {
  239. DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
  240. DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
  241. },
  242. },
  243. {
  244. /*
  245. * Errors on MUX ports are reported without raising AUXDATA
  246. * causing "spurious NAK" messages.
  247. */
  248. .ident = "HP Pavilion DV4017EA",
  249. .matches = {
  250. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  251. DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
  252. },
  253. },
  254. {
  255. /*
  256. * Like DV4017EA does not raise AUXERR for errors on MUX ports.
  257. */
  258. .ident = "HP Pavilion ZT1000",
  259. .matches = {
  260. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  261. DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
  262. DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
  263. },
  264. },
  265. {
  266. /*
  267. * Like DV4017EA does not raise AUXERR for errors on MUX ports.
  268. */
  269. .ident = "HP Pavilion DV4270ca",
  270. .matches = {
  271. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  272. DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
  273. },
  274. },
  275. {
  276. .ident = "Toshiba P10",
  277. .matches = {
  278. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  279. DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
  280. },
  281. },
  282. {
  283. .ident = "Toshiba Equium A110",
  284. .matches = {
  285. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  286. DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
  287. },
  288. },
  289. {
  290. .ident = "Alienware Sentia",
  291. .matches = {
  292. DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
  293. DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
  294. },
  295. },
  296. {
  297. .ident = "Sharp Actius MM20",
  298. .matches = {
  299. DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
  300. DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
  301. },
  302. },
  303. {
  304. .ident = "Sony Vaio FS-115b",
  305. .matches = {
  306. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  307. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
  308. },
  309. },
  310. {
  311. .ident = "Amoi M636/A737",
  312. .matches = {
  313. DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
  314. DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
  315. },
  316. },
  317. {
  318. .ident = "Lenovo 3000 n100",
  319. .matches = {
  320. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  321. DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
  322. },
  323. },
  324. {
  325. .ident = "Acer Aspire 1360",
  326. .matches = {
  327. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  328. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
  329. },
  330. },
  331. {
  332. .ident = "Gericom Bellagio",
  333. .matches = {
  334. DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
  335. DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
  336. },
  337. },
  338. {
  339. .ident = "IBM 2656",
  340. .matches = {
  341. DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
  342. DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
  343. },
  344. },
  345. {
  346. .ident = "Dell XPS M1530",
  347. .matches = {
  348. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  349. DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
  350. },
  351. },
  352. {
  353. .ident = "Compal HEL80I",
  354. .matches = {
  355. DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
  356. DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
  357. },
  358. },
  359. {
  360. .ident = "Dell Vostro 1510",
  361. .matches = {
  362. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  363. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
  364. },
  365. },
  366. {
  367. .ident = "Acer Aspire 5536",
  368. .matches = {
  369. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  370. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
  371. DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
  372. },
  373. },
  374. { }
  375. };
  376. static struct dmi_system_id __initdata i8042_dmi_reset_table[] = {
  377. {
  378. .ident = "MSI Wind U-100",
  379. .matches = {
  380. DMI_MATCH(DMI_BOARD_NAME, "U-100"),
  381. DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
  382. },
  383. },
  384. {
  385. .ident = "LG Electronics X110",
  386. .matches = {
  387. DMI_MATCH(DMI_BOARD_NAME, "X110"),
  388. DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
  389. },
  390. },
  391. {
  392. .ident = "Acer Aspire One 150",
  393. .matches = {
  394. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  395. DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
  396. },
  397. },
  398. {
  399. .ident = "Advent 4211",
  400. .matches = {
  401. DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
  402. DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
  403. },
  404. },
  405. {
  406. .ident = "Medion Akoya Mini E1210",
  407. .matches = {
  408. DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
  409. DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
  410. },
  411. },
  412. {
  413. .ident = "Mivvy M310",
  414. .matches = {
  415. DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
  416. DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
  417. },
  418. },
  419. { }
  420. };
  421. #ifdef CONFIG_PNP
  422. static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
  423. {
  424. .ident = "Intel MBO Desktop D845PESV",
  425. .matches = {
  426. DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
  427. DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
  428. },
  429. },
  430. {
  431. .ident = "MSI Wind U-100",
  432. .matches = {
  433. DMI_MATCH(DMI_BOARD_NAME, "U-100"),
  434. DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
  435. },
  436. },
  437. { }
  438. };
  439. static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
  440. {
  441. .ident = "Portable",
  442. .matches = {
  443. DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
  444. },
  445. },
  446. {
  447. .ident = "Laptop",
  448. .matches = {
  449. DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
  450. },
  451. },
  452. {
  453. .ident = "Notebook",
  454. .matches = {
  455. DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
  456. },
  457. },
  458. {
  459. .ident = "Sub-Notebook",
  460. .matches = {
  461. DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
  462. },
  463. },
  464. { }
  465. };
  466. #endif
  467. /*
  468. * Some Wistron based laptops need us to explicitly enable the 'Dritek
  469. * keyboard extension' to make their extra keys start generating scancodes.
  470. * Originally, this was just confined to older laptops, but a few Acer laptops
  471. * have turned up in 2007 that also need this again.
  472. */
  473. static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
  474. {
  475. .ident = "Acer Aspire 5630",
  476. .matches = {
  477. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  478. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
  479. },
  480. },
  481. {
  482. .ident = "Acer Aspire 5650",
  483. .matches = {
  484. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  485. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
  486. },
  487. },
  488. {
  489. .ident = "Acer Aspire 5680",
  490. .matches = {
  491. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  492. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
  493. },
  494. },
  495. {
  496. .ident = "Acer Aspire 5720",
  497. .matches = {
  498. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  499. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
  500. },
  501. },
  502. {
  503. .ident = "Acer Aspire 9110",
  504. .matches = {
  505. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  506. DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
  507. },
  508. },
  509. {
  510. .ident = "Acer TravelMate 660",
  511. .matches = {
  512. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  513. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
  514. },
  515. },
  516. {
  517. .ident = "Acer TravelMate 2490",
  518. .matches = {
  519. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  520. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
  521. },
  522. },
  523. {
  524. .ident = "Acer TravelMate 4280",
  525. .matches = {
  526. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  527. DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
  528. },
  529. },
  530. { }
  531. };
  532. #endif /* CONFIG_X86 */
  533. #ifdef CONFIG_PNP
  534. #include <linux/pnp.h>
  535. static bool i8042_pnp_kbd_registered;
  536. static unsigned int i8042_pnp_kbd_devices;
  537. static bool i8042_pnp_aux_registered;
  538. static unsigned int i8042_pnp_aux_devices;
  539. static int i8042_pnp_command_reg;
  540. static int i8042_pnp_data_reg;
  541. static int i8042_pnp_kbd_irq;
  542. static int i8042_pnp_aux_irq;
  543. static char i8042_pnp_kbd_name[32];
  544. static char i8042_pnp_aux_name[32];
  545. static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
  546. {
  547. if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
  548. i8042_pnp_data_reg = pnp_port_start(dev,0);
  549. if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
  550. i8042_pnp_command_reg = pnp_port_start(dev, 1);
  551. if (pnp_irq_valid(dev,0))
  552. i8042_pnp_kbd_irq = pnp_irq(dev, 0);
  553. strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
  554. if (strlen(pnp_dev_name(dev))) {
  555. strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
  556. strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
  557. }
  558. i8042_pnp_kbd_devices++;
  559. return 0;
  560. }
  561. static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
  562. {
  563. if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
  564. i8042_pnp_data_reg = pnp_port_start(dev,0);
  565. if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
  566. i8042_pnp_command_reg = pnp_port_start(dev, 1);
  567. if (pnp_irq_valid(dev, 0))
  568. i8042_pnp_aux_irq = pnp_irq(dev, 0);
  569. strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
  570. if (strlen(pnp_dev_name(dev))) {
  571. strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
  572. strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
  573. }
  574. i8042_pnp_aux_devices++;
  575. return 0;
  576. }
  577. static struct pnp_device_id pnp_kbd_devids[] = {
  578. { .id = "PNP0303", .driver_data = 0 },
  579. { .id = "PNP030b", .driver_data = 0 },
  580. { .id = "", },
  581. };
  582. static struct pnp_driver i8042_pnp_kbd_driver = {
  583. .name = "i8042 kbd",
  584. .id_table = pnp_kbd_devids,
  585. .probe = i8042_pnp_kbd_probe,
  586. };
  587. static struct pnp_device_id pnp_aux_devids[] = {
  588. { .id = "FJC6000", .driver_data = 0 },
  589. { .id = "FJC6001", .driver_data = 0 },
  590. { .id = "PNP0f03", .driver_data = 0 },
  591. { .id = "PNP0f0b", .driver_data = 0 },
  592. { .id = "PNP0f0e", .driver_data = 0 },
  593. { .id = "PNP0f12", .driver_data = 0 },
  594. { .id = "PNP0f13", .driver_data = 0 },
  595. { .id = "PNP0f19", .driver_data = 0 },
  596. { .id = "PNP0f1c", .driver_data = 0 },
  597. { .id = "SYN0801", .driver_data = 0 },
  598. { .id = "", },
  599. };
  600. static struct pnp_driver i8042_pnp_aux_driver = {
  601. .name = "i8042 aux",
  602. .id_table = pnp_aux_devids,
  603. .probe = i8042_pnp_aux_probe,
  604. };
  605. static void i8042_pnp_exit(void)
  606. {
  607. if (i8042_pnp_kbd_registered) {
  608. i8042_pnp_kbd_registered = false;
  609. pnp_unregister_driver(&i8042_pnp_kbd_driver);
  610. }
  611. if (i8042_pnp_aux_registered) {
  612. i8042_pnp_aux_registered = false;
  613. pnp_unregister_driver(&i8042_pnp_aux_driver);
  614. }
  615. }
  616. static int __init i8042_pnp_init(void)
  617. {
  618. char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
  619. int pnp_data_busted = false;
  620. int err;
  621. #ifdef CONFIG_X86
  622. if (dmi_check_system(i8042_dmi_nopnp_table))
  623. i8042_nopnp = true;
  624. #endif
  625. if (i8042_nopnp) {
  626. printk(KERN_INFO "i8042: PNP detection disabled\n");
  627. return 0;
  628. }
  629. err = pnp_register_driver(&i8042_pnp_kbd_driver);
  630. if (!err)
  631. i8042_pnp_kbd_registered = true;
  632. err = pnp_register_driver(&i8042_pnp_aux_driver);
  633. if (!err)
  634. i8042_pnp_aux_registered = true;
  635. if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
  636. i8042_pnp_exit();
  637. #if defined(__ia64__)
  638. return -ENODEV;
  639. #else
  640. printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
  641. return 0;
  642. #endif
  643. }
  644. if (i8042_pnp_kbd_devices)
  645. snprintf(kbd_irq_str, sizeof(kbd_irq_str),
  646. "%d", i8042_pnp_kbd_irq);
  647. if (i8042_pnp_aux_devices)
  648. snprintf(aux_irq_str, sizeof(aux_irq_str),
  649. "%d", i8042_pnp_aux_irq);
  650. printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
  651. i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
  652. i8042_pnp_aux_name,
  653. i8042_pnp_data_reg, i8042_pnp_command_reg,
  654. kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
  655. aux_irq_str);
  656. #if defined(__ia64__)
  657. if (!i8042_pnp_kbd_devices)
  658. i8042_nokbd = true;
  659. if (!i8042_pnp_aux_devices)
  660. i8042_noaux = true;
  661. #endif
  662. if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
  663. i8042_pnp_data_reg != i8042_data_reg) ||
  664. !i8042_pnp_data_reg) {
  665. printk(KERN_WARNING
  666. "PNP: PS/2 controller has invalid data port %#x; "
  667. "using default %#x\n",
  668. i8042_pnp_data_reg, i8042_data_reg);
  669. i8042_pnp_data_reg = i8042_data_reg;
  670. pnp_data_busted = true;
  671. }
  672. if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
  673. i8042_pnp_command_reg != i8042_command_reg) ||
  674. !i8042_pnp_command_reg) {
  675. printk(KERN_WARNING
  676. "PNP: PS/2 controller has invalid command port %#x; "
  677. "using default %#x\n",
  678. i8042_pnp_command_reg, i8042_command_reg);
  679. i8042_pnp_command_reg = i8042_command_reg;
  680. pnp_data_busted = true;
  681. }
  682. if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
  683. printk(KERN_WARNING
  684. "PNP: PS/2 controller doesn't have KBD irq; "
  685. "using default %d\n", i8042_kbd_irq);
  686. i8042_pnp_kbd_irq = i8042_kbd_irq;
  687. pnp_data_busted = true;
  688. }
  689. if (!i8042_noaux && !i8042_pnp_aux_irq) {
  690. if (!pnp_data_busted && i8042_pnp_kbd_irq) {
  691. printk(KERN_WARNING
  692. "PNP: PS/2 appears to have AUX port disabled, "
  693. "if this is incorrect please boot with "
  694. "i8042.nopnp\n");
  695. i8042_noaux = true;
  696. } else {
  697. printk(KERN_WARNING
  698. "PNP: PS/2 controller doesn't have AUX irq; "
  699. "using default %d\n", i8042_aux_irq);
  700. i8042_pnp_aux_irq = i8042_aux_irq;
  701. }
  702. }
  703. i8042_data_reg = i8042_pnp_data_reg;
  704. i8042_command_reg = i8042_pnp_command_reg;
  705. i8042_kbd_irq = i8042_pnp_kbd_irq;
  706. i8042_aux_irq = i8042_pnp_aux_irq;
  707. #ifdef CONFIG_X86
  708. i8042_bypass_aux_irq_test = !pnp_data_busted &&
  709. dmi_check_system(i8042_dmi_laptop_table);
  710. #endif
  711. return 0;
  712. }
  713. #else
  714. static inline int i8042_pnp_init(void) { return 0; }
  715. static inline void i8042_pnp_exit(void) { }
  716. #endif
  717. static int __init i8042_platform_init(void)
  718. {
  719. int retval;
  720. /*
  721. * On ix86 platforms touching the i8042 data register region can do really
  722. * bad things. Because of this the region is always reserved on ix86 boxes.
  723. *
  724. * if (!request_region(I8042_DATA_REG, 16, "i8042"))
  725. * return -EBUSY;
  726. */
  727. i8042_kbd_irq = I8042_MAP_IRQ(1);
  728. i8042_aux_irq = I8042_MAP_IRQ(12);
  729. retval = i8042_pnp_init();
  730. if (retval)
  731. return retval;
  732. #if defined(__ia64__)
  733. i8042_reset = true;
  734. #endif
  735. #ifdef CONFIG_X86
  736. if (dmi_check_system(i8042_dmi_reset_table))
  737. i8042_reset = true;
  738. if (dmi_check_system(i8042_dmi_noloop_table))
  739. i8042_noloop = true;
  740. if (dmi_check_system(i8042_dmi_nomux_table))
  741. i8042_nomux = true;
  742. if (dmi_check_system(i8042_dmi_dritek_table))
  743. i8042_dritek = true;
  744. #endif /* CONFIG_X86 */
  745. return retval;
  746. }
  747. static inline void i8042_platform_exit(void)
  748. {
  749. i8042_pnp_exit();
  750. }
  751. #endif /* _I8042_X86IA64IO_H */