aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/wistron_btns.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/misc/wistron_btns.c')
-rw-r--r--drivers/input/misc/wistron_btns.c107
1 files changed, 78 insertions, 29 deletions
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 7c8957dd22c0..11fd038a078f 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -243,9 +243,9 @@ enum { KE_END, KE_KEY, KE_SW, KE_WIFI, KE_BLUETOOTH };
243#define FE_UNTESTED 0x80 243#define FE_UNTESTED 0x80
244 244
245static struct key_entry *keymap; /* = NULL; Current key map */ 245static struct key_entry *keymap; /* = NULL; Current key map */
246static int have_wifi; 246static bool have_wifi;
247static int have_bluetooth; 247static bool have_bluetooth;
248static int have_leds; 248static int leds_present; /* bitmask of leds present */
249 249
250static int __init dmi_matched(const struct dmi_system_id *dmi) 250static int __init dmi_matched(const struct dmi_system_id *dmi)
251{ 251{
@@ -254,11 +254,11 @@ static int __init dmi_matched(const struct dmi_system_id *dmi)
254 keymap = dmi->driver_data; 254 keymap = dmi->driver_data;
255 for (key = keymap; key->type != KE_END; key++) { 255 for (key = keymap; key->type != KE_END; key++) {
256 if (key->type == KE_WIFI) 256 if (key->type == KE_WIFI)
257 have_wifi = 1; 257 have_wifi = true;
258 else if (key->type == KE_BLUETOOTH) 258 else if (key->type == KE_BLUETOOTH)
259 have_bluetooth = 1; 259 have_bluetooth = true;
260 } 260 }
261 have_leds = key->code & (FE_MAIL_LED | FE_WIFI_LED); 261 leds_present = key->code & (FE_MAIL_LED | FE_WIFI_LED);
262 262
263 return 1; 263 return 1;
264} 264}
@@ -611,6 +611,34 @@ static struct key_entry keymap_wistron_generic[] __initdata = {
611 { KE_END, 0 } 611 { KE_END, 0 }
612}; 612};
613 613
614static struct key_entry keymap_aopen_1557[] __initdata = {
615 { KE_KEY, 0x01, {KEY_HELP} },
616 { KE_KEY, 0x11, {KEY_PROG1} },
617 { KE_KEY, 0x12, {KEY_PROG2} },
618 { KE_WIFI, 0x30 },
619 { KE_KEY, 0x22, {KEY_REWIND} },
620 { KE_KEY, 0x23, {KEY_FORWARD} },
621 { KE_KEY, 0x24, {KEY_PLAYPAUSE} },
622 { KE_KEY, 0x25, {KEY_STOPCD} },
623 { KE_KEY, 0x31, {KEY_MAIL} },
624 { KE_KEY, 0x36, {KEY_WWW} },
625 { KE_END, 0 }
626};
627
628static struct key_entry keymap_prestigio[] __initdata = {
629 { KE_KEY, 0x11, {KEY_PROG1} },
630 { KE_KEY, 0x12, {KEY_PROG2} },
631 { KE_WIFI, 0x30 },
632 { KE_KEY, 0x22, {KEY_REWIND} },
633 { KE_KEY, 0x23, {KEY_FORWARD} },
634 { KE_KEY, 0x24, {KEY_PLAYPAUSE} },
635 { KE_KEY, 0x25, {KEY_STOPCD} },
636 { KE_KEY, 0x31, {KEY_MAIL} },
637 { KE_KEY, 0x36, {KEY_WWW} },
638 { KE_END, 0 }
639};
640
641
614/* 642/*
615 * If your machine is not here (which is currently rather likely), please send 643 * If your machine is not here (which is currently rather likely), please send
616 * a list of buttons and their key codes (reported when loading this module 644 * a list of buttons and their key codes (reported when loading this module
@@ -646,6 +674,15 @@ static struct dmi_system_id dmi_ids[] __initdata = {
646 }, 674 },
647 { 675 {
648 .callback = dmi_matched, 676 .callback = dmi_matched,
677 .ident = "Maxdata Pro 7000 DX",
678 .matches = {
679 DMI_MATCH(DMI_SYS_VENDOR, "MAXDATA"),
680 DMI_MATCH(DMI_PRODUCT_NAME, "Pro 7000"),
681 },
682 .driver_data = keymap_fs_amilo_pro_v2000
683 },
684 {
685 .callback = dmi_matched,
649 .ident = "Fujitsu N3510", 686 .ident = "Fujitsu N3510",
650 .matches = { 687 .matches = {
651 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 688 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
@@ -962,6 +999,10 @@ static int __init select_keymap(void)
962 if (keymap_name != NULL) { 999 if (keymap_name != NULL) {
963 if (strcmp (keymap_name, "1557/MS2141") == 0) 1000 if (strcmp (keymap_name, "1557/MS2141") == 0)
964 keymap = keymap_wistron_ms2141; 1001 keymap = keymap_wistron_ms2141;
1002 else if (strcmp (keymap_name, "aopen1557") == 0)
1003 keymap = keymap_aopen_1557;
1004 else if (strcmp (keymap_name, "prestigio") == 0)
1005 keymap = keymap_prestigio;
965 else if (strcmp (keymap_name, "generic") == 0) 1006 else if (strcmp (keymap_name, "generic") == 0)
966 keymap = keymap_wistron_generic; 1007 keymap = keymap_wistron_generic;
967 else { 1008 else {
@@ -984,8 +1025,8 @@ static int __init select_keymap(void)
984 1025
985static struct input_polled_dev *wistron_idev; 1026static struct input_polled_dev *wistron_idev;
986static unsigned long jiffies_last_press; 1027static unsigned long jiffies_last_press;
987static int wifi_enabled; 1028static bool wifi_enabled;
988static int bluetooth_enabled; 1029static bool bluetooth_enabled;
989 1030
990static void report_key(struct input_dev *dev, unsigned int keycode) 1031static void report_key(struct input_dev *dev, unsigned int keycode)
991{ 1032{
@@ -1028,24 +1069,24 @@ static struct led_classdev wistron_wifi_led = {
1028 1069
1029static void __devinit wistron_led_init(struct device *parent) 1070static void __devinit wistron_led_init(struct device *parent)
1030{ 1071{
1031 if (have_leds & FE_WIFI_LED) { 1072 if (leds_present & FE_WIFI_LED) {
1032 u16 wifi = bios_get_default_setting(WIFI); 1073 u16 wifi = bios_get_default_setting(WIFI);
1033 if (wifi & 1) { 1074 if (wifi & 1) {
1034 wistron_wifi_led.brightness = (wifi & 2) ? LED_FULL : LED_OFF; 1075 wistron_wifi_led.brightness = (wifi & 2) ? LED_FULL : LED_OFF;
1035 if (led_classdev_register(parent, &wistron_wifi_led)) 1076 if (led_classdev_register(parent, &wistron_wifi_led))
1036 have_leds &= ~FE_WIFI_LED; 1077 leds_present &= ~FE_WIFI_LED;
1037 else 1078 else
1038 bios_set_state(WIFI, wistron_wifi_led.brightness); 1079 bios_set_state(WIFI, wistron_wifi_led.brightness);
1039 1080
1040 } else 1081 } else
1041 have_leds &= ~FE_WIFI_LED; 1082 leds_present &= ~FE_WIFI_LED;
1042 } 1083 }
1043 1084
1044 if (have_leds & FE_MAIL_LED) { 1085 if (leds_present & FE_MAIL_LED) {
1045 /* bios_get_default_setting(MAIL) always retuns 0, so just turn the led off */ 1086 /* bios_get_default_setting(MAIL) always retuns 0, so just turn the led off */
1046 wistron_mail_led.brightness = LED_OFF; 1087 wistron_mail_led.brightness = LED_OFF;
1047 if (led_classdev_register(parent, &wistron_mail_led)) 1088 if (led_classdev_register(parent, &wistron_mail_led))
1048 have_leds &= ~FE_MAIL_LED; 1089 leds_present &= ~FE_MAIL_LED;
1049 else 1090 else
1050 bios_set_state(MAIL_LED, wistron_mail_led.brightness); 1091 bios_set_state(MAIL_LED, wistron_mail_led.brightness);
1051 } 1092 }
@@ -1053,28 +1094,28 @@ static void __devinit wistron_led_init(struct device *parent)
1053 1094
1054static void __devexit wistron_led_remove(void) 1095static void __devexit wistron_led_remove(void)
1055{ 1096{
1056 if (have_leds & FE_MAIL_LED) 1097 if (leds_present & FE_MAIL_LED)
1057 led_classdev_unregister(&wistron_mail_led); 1098 led_classdev_unregister(&wistron_mail_led);
1058 1099
1059 if (have_leds & FE_WIFI_LED) 1100 if (leds_present & FE_WIFI_LED)
1060 led_classdev_unregister(&wistron_wifi_led); 1101 led_classdev_unregister(&wistron_wifi_led);
1061} 1102}
1062 1103
1063static inline void wistron_led_suspend(void) 1104static inline void wistron_led_suspend(void)
1064{ 1105{
1065 if (have_leds & FE_MAIL_LED) 1106 if (leds_present & FE_MAIL_LED)
1066 led_classdev_suspend(&wistron_mail_led); 1107 led_classdev_suspend(&wistron_mail_led);
1067 1108
1068 if (have_leds & FE_WIFI_LED) 1109 if (leds_present & FE_WIFI_LED)
1069 led_classdev_suspend(&wistron_wifi_led); 1110 led_classdev_suspend(&wistron_wifi_led);
1070} 1111}
1071 1112
1072static inline void wistron_led_resume(void) 1113static inline void wistron_led_resume(void)
1073{ 1114{
1074 if (have_leds & FE_MAIL_LED) 1115 if (leds_present & FE_MAIL_LED)
1075 led_classdev_resume(&wistron_mail_led); 1116 led_classdev_resume(&wistron_mail_led);
1076 1117
1077 if (have_leds & FE_WIFI_LED) 1118 if (leds_present & FE_WIFI_LED)
1078 led_classdev_resume(&wistron_wifi_led); 1119 led_classdev_resume(&wistron_wifi_led);
1079} 1120}
1080 1121
@@ -1287,7 +1328,7 @@ static int __devinit wistron_probe(struct platform_device *dev)
1287 if (have_wifi) { 1328 if (have_wifi) {
1288 u16 wifi = bios_get_default_setting(WIFI); 1329 u16 wifi = bios_get_default_setting(WIFI);
1289 if (wifi & 1) 1330 if (wifi & 1)
1290 wifi_enabled = (wifi & 2) ? 1 : 0; 1331 wifi_enabled = wifi & 2;
1291 else 1332 else
1292 have_wifi = 0; 1333 have_wifi = 0;
1293 1334
@@ -1298,15 +1339,16 @@ static int __devinit wistron_probe(struct platform_device *dev)
1298 if (have_bluetooth) { 1339 if (have_bluetooth) {
1299 u16 bt = bios_get_default_setting(BLUETOOTH); 1340 u16 bt = bios_get_default_setting(BLUETOOTH);
1300 if (bt & 1) 1341 if (bt & 1)
1301 bluetooth_enabled = (bt & 2) ? 1 : 0; 1342 bluetooth_enabled = bt & 2;
1302 else 1343 else
1303 have_bluetooth = 0; 1344 have_bluetooth = false;
1304 1345
1305 if (have_bluetooth) 1346 if (have_bluetooth)
1306 bios_set_state(BLUETOOTH, bluetooth_enabled); 1347 bios_set_state(BLUETOOTH, bluetooth_enabled);
1307 } 1348 }
1308 1349
1309 wistron_led_init(&dev->dev); 1350 wistron_led_init(&dev->dev);
1351
1310 err = setup_input_dev(); 1352 err = setup_input_dev();
1311 if (err) { 1353 if (err) {
1312 bios_detach(); 1354 bios_detach();
@@ -1327,7 +1369,7 @@ static int __devexit wistron_remove(struct platform_device *dev)
1327} 1369}
1328 1370
1329#ifdef CONFIG_PM 1371#ifdef CONFIG_PM
1330static int wistron_suspend(struct platform_device *dev, pm_message_t state) 1372static int wistron_suspend(struct device *dev)
1331{ 1373{
1332 if (have_wifi) 1374 if (have_wifi)
1333 bios_set_state(WIFI, 0); 1375 bios_set_state(WIFI, 0);
@@ -1336,10 +1378,11 @@ static int wistron_suspend(struct platform_device *dev, pm_message_t state)
1336 bios_set_state(BLUETOOTH, 0); 1378 bios_set_state(BLUETOOTH, 0);
1337 1379
1338 wistron_led_suspend(); 1380 wistron_led_suspend();
1381
1339 return 0; 1382 return 0;
1340} 1383}
1341 1384
1342static int wistron_resume(struct platform_device *dev) 1385static int wistron_resume(struct device *dev)
1343{ 1386{
1344 if (have_wifi) 1387 if (have_wifi)
1345 bios_set_state(WIFI, wifi_enabled); 1388 bios_set_state(WIFI, wifi_enabled);
@@ -1348,24 +1391,30 @@ static int wistron_resume(struct platform_device *dev)
1348 bios_set_state(BLUETOOTH, bluetooth_enabled); 1391 bios_set_state(BLUETOOTH, bluetooth_enabled);
1349 1392
1350 wistron_led_resume(); 1393 wistron_led_resume();
1394
1351 poll_bios(true); 1395 poll_bios(true);
1352 1396
1353 return 0; 1397 return 0;
1354} 1398}
1355#else 1399
1356#define wistron_suspend NULL 1400static const struct dev_pm_ops wistron_pm_ops = {
1357#define wistron_resume NULL 1401 .suspend = wistron_suspend,
1402 .resume = wistron_resume,
1403 .poweroff = wistron_suspend,
1404 .restore = wistron_resume,
1405};
1358#endif 1406#endif
1359 1407
1360static struct platform_driver wistron_driver = { 1408static struct platform_driver wistron_driver = {
1361 .driver = { 1409 .driver = {
1362 .name = "wistron-bios", 1410 .name = "wistron-bios",
1363 .owner = THIS_MODULE, 1411 .owner = THIS_MODULE,
1412#if CONFIG_PM
1413 .pm = &wistron_pm_ops,
1414#endif
1364 }, 1415 },
1365 .probe = wistron_probe, 1416 .probe = wistron_probe,
1366 .remove = __devexit_p(wistron_remove), 1417 .remove = __devexit_p(wistron_remove),
1367 .suspend = wistron_suspend,
1368 .resume = wistron_resume,
1369}; 1418};
1370 1419
1371static int __init wb_module_init(void) 1420static int __init wb_module_init(void)