Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _I8042_X86IA64IO_H |
| 2 | #define _I8042_X86IA64IO_H |
| 3 | |
| 4 | /* |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 as published by |
| 7 | * the Free Software Foundation. |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * Names. |
| 12 | */ |
| 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 | /* |
| 19 | * IRQs. |
| 20 | */ |
| 21 | |
| 22 | #if defined(__ia64__) |
| 23 | # define I8042_MAP_IRQ(x) isa_irq_to_vector((x)) |
| 24 | #else |
| 25 | # define I8042_MAP_IRQ(x) (x) |
| 26 | #endif |
| 27 | |
| 28 | #define I8042_KBD_IRQ i8042_kbd_irq |
| 29 | #define I8042_AUX_IRQ i8042_aux_irq |
| 30 | |
| 31 | static int i8042_kbd_irq; |
| 32 | static int i8042_aux_irq; |
| 33 | |
| 34 | /* |
| 35 | * Register numbers. |
| 36 | */ |
| 37 | |
| 38 | #define I8042_COMMAND_REG i8042_command_reg |
| 39 | #define I8042_STATUS_REG i8042_command_reg |
| 40 | #define I8042_DATA_REG i8042_data_reg |
| 41 | |
| 42 | static int i8042_command_reg = 0x64; |
| 43 | static int i8042_data_reg = 0x60; |
| 44 | |
| 45 | |
| 46 | static inline int i8042_read_data(void) |
| 47 | { |
| 48 | return inb(I8042_DATA_REG); |
| 49 | } |
| 50 | |
| 51 | static inline int i8042_read_status(void) |
| 52 | { |
| 53 | return inb(I8042_STATUS_REG); |
| 54 | } |
| 55 | |
| 56 | static inline void i8042_write_data(int val) |
| 57 | { |
| 58 | outb(val, I8042_DATA_REG); |
| 59 | } |
| 60 | |
| 61 | static inline void i8042_write_command(int val) |
| 62 | { |
| 63 | outb(val, I8042_COMMAND_REG); |
| 64 | } |
| 65 | |
Bruce Duncan | b4d62de | 2008-01-30 16:34:34 -0500 | [diff] [blame] | 66 | #if defined(__i386__) || defined(__x86_64__) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | #include <linux/dmi.h> |
| 69 | |
| 70 | static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { |
| 71 | { |
Dmitry Torokhov | 90245c1 | 2007-06-12 00:33:27 -0400 | [diff] [blame] | 72 | /* AUX LOOP command does not raise AUX IRQ */ |
| 73 | .ident = "ASUS P65UP5", |
| 74 | .matches = { |
| 75 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), |
| 76 | DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"), |
| 77 | DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"), |
| 78 | }, |
| 79 | }, |
| 80 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | .ident = "Compaq Proliant 8500", |
| 82 | .matches = { |
| 83 | DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), |
| 84 | DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), |
| 85 | DMI_MATCH(DMI_PRODUCT_VERSION, "8500"), |
| 86 | }, |
| 87 | }, |
| 88 | { |
| 89 | .ident = "Compaq Proliant DL760", |
| 90 | .matches = { |
| 91 | DMI_MATCH(DMI_SYS_VENDOR, "Compaq"), |
| 92 | DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"), |
| 93 | DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"), |
| 94 | }, |
| 95 | }, |
Ben Collins | 6020baf | 2006-01-05 23:00:38 -0500 | [diff] [blame] | 96 | { |
| 97 | .ident = "OQO Model 01", |
| 98 | .matches = { |
| 99 | DMI_MATCH(DMI_SYS_VENDOR, "OQO"), |
| 100 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"), |
| 101 | DMI_MATCH(DMI_PRODUCT_VERSION, "00"), |
| 102 | }, |
| 103 | }, |
Dmitry Torokhov | 8c4df74 | 2007-06-12 00:33:32 -0400 | [diff] [blame] | 104 | { |
| 105 | /* AUX LOOP does not work properly */ |
| 106 | .ident = "ULI EV4873", |
| 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 | }, |
Jiri Kosina | 8bf4215 | 2007-11-21 14:17:38 -0500 | [diff] [blame] | 113 | { |
| 114 | .ident = "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 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | { } |
| 122 | }; |
| 123 | |
| 124 | /* |
Dmitry Torokhov | 59311de | 2005-05-28 02:12:05 -0500 | [diff] [blame] | 125 | * Some Fujitsu notebooks are having trouble with touchpads if |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | * active multiplexing mode is activated. Luckily they don't have |
| 127 | * external PS/2 ports so we can safely disable it. |
Dmitry Torokhov | 59311de | 2005-05-28 02:12:05 -0500 | [diff] [blame] | 128 | * ... apparently some Toshibas don't like MUX mode either and |
| 129 | * die horrible death on reboot. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | */ |
| 131 | static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { |
| 132 | { |
| 133 | .ident = "Fujitsu Lifebook P7010/P7010D", |
| 134 | .matches = { |
| 135 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
| 136 | DMI_MATCH(DMI_PRODUCT_NAME, "P7010"), |
| 137 | }, |
| 138 | }, |
| 139 | { |
Dmitry Torokhov | bb06ec3c | 2006-12-08 01:36:32 -0500 | [diff] [blame] | 140 | .ident = "Fujitsu Lifebook P7010", |
| 141 | .matches = { |
| 142 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 143 | DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"), |
| 144 | }, |
| 145 | }, |
| 146 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | .ident = "Fujitsu Lifebook P5020D", |
| 148 | .matches = { |
| 149 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
| 150 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"), |
| 151 | }, |
| 152 | }, |
| 153 | { |
| 154 | .ident = "Fujitsu Lifebook S2000", |
| 155 | .matches = { |
| 156 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
| 157 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"), |
| 158 | }, |
| 159 | }, |
| 160 | { |
Dmitry Torokhov | b4ff99b | 2005-05-28 02:12:10 -0500 | [diff] [blame] | 161 | .ident = "Fujitsu Lifebook S6230", |
| 162 | .matches = { |
| 163 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
| 164 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"), |
| 165 | }, |
| 166 | }, |
| 167 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | .ident = "Fujitsu T70H", |
| 169 | .matches = { |
| 170 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
| 171 | DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"), |
| 172 | }, |
| 173 | }, |
Dmitry Torokhov | 59311de | 2005-05-28 02:12:05 -0500 | [diff] [blame] | 174 | { |
Vojtech Pavlik | 20f0794 | 2005-07-11 01:06:28 -0500 | [diff] [blame] | 175 | .ident = "Fujitsu-Siemens Lifebook T3010", |
| 176 | .matches = { |
| 177 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 178 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"), |
| 179 | }, |
| 180 | }, |
| 181 | { |
Dmitry Torokhov | 7545c24 | 2005-09-04 01:42:10 -0500 | [diff] [blame] | 182 | .ident = "Fujitsu-Siemens Lifebook E4010", |
| 183 | .matches = { |
| 184 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 185 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"), |
| 186 | }, |
| 187 | }, |
| 188 | { |
Jiri Kosina | 3f79b1e | 2008-01-30 16:34:52 -0500 | [diff] [blame^] | 189 | .ident = "Fujitsu-Siemens Amilo Pro 2010", |
| 190 | .matches = { |
| 191 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 192 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"), |
| 193 | }, |
| 194 | }, |
| 195 | { |
Dmitry Torokhov | 6e78258 | 2007-03-16 00:59:42 -0400 | [diff] [blame] | 196 | /* |
Dmitry Torokhov | cc8310e | 2007-04-25 00:40:32 -0400 | [diff] [blame] | 197 | * No data is coming from the touchscreen unless KBC |
| 198 | * is in legacy mode. |
| 199 | */ |
| 200 | .ident = "Panasonic CF-29", |
| 201 | .matches = { |
| 202 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), |
| 203 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), |
| 204 | }, |
| 205 | }, |
| 206 | { |
| 207 | /* |
Dmitry Torokhov | 6e78258 | 2007-03-16 00:59:42 -0400 | [diff] [blame] | 208 | * Errors on MUX ports are reported without raising AUXDATA |
| 209 | * causing "spurious NAK" messages. |
| 210 | */ |
| 211 | .ident = "HP Pavilion DV4017EA", |
| 212 | .matches = { |
| 213 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
| 214 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"), |
| 215 | }, |
| 216 | }, |
| 217 | { |
Dmitry Torokhov | 9d9d50b | 2007-06-28 00:44:27 -0400 | [diff] [blame] | 218 | /* |
| 219 | * Like DV4017EA does not raise AUXERR for errors on MUX ports. |
| 220 | */ |
| 221 | .ident = "HP Pavilion ZT1000", |
| 222 | .matches = { |
| 223 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
| 224 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"), |
| 225 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"), |
| 226 | }, |
| 227 | }, |
| 228 | { |
Elvis Pranskevichus | 749aea7 | 2007-09-04 23:18:21 -0400 | [diff] [blame] | 229 | /* |
| 230 | * Like DV4017EA does not raise AUXERR for errors on MUX ports. |
| 231 | */ |
| 232 | .ident = "HP Pavilion DV4270ca", |
| 233 | .matches = { |
| 234 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
| 235 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"), |
| 236 | }, |
| 237 | }, |
| 238 | { |
Dmitry Torokhov | 59311de | 2005-05-28 02:12:05 -0500 | [diff] [blame] | 239 | .ident = "Toshiba P10", |
| 240 | .matches = { |
| 241 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
| 242 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), |
| 243 | }, |
| 244 | }, |
Dmitry Torokhov | 865190c | 2005-07-11 01:06:06 -0500 | [diff] [blame] | 245 | { |
Dmitry Torokhov | a91eaa1 | 2006-09-14 01:31:06 -0400 | [diff] [blame] | 246 | .ident = "Toshiba Equium A110", |
| 247 | .matches = { |
| 248 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
| 249 | DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"), |
| 250 | }, |
| 251 | }, |
| 252 | { |
Dmitry Torokhov | 865190c | 2005-07-11 01:06:06 -0500 | [diff] [blame] | 253 | .ident = "Alienware Sentia", |
| 254 | .matches = { |
| 255 | DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), |
| 256 | DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), |
| 257 | }, |
| 258 | }, |
Dmitry Torokhov | 4eb38ac | 2005-12-21 00:51:51 -0500 | [diff] [blame] | 259 | { |
| 260 | .ident = "Sharp Actius MM20", |
| 261 | .matches = { |
| 262 | DMI_MATCH(DMI_SYS_VENDOR, "SHARP"), |
| 263 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"), |
| 264 | }, |
| 265 | }, |
Vojtech Pavlik | 3dd01a8 | 2006-01-14 00:24:06 -0500 | [diff] [blame] | 266 | { |
| 267 | .ident = "Sony Vaio FS-115b", |
| 268 | .matches = { |
| 269 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
| 270 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"), |
| 271 | }, |
| 272 | }, |
Cjacker Huang | e2df452 | 2006-08-08 23:38:22 -0400 | [diff] [blame] | 273 | { |
| 274 | .ident = "Amoi M636/A737", |
| 275 | .matches = { |
| 276 | DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."), |
| 277 | DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"), |
| 278 | }, |
| 279 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | { } |
| 281 | }; |
| 282 | |
| 283 | |
| 284 | |
| 285 | #endif |
| 286 | |
Carlos Corbacho | 8987fec | 2008-01-21 01:04:40 -0500 | [diff] [blame] | 287 | #ifdef CONFIG_X86 |
| 288 | |
| 289 | #include <linux/dmi.h> |
| 290 | |
| 291 | /* |
| 292 | * Some Wistron based laptops need us to explicitly enable the 'Dritek |
| 293 | * keyboard extension' to make their extra keys start generating scancodes. |
| 294 | * Originally, this was just confined to older laptops, but a few Acer laptops |
| 295 | * have turned up in 2007 that also need this again. |
| 296 | */ |
| 297 | static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { |
| 298 | { |
| 299 | .ident = "Acer Aspire 5630", |
| 300 | .matches = { |
| 301 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 302 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"), |
| 303 | }, |
| 304 | }, |
| 305 | { |
| 306 | .ident = "Acer Aspire 5650", |
| 307 | .matches = { |
| 308 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 309 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"), |
| 310 | }, |
| 311 | }, |
| 312 | { |
| 313 | .ident = "Acer Aspire 5680", |
| 314 | .matches = { |
| 315 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 316 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"), |
| 317 | }, |
| 318 | }, |
| 319 | { |
Carlos Corbacho | 5799ddb | 2008-01-30 16:34:12 -0500 | [diff] [blame] | 320 | .ident = "Acer Aspire 9110", |
| 321 | .matches = { |
| 322 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 323 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"), |
| 324 | }, |
| 325 | }, |
| 326 | { |
Carlos Corbacho | 8987fec | 2008-01-21 01:04:40 -0500 | [diff] [blame] | 327 | .ident = "Acer TravelMate 2490", |
| 328 | .matches = { |
| 329 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| 330 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"), |
| 331 | }, |
| 332 | }, |
| 333 | { } |
| 334 | }; |
| 335 | |
| 336 | #endif /* CONFIG_X86 */ |
| 337 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | |
| 339 | #ifdef CONFIG_PNP |
| 340 | #include <linux/pnp.h> |
| 341 | |
| 342 | static int i8042_pnp_kbd_registered; |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 343 | static unsigned int i8042_pnp_kbd_devices; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | static int i8042_pnp_aux_registered; |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 345 | static unsigned int i8042_pnp_aux_devices; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | |
| 347 | static int i8042_pnp_command_reg; |
| 348 | static int i8042_pnp_data_reg; |
| 349 | static int i8042_pnp_kbd_irq; |
| 350 | static int i8042_pnp_aux_irq; |
| 351 | |
| 352 | static char i8042_pnp_kbd_name[32]; |
| 353 | static char i8042_pnp_aux_name[32]; |
| 354 | |
| 355 | static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did) |
| 356 | { |
| 357 | if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1) |
| 358 | i8042_pnp_data_reg = pnp_port_start(dev,0); |
| 359 | |
| 360 | if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1) |
| 361 | i8042_pnp_command_reg = pnp_port_start(dev, 1); |
| 362 | |
| 363 | if (pnp_irq_valid(dev,0)) |
| 364 | i8042_pnp_kbd_irq = pnp_irq(dev, 0); |
| 365 | |
| 366 | strncpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name)); |
| 367 | if (strlen(pnp_dev_name(dev))) { |
| 368 | strncat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name)); |
| 369 | strncat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name)); |
| 370 | } |
| 371 | |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 372 | i8042_pnp_kbd_devices++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | return 0; |
| 374 | } |
| 375 | |
| 376 | static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did) |
| 377 | { |
| 378 | if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1) |
| 379 | i8042_pnp_data_reg = pnp_port_start(dev,0); |
| 380 | |
| 381 | if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1) |
| 382 | i8042_pnp_command_reg = pnp_port_start(dev, 1); |
| 383 | |
| 384 | if (pnp_irq_valid(dev, 0)) |
| 385 | i8042_pnp_aux_irq = pnp_irq(dev, 0); |
| 386 | |
| 387 | strncpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name)); |
| 388 | if (strlen(pnp_dev_name(dev))) { |
| 389 | strncat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name)); |
| 390 | strncat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name)); |
| 391 | } |
| 392 | |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 393 | i8042_pnp_aux_devices++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | return 0; |
| 395 | } |
| 396 | |
| 397 | static struct pnp_device_id pnp_kbd_devids[] = { |
| 398 | { .id = "PNP0303", .driver_data = 0 }, |
| 399 | { .id = "PNP030b", .driver_data = 0 }, |
| 400 | { .id = "", }, |
| 401 | }; |
| 402 | |
| 403 | static struct pnp_driver i8042_pnp_kbd_driver = { |
| 404 | .name = "i8042 kbd", |
| 405 | .id_table = pnp_kbd_devids, |
| 406 | .probe = i8042_pnp_kbd_probe, |
| 407 | }; |
| 408 | |
| 409 | static struct pnp_device_id pnp_aux_devids[] = { |
Dmitry Torokhov | b997395 | 2007-04-25 00:40:53 -0400 | [diff] [blame] | 410 | { .id = "FJC6000", .driver_data = 0 }, |
| 411 | { .id = "FJC6001", .driver_data = 0 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | { .id = "PNP0f03", .driver_data = 0 }, |
| 413 | { .id = "PNP0f0b", .driver_data = 0 }, |
| 414 | { .id = "PNP0f0e", .driver_data = 0 }, |
| 415 | { .id = "PNP0f12", .driver_data = 0 }, |
| 416 | { .id = "PNP0f13", .driver_data = 0 }, |
| 417 | { .id = "PNP0f19", .driver_data = 0 }, |
| 418 | { .id = "PNP0f1c", .driver_data = 0 }, |
| 419 | { .id = "SYN0801", .driver_data = 0 }, |
| 420 | { .id = "", }, |
| 421 | }; |
| 422 | |
| 423 | static struct pnp_driver i8042_pnp_aux_driver = { |
| 424 | .name = "i8042 aux", |
| 425 | .id_table = pnp_aux_devids, |
| 426 | .probe = i8042_pnp_aux_probe, |
| 427 | }; |
| 428 | |
| 429 | static void i8042_pnp_exit(void) |
| 430 | { |
Kurt Garloff | 74af42b | 2005-05-28 02:11:38 -0500 | [diff] [blame] | 431 | if (i8042_pnp_kbd_registered) { |
| 432 | i8042_pnp_kbd_registered = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | pnp_unregister_driver(&i8042_pnp_kbd_driver); |
Kurt Garloff | 74af42b | 2005-05-28 02:11:38 -0500 | [diff] [blame] | 434 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | |
Kurt Garloff | 74af42b | 2005-05-28 02:11:38 -0500 | [diff] [blame] | 436 | if (i8042_pnp_aux_registered) { |
| 437 | i8042_pnp_aux_registered = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | pnp_unregister_driver(&i8042_pnp_aux_driver); |
Kurt Garloff | 74af42b | 2005-05-28 02:11:38 -0500 | [diff] [blame] | 439 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | } |
| 441 | |
Dmitry Torokhov | 8d5987a | 2005-09-04 01:41:38 -0500 | [diff] [blame] | 442 | static int __init i8042_pnp_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | { |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 444 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 445 | int pnp_data_busted = 0; |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 446 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | |
| 448 | if (i8042_nopnp) { |
Vojtech Pavlik | 39fa580 | 2005-05-28 02:11:16 -0500 | [diff] [blame] | 449 | printk(KERN_INFO "i8042: PNP detection disabled\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | return 0; |
| 451 | } |
| 452 | |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 453 | err = pnp_register_driver(&i8042_pnp_kbd_driver); |
| 454 | if (!err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | i8042_pnp_kbd_registered = 1; |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 456 | |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 457 | err = pnp_register_driver(&i8042_pnp_aux_driver); |
| 458 | if (!err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | i8042_pnp_aux_registered = 1; |
| 460 | |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 461 | if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | i8042_pnp_exit(); |
| 463 | #if defined(__ia64__) |
| 464 | return -ENODEV; |
| 465 | #else |
Dmitry Torokhov | 5a72afc | 2005-05-28 02:11:32 -0500 | [diff] [blame] | 466 | printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | return 0; |
| 468 | #endif |
| 469 | } |
| 470 | |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 471 | if (i8042_pnp_kbd_devices) |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 472 | snprintf(kbd_irq_str, sizeof(kbd_irq_str), |
| 473 | "%d", i8042_pnp_kbd_irq); |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 474 | if (i8042_pnp_aux_devices) |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 475 | snprintf(aux_irq_str, sizeof(aux_irq_str), |
| 476 | "%d", i8042_pnp_aux_irq); |
| 477 | |
| 478 | printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n", |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 479 | i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "", |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 480 | i8042_pnp_aux_name, |
| 481 | i8042_pnp_data_reg, i8042_pnp_command_reg, |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 482 | kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "", |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 483 | aux_irq_str); |
| 484 | |
| 485 | #if defined(__ia64__) |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 486 | if (!i8042_pnp_kbd_devices) |
Dmitry Torokhov | 945ef0d | 2005-09-04 01:42:00 -0500 | [diff] [blame] | 487 | i8042_nokbd = 1; |
Bjorn Helgaas | 2bfc3c6 | 2006-03-14 00:12:24 -0500 | [diff] [blame] | 488 | if (!i8042_pnp_aux_devices) |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 489 | i8042_noaux = 1; |
| 490 | #endif |
| 491 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 493 | i8042_pnp_data_reg != i8042_data_reg) || |
| 494 | !i8042_pnp_data_reg) { |
| 495 | printk(KERN_WARNING |
| 496 | "PNP: PS/2 controller has invalid data port %#x; " |
| 497 | "using default %#x\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | i8042_pnp_data_reg, i8042_data_reg); |
| 499 | i8042_pnp_data_reg = i8042_data_reg; |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 500 | pnp_data_busted = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) && |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 504 | i8042_pnp_command_reg != i8042_command_reg) || |
| 505 | !i8042_pnp_command_reg) { |
| 506 | printk(KERN_WARNING |
| 507 | "PNP: PS/2 controller has invalid command port %#x; " |
| 508 | "using default %#x\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | i8042_pnp_command_reg, i8042_command_reg); |
| 510 | i8042_pnp_command_reg = i8042_command_reg; |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 511 | pnp_data_busted = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | } |
| 513 | |
Dmitry Torokhov | 945ef0d | 2005-09-04 01:42:00 -0500 | [diff] [blame] | 514 | if (!i8042_nokbd && !i8042_pnp_kbd_irq) { |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 515 | printk(KERN_WARNING |
| 516 | "PNP: PS/2 controller doesn't have KBD irq; " |
| 517 | "using default %d\n", i8042_kbd_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | i8042_pnp_kbd_irq = i8042_kbd_irq; |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 519 | pnp_data_busted = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | } |
| 521 | |
Dmitry Torokhov | c3d31e7 | 2005-09-04 01:41:51 -0500 | [diff] [blame] | 522 | if (!i8042_noaux && !i8042_pnp_aux_irq) { |
Dmitry Torokhov | 080c652 | 2007-07-18 00:38:01 -0400 | [diff] [blame] | 523 | if (!pnp_data_busted && i8042_pnp_kbd_irq) { |
| 524 | printk(KERN_WARNING |
| 525 | "PNP: PS/2 appears to have AUX port disabled, " |
| 526 | "if this is incorrect please boot with " |
| 527 | "i8042.nopnp\n"); |
| 528 | i8042_noaux = 1; |
| 529 | } else { |
| 530 | printk(KERN_WARNING |
| 531 | "PNP: PS/2 controller doesn't have AUX irq; " |
| 532 | "using default %d\n", i8042_aux_irq); |
| 533 | i8042_pnp_aux_irq = i8042_aux_irq; |
| 534 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | } |
| 536 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | i8042_data_reg = i8042_pnp_data_reg; |
| 538 | i8042_command_reg = i8042_pnp_command_reg; |
| 539 | i8042_kbd_irq = i8042_pnp_kbd_irq; |
| 540 | i8042_aux_irq = i8042_pnp_aux_irq; |
| 541 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | return 0; |
| 543 | } |
| 544 | |
Dmitry Torokhov | 8d5987a | 2005-09-04 01:41:38 -0500 | [diff] [blame] | 545 | #else |
| 546 | static inline int i8042_pnp_init(void) { return 0; } |
| 547 | static inline void i8042_pnp_exit(void) { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | #endif |
| 549 | |
Dmitry Torokhov | 8d5987a | 2005-09-04 01:41:38 -0500 | [diff] [blame] | 550 | static int __init i8042_platform_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | { |
Dmitry Torokhov | 8d5987a | 2005-09-04 01:41:38 -0500 | [diff] [blame] | 552 | int retval; |
| 553 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | /* |
| 555 | * On ix86 platforms touching the i8042 data register region can do really |
| 556 | * bad things. Because of this the region is always reserved on ix86 boxes. |
| 557 | * |
| 558 | * if (!request_region(I8042_DATA_REG, 16, "i8042")) |
Dmitry Torokhov | 8d5987a | 2005-09-04 01:41:38 -0500 | [diff] [blame] | 559 | * return -EBUSY; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | */ |
| 561 | |
| 562 | i8042_kbd_irq = I8042_MAP_IRQ(1); |
| 563 | i8042_aux_irq = I8042_MAP_IRQ(12); |
| 564 | |
Dmitry Torokhov | 8d5987a | 2005-09-04 01:41:38 -0500 | [diff] [blame] | 565 | retval = i8042_pnp_init(); |
| 566 | if (retval) |
| 567 | return retval; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | |
| 569 | #if defined(__ia64__) |
| 570 | i8042_reset = 1; |
| 571 | #endif |
| 572 | |
Bruce Duncan | b4d62de | 2008-01-30 16:34:34 -0500 | [diff] [blame] | 573 | #if defined(__i386__) || defined(__x86_64__) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | if (dmi_check_system(i8042_dmi_noloop_table)) |
| 575 | i8042_noloop = 1; |
| 576 | |
| 577 | if (dmi_check_system(i8042_dmi_nomux_table)) |
| 578 | i8042_nomux = 1; |
| 579 | #endif |
| 580 | |
Carlos Corbacho | 8987fec | 2008-01-21 01:04:40 -0500 | [diff] [blame] | 581 | #ifdef CONFIG_X86 |
| 582 | if (dmi_check_system(i8042_dmi_dritek_table)) |
| 583 | i8042_dritek = 1; |
| 584 | #endif /* CONFIG_X86 */ |
| 585 | |
Dmitry Torokhov | 8d5987a | 2005-09-04 01:41:38 -0500 | [diff] [blame] | 586 | return retval; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | static inline void i8042_platform_exit(void) |
| 590 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | i8042_pnp_exit(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | } |
| 593 | |
| 594 | #endif /* _I8042_X86IA64IO_H */ |