aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/misc/wistron_btns.c76
1 files changed, 49 insertions, 27 deletions
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index b9ef1dfc9a07..793cee3aa5e7 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -50,7 +50,7 @@
50MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>"); 50MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>");
51MODULE_DESCRIPTION("Wistron laptop button driver"); 51MODULE_DESCRIPTION("Wistron laptop button driver");
52MODULE_LICENSE("GPL v2"); 52MODULE_LICENSE("GPL v2");
53MODULE_VERSION("0.1"); 53MODULE_VERSION("0.2");
54 54
55static int force; /* = 0; */ 55static int force; /* = 0; */
56module_param(force, bool, 0); 56module_param(force, bool, 0);
@@ -266,11 +266,11 @@ static int __init dmi_matched(struct dmi_system_id *dmi)
266 return 1; 266 return 1;
267} 267}
268 268
269static struct key_entry keymap_empty[] = { 269static struct key_entry keymap_empty[] __initdata = {
270 { KE_END, 0 } 270 { KE_END, 0 }
271}; 271};
272 272
273static struct key_entry keymap_fs_amilo_pro_v2000[] = { 273static struct key_entry keymap_fs_amilo_pro_v2000[] __initdata = {
274 { KE_KEY, 0x01, {KEY_HELP} }, 274 { KE_KEY, 0x01, {KEY_HELP} },
275 { KE_KEY, 0x11, {KEY_PROG1} }, 275 { KE_KEY, 0x11, {KEY_PROG1} },
276 { KE_KEY, 0x12, {KEY_PROG2} }, 276 { KE_KEY, 0x12, {KEY_PROG2} },
@@ -280,7 +280,7 @@ static struct key_entry keymap_fs_amilo_pro_v2000[] = {
280 { KE_END, 0 } 280 { KE_END, 0 }
281}; 281};
282 282
283static struct key_entry keymap_fujitsu_n3510[] = { 283static struct key_entry keymap_fujitsu_n3510[] __initdata = {
284 { KE_KEY, 0x11, {KEY_PROG1} }, 284 { KE_KEY, 0x11, {KEY_PROG1} },
285 { KE_KEY, 0x12, {KEY_PROG2} }, 285 { KE_KEY, 0x12, {KEY_PROG2} },
286 { KE_KEY, 0x36, {KEY_WWW} }, 286 { KE_KEY, 0x36, {KEY_WWW} },
@@ -292,7 +292,7 @@ static struct key_entry keymap_fujitsu_n3510[] = {
292 { KE_END, 0 } 292 { KE_END, 0 }
293}; 293};
294 294
295static struct key_entry keymap_wistron_ms2111[] = { 295static struct key_entry keymap_wistron_ms2111[] __initdata = {
296 { KE_KEY, 0x11, {KEY_PROG1} }, 296 { KE_KEY, 0x11, {KEY_PROG1} },
297 { KE_KEY, 0x12, {KEY_PROG2} }, 297 { KE_KEY, 0x12, {KEY_PROG2} },
298 { KE_KEY, 0x13, {KEY_PROG3} }, 298 { KE_KEY, 0x13, {KEY_PROG3} },
@@ -301,7 +301,7 @@ static struct key_entry keymap_wistron_ms2111[] = {
301 { KE_END, FE_MAIL_LED } 301 { KE_END, FE_MAIL_LED }
302}; 302};
303 303
304static struct key_entry keymap_wistron_md40100[] = { 304static struct key_entry keymap_wistron_md40100[] __initdata = {
305 { KE_KEY, 0x01, {KEY_HELP} }, 305 { KE_KEY, 0x01, {KEY_HELP} },
306 { KE_KEY, 0x02, {KEY_CONFIG} }, 306 { KE_KEY, 0x02, {KEY_CONFIG} },
307 { KE_KEY, 0x31, {KEY_MAIL} }, 307 { KE_KEY, 0x31, {KEY_MAIL} },
@@ -310,7 +310,7 @@ static struct key_entry keymap_wistron_md40100[] = {
310 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED } 310 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED }
311}; 311};
312 312
313static struct key_entry keymap_wistron_ms2141[] = { 313static struct key_entry keymap_wistron_ms2141[] __initdata = {
314 { KE_KEY, 0x11, {KEY_PROG1} }, 314 { KE_KEY, 0x11, {KEY_PROG1} },
315 { KE_KEY, 0x12, {KEY_PROG2} }, 315 { KE_KEY, 0x12, {KEY_PROG2} },
316 { KE_WIFI, 0x30 }, 316 { KE_WIFI, 0x30 },
@@ -323,7 +323,7 @@ static struct key_entry keymap_wistron_ms2141[] = {
323 { KE_END, 0 } 323 { KE_END, 0 }
324}; 324};
325 325
326static struct key_entry keymap_acer_aspire_1500[] = { 326static struct key_entry keymap_acer_aspire_1500[] __initdata = {
327 { KE_KEY, 0x01, {KEY_HELP} }, 327 { KE_KEY, 0x01, {KEY_HELP} },
328 { KE_KEY, 0x03, {KEY_POWER} }, 328 { KE_KEY, 0x03, {KEY_POWER} },
329 { KE_KEY, 0x11, {KEY_PROG1} }, 329 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -336,7 +336,7 @@ static struct key_entry keymap_acer_aspire_1500[] = {
336 { KE_END, FE_UNTESTED } 336 { KE_END, FE_UNTESTED }
337}; 337};
338 338
339static struct key_entry keymap_acer_aspire_1600[] = { 339static struct key_entry keymap_acer_aspire_1600[] __initdata = {
340 { KE_KEY, 0x01, {KEY_HELP} }, 340 { KE_KEY, 0x01, {KEY_HELP} },
341 { KE_KEY, 0x03, {KEY_POWER} }, 341 { KE_KEY, 0x03, {KEY_POWER} },
342 { KE_KEY, 0x08, {KEY_MUTE} }, 342 { KE_KEY, 0x08, {KEY_MUTE} },
@@ -352,7 +352,7 @@ static struct key_entry keymap_acer_aspire_1600[] = {
352}; 352};
353 353
354/* 3020 has been tested */ 354/* 3020 has been tested */
355static struct key_entry keymap_acer_aspire_5020[] = { 355static struct key_entry keymap_acer_aspire_5020[] __initdata = {
356 { KE_KEY, 0x01, {KEY_HELP} }, 356 { KE_KEY, 0x01, {KEY_HELP} },
357 { KE_KEY, 0x03, {KEY_POWER} }, 357 { KE_KEY, 0x03, {KEY_POWER} },
358 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */ 358 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */
@@ -366,7 +366,7 @@ static struct key_entry keymap_acer_aspire_5020[] = {
366 { KE_END, FE_MAIL_LED | FE_UNTESTED } 366 { KE_END, FE_MAIL_LED | FE_UNTESTED }
367}; 367};
368 368
369static struct key_entry keymap_acer_travelmate_2410[] = { 369static struct key_entry keymap_acer_travelmate_2410[] __initdata = {
370 { KE_KEY, 0x01, {KEY_HELP} }, 370 { KE_KEY, 0x01, {KEY_HELP} },
371 { KE_KEY, 0x6d, {KEY_POWER} }, 371 { KE_KEY, 0x6d, {KEY_POWER} },
372 { KE_KEY, 0x11, {KEY_PROG1} }, 372 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -379,7 +379,7 @@ static struct key_entry keymap_acer_travelmate_2410[] = {
379 { KE_END, FE_MAIL_LED | FE_UNTESTED } 379 { KE_END, FE_MAIL_LED | FE_UNTESTED }
380}; 380};
381 381
382static struct key_entry keymap_acer_travelmate_110[] = { 382static struct key_entry keymap_acer_travelmate_110[] __initdata = {
383 { KE_KEY, 0x01, {KEY_HELP} }, 383 { KE_KEY, 0x01, {KEY_HELP} },
384 { KE_KEY, 0x02, {KEY_CONFIG} }, 384 { KE_KEY, 0x02, {KEY_CONFIG} },
385 { KE_KEY, 0x03, {KEY_POWER} }, 385 { KE_KEY, 0x03, {KEY_POWER} },
@@ -396,7 +396,7 @@ static struct key_entry keymap_acer_travelmate_110[] = {
396 { KE_END, FE_MAIL_LED | FE_UNTESTED } 396 { KE_END, FE_MAIL_LED | FE_UNTESTED }
397}; 397};
398 398
399static struct key_entry keymap_acer_travelmate_300[] = { 399static struct key_entry keymap_acer_travelmate_300[] __initdata = {
400 { KE_KEY, 0x01, {KEY_HELP} }, 400 { KE_KEY, 0x01, {KEY_HELP} },
401 { KE_KEY, 0x02, {KEY_CONFIG} }, 401 { KE_KEY, 0x02, {KEY_CONFIG} },
402 { KE_KEY, 0x03, {KEY_POWER} }, 402 { KE_KEY, 0x03, {KEY_POWER} },
@@ -412,7 +412,7 @@ static struct key_entry keymap_acer_travelmate_300[] = {
412 { KE_END, FE_MAIL_LED | FE_UNTESTED } 412 { KE_END, FE_MAIL_LED | FE_UNTESTED }
413}; 413};
414 414
415static struct key_entry keymap_acer_travelmate_380[] = { 415static struct key_entry keymap_acer_travelmate_380[] __initdata = {
416 { KE_KEY, 0x01, {KEY_HELP} }, 416 { KE_KEY, 0x01, {KEY_HELP} },
417 { KE_KEY, 0x02, {KEY_CONFIG} }, 417 { KE_KEY, 0x02, {KEY_CONFIG} },
418 { KE_KEY, 0x03, {KEY_POWER} }, /* not 370 */ 418 { KE_KEY, 0x03, {KEY_POWER} }, /* not 370 */
@@ -426,7 +426,7 @@ static struct key_entry keymap_acer_travelmate_380[] = {
426}; 426};
427 427
428/* unusual map */ 428/* unusual map */
429static struct key_entry keymap_acer_travelmate_220[] = { 429static struct key_entry keymap_acer_travelmate_220[] __initdata = {
430 { KE_KEY, 0x01, {KEY_HELP} }, 430 { KE_KEY, 0x01, {KEY_HELP} },
431 { KE_KEY, 0x02, {KEY_CONFIG} }, 431 { KE_KEY, 0x02, {KEY_CONFIG} },
432 { KE_KEY, 0x11, {KEY_MAIL} }, 432 { KE_KEY, 0x11, {KEY_MAIL} },
@@ -436,7 +436,7 @@ static struct key_entry keymap_acer_travelmate_220[] = {
436 { KE_END, FE_WIFI_LED | FE_UNTESTED } 436 { KE_END, FE_WIFI_LED | FE_UNTESTED }
437}; 437};
438 438
439static struct key_entry keymap_acer_travelmate_230[] = { 439static struct key_entry keymap_acer_travelmate_230[] __initdata = {
440 { KE_KEY, 0x01, {KEY_HELP} }, 440 { KE_KEY, 0x01, {KEY_HELP} },
441 { KE_KEY, 0x02, {KEY_CONFIG} }, 441 { KE_KEY, 0x02, {KEY_CONFIG} },
442 { KE_KEY, 0x11, {KEY_PROG1} }, 442 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -446,7 +446,7 @@ static struct key_entry keymap_acer_travelmate_230[] = {
446 { KE_END, FE_WIFI_LED | FE_UNTESTED } 446 { KE_END, FE_WIFI_LED | FE_UNTESTED }
447}; 447};
448 448
449static struct key_entry keymap_acer_travelmate_240[] = { 449static struct key_entry keymap_acer_travelmate_240[] __initdata = {
450 { KE_KEY, 0x01, {KEY_HELP} }, 450 { KE_KEY, 0x01, {KEY_HELP} },
451 { KE_KEY, 0x02, {KEY_CONFIG} }, 451 { KE_KEY, 0x02, {KEY_CONFIG} },
452 { KE_KEY, 0x03, {KEY_POWER} }, 452 { KE_KEY, 0x03, {KEY_POWER} },
@@ -460,7 +460,7 @@ static struct key_entry keymap_acer_travelmate_240[] = {
460 { KE_END, FE_UNTESTED } 460 { KE_END, FE_UNTESTED }
461}; 461};
462 462
463static struct key_entry keymap_acer_travelmate_350[] = { 463static struct key_entry keymap_acer_travelmate_350[] __initdata = {
464 { KE_KEY, 0x01, {KEY_HELP} }, 464 { KE_KEY, 0x01, {KEY_HELP} },
465 { KE_KEY, 0x02, {KEY_CONFIG} }, 465 { KE_KEY, 0x02, {KEY_CONFIG} },
466 { KE_KEY, 0x11, {KEY_PROG1} }, 466 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -471,7 +471,7 @@ static struct key_entry keymap_acer_travelmate_350[] = {
471 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED } 471 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED }
472}; 472};
473 473
474static struct key_entry keymap_acer_travelmate_360[] = { 474static struct key_entry keymap_acer_travelmate_360[] __initdata = {
475 { KE_KEY, 0x01, {KEY_HELP} }, 475 { KE_KEY, 0x01, {KEY_HELP} },
476 { KE_KEY, 0x02, {KEY_CONFIG} }, 476 { KE_KEY, 0x02, {KEY_CONFIG} },
477 { KE_KEY, 0x11, {KEY_PROG1} }, 477 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -486,7 +486,7 @@ static struct key_entry keymap_acer_travelmate_360[] = {
486/* Wifi subsystem only activates the led. Therefore we need to pass 486/* Wifi subsystem only activates the led. Therefore we need to pass
487 * wifi event as a normal key, then userspace can really change the wifi state. 487 * wifi event as a normal key, then userspace can really change the wifi state.
488 * TODO we need to export led state to userspace (wifi and mail) */ 488 * TODO we need to export led state to userspace (wifi and mail) */
489static struct key_entry keymap_acer_travelmate_610[] = { 489static struct key_entry keymap_acer_travelmate_610[] __initdata = {
490 { KE_KEY, 0x01, {KEY_HELP} }, 490 { KE_KEY, 0x01, {KEY_HELP} },
491 { KE_KEY, 0x02, {KEY_CONFIG} }, 491 { KE_KEY, 0x02, {KEY_CONFIG} },
492 { KE_KEY, 0x11, {KEY_PROG1} }, 492 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -498,7 +498,7 @@ static struct key_entry keymap_acer_travelmate_610[] = {
498 { KE_END, FE_MAIL_LED | FE_WIFI_LED } 498 { KE_END, FE_MAIL_LED | FE_WIFI_LED }
499}; 499};
500 500
501static struct key_entry keymap_acer_travelmate_630[] = { 501static struct key_entry keymap_acer_travelmate_630[] __initdata = {
502 { KE_KEY, 0x01, {KEY_HELP} }, 502 { KE_KEY, 0x01, {KEY_HELP} },
503 { KE_KEY, 0x02, {KEY_CONFIG} }, 503 { KE_KEY, 0x02, {KEY_CONFIG} },
504 { KE_KEY, 0x03, {KEY_POWER} }, 504 { KE_KEY, 0x03, {KEY_POWER} },
@@ -514,7 +514,7 @@ static struct key_entry keymap_acer_travelmate_630[] = {
514 { KE_END, FE_MAIL_LED | FE_UNTESTED } 514 { KE_END, FE_MAIL_LED | FE_UNTESTED }
515}; 515};
516 516
517static struct key_entry keymap_aopen_1559as[] = { 517static struct key_entry keymap_aopen_1559as[] __initdata = {
518 { KE_KEY, 0x01, {KEY_HELP} }, 518 { KE_KEY, 0x01, {KEY_HELP} },
519 { KE_KEY, 0x06, {KEY_PROG3} }, 519 { KE_KEY, 0x06, {KEY_PROG3} },
520 { KE_KEY, 0x11, {KEY_PROG1} }, 520 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -525,7 +525,7 @@ static struct key_entry keymap_aopen_1559as[] = {
525 { KE_END, 0 }, 525 { KE_END, 0 },
526}; 526};
527 527
528static struct key_entry keymap_fs_amilo_d88x0[] = { 528static struct key_entry keymap_fs_amilo_d88x0[] __initdata = {
529 { KE_KEY, 0x01, {KEY_HELP} }, 529 { KE_KEY, 0x01, {KEY_HELP} },
530 { KE_KEY, 0x08, {KEY_MUTE} }, 530 { KE_KEY, 0x08, {KEY_MUTE} },
531 { KE_KEY, 0x31, {KEY_MAIL} }, 531 { KE_KEY, 0x31, {KEY_MAIL} },
@@ -536,7 +536,7 @@ static struct key_entry keymap_fs_amilo_d88x0[] = {
536 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED } 536 { KE_END, FE_MAIL_LED | FE_WIFI_LED | FE_UNTESTED }
537}; 537};
538 538
539static struct key_entry keymap_wistron_md2900[] = { 539static struct key_entry keymap_wistron_md2900[] __initdata = {
540 { KE_KEY, 0x01, {KEY_HELP} }, 540 { KE_KEY, 0x01, {KEY_HELP} },
541 { KE_KEY, 0x02, {KEY_CONFIG} }, 541 { KE_KEY, 0x02, {KEY_CONFIG} },
542 { KE_KEY, 0x11, {KEY_PROG1} }, 542 { KE_KEY, 0x11, {KEY_PROG1} },
@@ -547,7 +547,7 @@ static struct key_entry keymap_wistron_md2900[] = {
547 { KE_END, FE_MAIL_LED | FE_UNTESTED } 547 { KE_END, FE_MAIL_LED | FE_UNTESTED }
548}; 548};
549 549
550static struct key_entry keymap_wistron_md96500[] = { 550static struct key_entry keymap_wistron_md96500[] __initdata = {
551 { KE_KEY, 0x01, {KEY_HELP} }, 551 { KE_KEY, 0x01, {KEY_HELP} },
552 { KE_KEY, 0x02, {KEY_CONFIG} }, 552 { KE_KEY, 0x02, {KEY_CONFIG} },
553 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */ 553 { KE_KEY, 0x05, {KEY_SWITCHVIDEOMODE} }, /* Display selection */
@@ -568,7 +568,7 @@ static struct key_entry keymap_wistron_md96500[] = {
568 { KE_END, FE_UNTESTED } 568 { KE_END, FE_UNTESTED }
569}; 569};
570 570
571static struct key_entry keymap_wistron_generic[] = { 571static struct key_entry keymap_wistron_generic[] __initdata = {
572 { KE_KEY, 0x01, {KEY_HELP} }, 572 { KE_KEY, 0x01, {KEY_HELP} },
573 { KE_KEY, 0x02, {KEY_CONFIG} }, 573 { KE_KEY, 0x02, {KEY_CONFIG} },
574 { KE_KEY, 0x03, {KEY_POWER} }, 574 { KE_KEY, 0x03, {KEY_POWER} },
@@ -920,6 +920,26 @@ static struct dmi_system_id dmi_ids[] __initdata = {
920 { NULL, } 920 { NULL, }
921}; 921};
922 922
923/* Copy the good keymap, as the original ones are free'd */
924static int __init copy_keymap(void)
925{
926 const struct key_entry *key;
927 struct key_entry *new_keymap;
928 unsigned int length = 1;
929
930 for (key = keymap; key->type != KE_END; key++)
931 length++;
932
933 new_keymap = kmalloc(length * sizeof(struct key_entry), GFP_KERNEL);
934 if (!new_keymap)
935 return -ENOMEM;
936
937 memcpy(new_keymap, keymap, length * sizeof(struct key_entry));
938 keymap = new_keymap;
939
940 return 0;
941}
942
923static int __init select_keymap(void) 943static int __init select_keymap(void)
924{ 944{
925 dmi_check_system(dmi_ids); 945 dmi_check_system(dmi_ids);
@@ -940,7 +960,8 @@ static int __init select_keymap(void)
940 } 960 }
941 keymap = keymap_empty; 961 keymap = keymap_empty;
942 } 962 }
943 return 0; 963
964 return copy_keymap();
944} 965}
945 966
946 /* Input layer interface */ 967 /* Input layer interface */
@@ -1203,6 +1224,7 @@ static void __exit wb_module_exit(void)
1203 platform_device_unregister(wistron_device); 1224 platform_device_unregister(wistron_device);
1204 platform_driver_unregister(&wistron_driver); 1225 platform_driver_unregister(&wistron_driver);
1205 unmap_bios(); 1226 unmap_bios();
1227 kfree(keymap);
1206} 1228}
1207 1229
1208module_init(wb_module_init); 1230module_init(wb_module_init);