atkbd.c (6967963d6d5cac40a091d075326f0e3ccb95c58a) | atkbd.c (157f3a3e17cd498571db2a472dc3a15a7679ee3f) |
---|---|
1/* 2 * AT and PS/2 keyboard driver 3 * 4 * Copyright (c) 1999-2002 Vojtech Pavlik 5 */ 6 7/* 8 * This program is free software; you can redistribute it and/or modify it --- 215 unchanged lines hidden (view full) --- 224 unsigned long event_jiffies; 225 struct mutex event_mutex; 226 unsigned long event_mask; 227}; 228 229/* 230 * System-specific ketymap fixup routine 231 */ | 1/* 2 * AT and PS/2 keyboard driver 3 * 4 * Copyright (c) 1999-2002 Vojtech Pavlik 5 */ 6 7/* 8 * This program is free software; you can redistribute it and/or modify it --- 215 unchanged lines hidden (view full) --- 224 unsigned long event_jiffies; 225 struct mutex event_mutex; 226 unsigned long event_mask; 227}; 228 229/* 230 * System-specific ketymap fixup routine 231 */ |
232static void (*atkbd_platform_fixup)(struct atkbd *); | 232static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); 233static void *atkbd_platform_fixup_data; |
233 234static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, 235 ssize_t (*handler)(struct atkbd *, char *)); 236static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t count, 237 ssize_t (*handler)(struct atkbd *, const char *, size_t)); 238#define ATKBD_DEFINE_ATTR(_name) \ 239static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ 240static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ --- 588 unchanged lines hidden (view full) --- 829 sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group); 830 input_unregister_device(atkbd->dev); 831 serio_close(serio); 832 serio_set_drvdata(serio, NULL); 833 kfree(atkbd); 834} 835 836/* | 234 235static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, 236 ssize_t (*handler)(struct atkbd *, char *)); 237static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t count, 238 ssize_t (*handler)(struct atkbd *, const char *, size_t)); 239#define ATKBD_DEFINE_ATTR(_name) \ 240static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ 241static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ --- 588 unchanged lines hidden (view full) --- 830 sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group); 831 input_unregister_device(atkbd->dev); 832 serio_close(serio); 833 serio_set_drvdata(serio, NULL); 834 kfree(atkbd); 835} 836 837/* |
837 * Most special keys (Fn+F?) on Dell laptops do not generate release 838 * events so we have to do it ourselves. | 838 * generate release events for the keycodes given in data |
839 */ | 839 */ |
840static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd) | 840static void atkbd_apply_forced_release_keylist(struct atkbd* atkbd, 841 const void *data) |
841{ | 842{ |
842 static const unsigned int forced_release_keys[] = { 843 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93, 844 }; 845 int i; | 843 const unsigned int *keys = data; 844 unsigned int i; |
846 847 if (atkbd->set == 2) | 845 846 if (atkbd->set == 2) |
848 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 849 __set_bit(forced_release_keys[i], 850 atkbd->force_release_mask); | 847 for (i = 0; keys[i] != -1U; i++) 848 __set_bit(keys[i], atkbd->force_release_mask); |
851} 852 853/* | 849} 850 851/* |
852 * Most special keys (Fn+F?) on Dell laptops do not generate release 853 * events so we have to do it ourselves. 854 */ 855static unsigned int atkbd_dell_laptop_forced_release_keys[] = { 856 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93, -1U 857}; 858 859/* |
|
854 * Perform fixup for HP system that doesn't generate release 855 * for its video switch 856 */ | 860 * Perform fixup for HP system that doesn't generate release 861 * for its video switch 862 */ |
857static void atkbd_hp_keymap_fixup(struct atkbd *atkbd) 858{ 859 static const unsigned int forced_release_keys[] = { 860 0x94, 861 }; 862 int i; | 863static unsigned int atkbd_hp_forced_release_keys[] = { 864 0x94, -1U 865}; |
863 | 866 |
864 if (atkbd->set == 2) 865 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 866 __set_bit(forced_release_keys[i], 867 atkbd->force_release_mask); 868} 869 | |
870/* 871 * Inventec system with broken key release on volume keys 872 */ | 867/* 868 * Inventec system with broken key release on volume keys 869 */ |
873static void atkbd_inventec_keymap_fixup(struct atkbd *atkbd) 874{ 875 const unsigned int forced_release_keys[] = { 876 0xae, 0xb0, 877 }; 878 int i; | 870static unsigned int atkbd_inventec_forced_release_keys[] = { 871 0xae, 0xb0, -1U 872}; |
879 | 873 |
880 if (atkbd->set == 2) 881 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 882 __set_bit(forced_release_keys[i], 883 atkbd->force_release_mask); 884} 885 | |
886/* 887 * Perform fixup for HP Pavilion ZV6100 laptop that doesn't generate release 888 * for its volume buttons 889 */ | 874/* 875 * Perform fixup for HP Pavilion ZV6100 laptop that doesn't generate release 876 * for its volume buttons 877 */ |
890static void atkbd_hp_zv6100_keymap_fixup(struct atkbd *atkbd) 891{ 892 const unsigned int forced_release_keys[] = { 893 0xae, 0xb0, 894 }; 895 int i; | 878static unsigned int atkbd_hp_zv6100_forced_release_keys[] = { 879 0xae, 0xb0, -1U 880}; |
896 | 881 |
897 if (atkbd->set == 2) 898 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 899 __set_bit(forced_release_keys[i], 900 atkbd->force_release_mask); 901} 902 | |
903/* 904 * Samsung NC10 with Fn+F? key release not working 905 */ | 882/* 883 * Samsung NC10 with Fn+F? key release not working 884 */ |
906static void atkbd_samsung_keymap_fixup(struct atkbd *atkbd) 907{ 908 const unsigned int forced_release_keys[] = { 909 0x82, 0x83, 0x84, 0x86, 0x88, 0x89, 0xb3, 0xf7, 0xf9, 910 }; 911 int i; | 885static unsigned int atkbd_samsung_forced_release_keys[] = { 886 0x82, 0x83, 0x84, 0x86, 0x88, 0x89, 0xb3, 0xf7, 0xf9, -1U 887}; |
912 | 888 |
913 if (atkbd->set == 2) 914 for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++) 915 __set_bit(forced_release_keys[i], 916 atkbd->force_release_mask); 917} | 889/* 890 * The volume up and volume down special keys on a Fujitsu Amilo PA 1510 laptop 891 * do not generate release events so we have to do it ourselves. 892 */ 893static unsigned int atkbd_amilo_pa1510_forced_release_keys[] = { 894 0xb0, 0xae, -1U 895}; |
918 919/* 920 * atkbd_set_keycode_table() initializes keyboard's keycode table 921 * according to the selected scancode set 922 */ 923 924static void atkbd_set_keycode_table(struct atkbd *atkbd) 925{ --- 36 unchanged lines hidden (view full) --- 962 scancode = atkbd_compat_scancode(atkbd, ATKBD_RET_HANJA); 963 atkbd->keycode[scancode] = KEY_HANJA; 964 __set_bit(scancode, atkbd->force_release_mask); 965 966/* 967 * Perform additional fixups 968 */ 969 if (atkbd_platform_fixup) | 896 897/* 898 * atkbd_set_keycode_table() initializes keyboard's keycode table 899 * according to the selected scancode set 900 */ 901 902static void atkbd_set_keycode_table(struct atkbd *atkbd) 903{ --- 36 unchanged lines hidden (view full) --- 940 scancode = atkbd_compat_scancode(atkbd, ATKBD_RET_HANJA); 941 atkbd->keycode[scancode] = KEY_HANJA; 942 __set_bit(scancode, atkbd->force_release_mask); 943 944/* 945 * Perform additional fixups 946 */ 947 if (atkbd_platform_fixup) |
970 atkbd_platform_fixup(atkbd); | 948 atkbd_platform_fixup(atkbd, atkbd_platform_fixup_data); |
971} 972 973/* 974 * atkbd_set_device_attrs() sets up keyboard's input device structure 975 */ 976 977static void atkbd_set_device_attrs(struct atkbd *atkbd) 978{ --- 508 unchanged lines hidden (view full) --- 1487 return count; 1488} 1489 1490static ssize_t atkbd_show_err_count(struct atkbd *atkbd, char *buf) 1491{ 1492 return sprintf(buf, "%lu\n", atkbd->err_count); 1493} 1494 | 949} 950 951/* 952 * atkbd_set_device_attrs() sets up keyboard's input device structure 953 */ 954 955static void atkbd_set_device_attrs(struct atkbd *atkbd) 956{ --- 508 unchanged lines hidden (view full) --- 1465 return count; 1466} 1467 1468static ssize_t atkbd_show_err_count(struct atkbd *atkbd, char *buf) 1469{ 1470 return sprintf(buf, "%lu\n", atkbd->err_count); 1471} 1472 |
1495static int __init atkbd_setup_fixup(const struct dmi_system_id *id) | 1473static int __init atkbd_setup_forced_release(const struct dmi_system_id *id) |
1496{ | 1474{ |
1497 atkbd_platform_fixup = id->driver_data; | 1475 atkbd_platform_fixup = atkbd_apply_forced_release_keylist; 1476 atkbd_platform_fixup_data = id->driver_data; 1477 |
1498 return 0; 1499} 1500 1501static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { 1502 { 1503 .ident = "Dell Laptop", 1504 .matches = { 1505 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1506 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ 1507 }, | 1478 return 0; 1479} 1480 1481static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { 1482 { 1483 .ident = "Dell Laptop", 1484 .matches = { 1485 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1486 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ 1487 }, |
1508 .callback = atkbd_setup_fixup, 1509 .driver_data = atkbd_dell_laptop_keymap_fixup, | 1488 .callback = atkbd_setup_forced_release, 1489 .driver_data = atkbd_dell_laptop_forced_release_keys, |
1510 }, 1511 { 1512 .ident = "Dell Laptop", 1513 .matches = { 1514 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 1515 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ 1516 }, | 1490 }, 1491 { 1492 .ident = "Dell Laptop", 1493 .matches = { 1494 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), 1495 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ 1496 }, |
1517 .callback = atkbd_setup_fixup, 1518 .driver_data = atkbd_dell_laptop_keymap_fixup, | 1497 .callback = atkbd_setup_forced_release, 1498 .driver_data = atkbd_dell_laptop_forced_release_keys, |
1519 }, 1520 { 1521 .ident = "HP 2133", 1522 .matches = { 1523 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1524 DMI_MATCH(DMI_PRODUCT_NAME, "HP 2133"), 1525 }, | 1499 }, 1500 { 1501 .ident = "HP 2133", 1502 .matches = { 1503 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1504 DMI_MATCH(DMI_PRODUCT_NAME, "HP 2133"), 1505 }, |
1526 .callback = atkbd_setup_fixup, 1527 .driver_data = atkbd_hp_keymap_fixup, | 1506 .callback = atkbd_setup_forced_release, 1507 .driver_data = atkbd_hp_forced_release_keys, |
1528 }, 1529 { 1530 .ident = "HP Pavilion ZV6100", 1531 .matches = { 1532 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1533 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"), 1534 }, | 1508 }, 1509 { 1510 .ident = "HP Pavilion ZV6100", 1511 .matches = { 1512 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1513 DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"), 1514 }, |
1535 .callback = atkbd_setup_fixup, 1536 .driver_data = atkbd_hp_zv6100_keymap_fixup, | 1515 .callback = atkbd_setup_forced_release, 1516 .driver_data = atkbd_hp_zv6100_forced_release_keys, |
1537 }, 1538 { 1539 .ident = "Inventec Symphony", 1540 .matches = { 1541 DMI_MATCH(DMI_SYS_VENDOR, "INVENTEC"), 1542 DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"), 1543 }, | 1517 }, 1518 { 1519 .ident = "Inventec Symphony", 1520 .matches = { 1521 DMI_MATCH(DMI_SYS_VENDOR, "INVENTEC"), 1522 DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"), 1523 }, |
1544 .callback = atkbd_setup_fixup, 1545 .driver_data = atkbd_inventec_keymap_fixup, | 1524 .callback = atkbd_setup_forced_release, 1525 .driver_data = atkbd_inventec_forced_release_keys, |
1546 }, 1547 { 1548 .ident = "Samsung NC10", 1549 .matches = { 1550 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1551 DMI_MATCH(DMI_PRODUCT_NAME, "NC10"), 1552 }, | 1526 }, 1527 { 1528 .ident = "Samsung NC10", 1529 .matches = { 1530 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1531 DMI_MATCH(DMI_PRODUCT_NAME, "NC10"), 1532 }, |
1553 .callback = atkbd_setup_fixup, 1554 .driver_data = atkbd_samsung_keymap_fixup, | 1533 .callback = atkbd_setup_forced_release, 1534 .driver_data = atkbd_samsung_forced_release_keys, |
1555 }, | 1535 }, |
1536 { 1537 .ident = "Samsung SQ45S70S", 1538 .matches = { 1539 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 1540 DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"), 1541 }, 1542 .callback = atkbd_setup_forced_release, 1543 .driver_data = atkbd_samsung_forced_release_keys, 1544 }, 1545 { 1546 .ident = "Fujitsu Amilo PA 1510", 1547 .matches = { 1548 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 1549 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 1510"), 1550 }, 1551 .callback = atkbd_setup_forced_release, 1552 .driver_data = atkbd_amilo_pa1510_forced_release_keys, 1553 }, |
|
1556 { } 1557}; 1558 1559static int __init atkbd_init(void) 1560{ 1561 dmi_check_system(atkbd_dmi_quirk_table); 1562 1563 return serio_register_driver(&atkbd_drv); 1564} 1565 1566static void __exit atkbd_exit(void) 1567{ 1568 serio_unregister_driver(&atkbd_drv); 1569} 1570 1571module_init(atkbd_init); 1572module_exit(atkbd_exit); | 1554 { } 1555}; 1556 1557static int __init atkbd_init(void) 1558{ 1559 dmi_check_system(atkbd_dmi_quirk_table); 1560 1561 return serio_register_driver(&atkbd_drv); 1562} 1563 1564static void __exit atkbd_exit(void) 1565{ 1566 serio_unregister_driver(&atkbd_drv); 1567} 1568 1569module_init(atkbd_init); 1570module_exit(atkbd_exit); |