aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2009-06-24 01:22:20 -0400
committerLen Brown <len.brown@intel.com>2009-06-24 01:22:20 -0400
commit57599cc997b81a7c4f764693a7316886a72067fe (patch)
tree2e5cd27682614c88ec72009f9605062ada6eae25 /drivers/platform
parentfbe8cddd2d85979d273d7937a2b8a47498694d91 (diff)
parent586caae36cece718ff46b3a59b88af79e9f7a2e0 (diff)
Merge branch 'bjorn-notify' into release
Conflicts: drivers/platform/x86/eeepc-laptop.c Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/asus-laptop.c23
-rw-r--r--drivers/platform/x86/asus_acpi.c30
-rw-r--r--drivers/platform/x86/eeepc-laptop.c18
3 files changed, 24 insertions, 47 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index bfc1a8892a3..eaffe732653 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -207,13 +207,17 @@ MODULE_DEVICE_TABLE(acpi, asus_device_ids);
207 207
208static int asus_hotk_add(struct acpi_device *device); 208static int asus_hotk_add(struct acpi_device *device);
209static int asus_hotk_remove(struct acpi_device *device, int type); 209static int asus_hotk_remove(struct acpi_device *device, int type);
210static void asus_hotk_notify(struct acpi_device *device, u32 event);
211
210static struct acpi_driver asus_hotk_driver = { 212static struct acpi_driver asus_hotk_driver = {
211 .name = ASUS_HOTK_NAME, 213 .name = ASUS_HOTK_NAME,
212 .class = ASUS_HOTK_CLASS, 214 .class = ASUS_HOTK_CLASS,
213 .ids = asus_device_ids, 215 .ids = asus_device_ids,
216 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
214 .ops = { 217 .ops = {
215 .add = asus_hotk_add, 218 .add = asus_hotk_add,
216 .remove = asus_hotk_remove, 219 .remove = asus_hotk_remove,
220 .notify = asus_hotk_notify,
217 }, 221 },
218}; 222};
219 223
@@ -812,7 +816,7 @@ static int asus_setkeycode(struct input_dev *dev, int scancode, int keycode)
812 return -EINVAL; 816 return -EINVAL;
813} 817}
814 818
815static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 819static void asus_hotk_notify(struct acpi_device *device, u32 event)
816{ 820{
817 static struct key_entry *key; 821 static struct key_entry *key;
818 u16 count; 822 u16 count;
@@ -1124,7 +1128,6 @@ static int asus_hotk_found;
1124 1128
1125static int asus_hotk_add(struct acpi_device *device) 1129static int asus_hotk_add(struct acpi_device *device)
1126{ 1130{
1127 acpi_status status = AE_OK;
1128 int result; 1131 int result;
1129 1132
1130 if (!device) 1133 if (!device)
@@ -1149,15 +1152,6 @@ static int asus_hotk_add(struct acpi_device *device)
1149 1152
1150 asus_hotk_add_fs(); 1153 asus_hotk_add_fs();
1151 1154
1152 /*
1153 * We install the handler, it will receive the hotk in parameter, so, we
1154 * could add other data to the hotk struct
1155 */
1156 status = acpi_install_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
1157 asus_hotk_notify, hotk);
1158 if (ACPI_FAILURE(status))
1159 printk(ASUS_ERR "Error installing notify handler\n");
1160
1161 asus_hotk_found = 1; 1155 asus_hotk_found = 1;
1162 1156
1163 /* WLED and BLED are on by default */ 1157 /* WLED and BLED are on by default */
@@ -1198,16 +1192,9 @@ end:
1198 1192
1199static int asus_hotk_remove(struct acpi_device *device, int type) 1193static int asus_hotk_remove(struct acpi_device *device, int type)
1200{ 1194{
1201 acpi_status status = 0;
1202
1203 if (!device || !acpi_driver_data(device)) 1195 if (!device || !acpi_driver_data(device))
1204 return -EINVAL; 1196 return -EINVAL;
1205 1197
1206 status = acpi_remove_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
1207 asus_hotk_notify);
1208 if (ACPI_FAILURE(status))
1209 printk(ASUS_ERR "Error removing notify handler\n");
1210
1211 kfree(hotk->name); 1198 kfree(hotk->name);
1212 kfree(hotk); 1199 kfree(hotk);
1213 1200
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c
index ba1f7497e4b..ddf5240ade8 100644
--- a/drivers/platform/x86/asus_acpi.c
+++ b/drivers/platform/x86/asus_acpi.c
@@ -455,6 +455,8 @@ static struct asus_hotk *hotk;
455 */ 455 */
456static int asus_hotk_add(struct acpi_device *device); 456static int asus_hotk_add(struct acpi_device *device);
457static int asus_hotk_remove(struct acpi_device *device, int type); 457static int asus_hotk_remove(struct acpi_device *device, int type);
458static void asus_hotk_notify(struct acpi_device *device, u32 event);
459
458static const struct acpi_device_id asus_device_ids[] = { 460static const struct acpi_device_id asus_device_ids[] = {
459 {"ATK0100", 0}, 461 {"ATK0100", 0},
460 {"", 0}, 462 {"", 0},
@@ -465,9 +467,11 @@ static struct acpi_driver asus_hotk_driver = {
465 .name = "asus_acpi", 467 .name = "asus_acpi",
466 .class = ACPI_HOTK_CLASS, 468 .class = ACPI_HOTK_CLASS,
467 .ids = asus_device_ids, 469 .ids = asus_device_ids,
470 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
468 .ops = { 471 .ops = {
469 .add = asus_hotk_add, 472 .add = asus_hotk_add,
470 .remove = asus_hotk_remove, 473 .remove = asus_hotk_remove,
474 .notify = asus_hotk_notify,
471 }, 475 },
472}; 476};
473 477
@@ -1101,12 +1105,20 @@ static int asus_hotk_remove_fs(struct acpi_device *device)
1101 return 0; 1105 return 0;
1102} 1106}
1103 1107
1104static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 1108static void asus_hotk_notify(struct acpi_device *device, u32 event)
1105{ 1109{
1106 /* TODO Find a better way to handle events count. */ 1110 /* TODO Find a better way to handle events count. */
1107 if (!hotk) 1111 if (!hotk)
1108 return; 1112 return;
1109 1113
1114 /*
1115 * The BIOS *should* be sending us device events, but apparently
1116 * Asus uses system events instead, so just ignore any device
1117 * events we get.
1118 */
1119 if (event > ACPI_MAX_SYS_NOTIFY)
1120 return;
1121
1110 if ((event & ~((u32) BR_UP)) < 16) 1122 if ((event & ~((u32) BR_UP)) < 16)
1111 hotk->brightness = (event & ~((u32) BR_UP)); 1123 hotk->brightness = (event & ~((u32) BR_UP));
1112 else if ((event & ~((u32) BR_DOWN)) < 16) 1124 else if ((event & ~((u32) BR_DOWN)) < 16)
@@ -1346,15 +1358,6 @@ static int asus_hotk_add(struct acpi_device *device)
1346 if (result) 1358 if (result)
1347 goto end; 1359 goto end;
1348 1360
1349 /*
1350 * We install the handler, it will receive the hotk in parameter, so, we
1351 * could add other data to the hotk struct
1352 */
1353 status = acpi_install_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY,
1354 asus_hotk_notify, hotk);
1355 if (ACPI_FAILURE(status))
1356 printk(KERN_ERR " Error installing notify handler\n");
1357
1358 /* For laptops without GPLV: init the hotk->brightness value */ 1361 /* For laptops without GPLV: init the hotk->brightness value */
1359 if ((!hotk->methods->brightness_get) 1362 if ((!hotk->methods->brightness_get)
1360 && (!hotk->methods->brightness_status) 1363 && (!hotk->methods->brightness_status)
@@ -1389,16 +1392,9 @@ end:
1389 1392
1390static int asus_hotk_remove(struct acpi_device *device, int type) 1393static int asus_hotk_remove(struct acpi_device *device, int type)
1391{ 1394{
1392 acpi_status status = 0;
1393
1394 if (!device || !acpi_driver_data(device)) 1395 if (!device || !acpi_driver_data(device))
1395 return -EINVAL; 1396 return -EINVAL;
1396 1397
1397 status = acpi_remove_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY,
1398 asus_hotk_notify);
1399 if (ACPI_FAILURE(status))
1400 printk(KERN_ERR "Asus ACPI: Error removing notify handler\n");
1401
1402 asus_hotk_remove_fs(device); 1398 asus_hotk_remove_fs(device);
1403 1399
1404 kfree(hotk); 1400 kfree(hotk);
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 8153b3e5918..46b5aa5e85f 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -181,6 +181,7 @@ static struct key_entry eeepc_keymap[] = {
181static int eeepc_hotk_add(struct acpi_device *device); 181static int eeepc_hotk_add(struct acpi_device *device);
182static int eeepc_hotk_remove(struct acpi_device *device, int type); 182static int eeepc_hotk_remove(struct acpi_device *device, int type);
183static int eeepc_hotk_resume(struct acpi_device *device); 183static int eeepc_hotk_resume(struct acpi_device *device);
184static void eeepc_hotk_notify(struct acpi_device *device, u32 event);
184 185
185static const struct acpi_device_id eeepc_device_ids[] = { 186static const struct acpi_device_id eeepc_device_ids[] = {
186 {EEEPC_HOTK_HID, 0}, 187 {EEEPC_HOTK_HID, 0},
@@ -192,10 +193,12 @@ static struct acpi_driver eeepc_hotk_driver = {
192 .name = EEEPC_HOTK_NAME, 193 .name = EEEPC_HOTK_NAME,
193 .class = EEEPC_HOTK_CLASS, 194 .class = EEEPC_HOTK_CLASS,
194 .ids = eeepc_device_ids, 195 .ids = eeepc_device_ids,
196 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
195 .ops = { 197 .ops = {
196 .add = eeepc_hotk_add, 198 .add = eeepc_hotk_add,
197 .remove = eeepc_hotk_remove, 199 .remove = eeepc_hotk_remove,
198 .resume = eeepc_hotk_resume, 200 .resume = eeepc_hotk_resume,
201 .notify = eeepc_hotk_notify,
199 }, 202 },
200}; 203};
201 204
@@ -558,7 +561,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
558 eeepc_rfkill_hotplug(); 561 eeepc_rfkill_hotplug();
559} 562}
560 563
561static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) 564static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
562{ 565{
563 static struct key_entry *key; 566 static struct key_entry *key;
564 u16 count; 567 u16 count;
@@ -566,6 +569,8 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
566 569
567 if (!ehotk) 570 if (!ehotk)
568 return; 571 return;
572 if (event > ACPI_MAX_SYS_NOTIFY)
573 return;
569 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) 574 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
570 brn = notify_brn(); 575 brn = notify_brn();
571 count = ehotk->event_count[event % 128]++; 576 count = ehotk->event_count[event % 128]++;
@@ -646,7 +651,6 @@ static void eeepc_unregister_rfkill_notifier(char *node)
646 651
647static int eeepc_hotk_add(struct acpi_device *device) 652static int eeepc_hotk_add(struct acpi_device *device)
648{ 653{
649 acpi_status status = AE_OK;
650 int result; 654 int result;
651 655
652 if (!device) 656 if (!device)
@@ -664,10 +668,6 @@ static int eeepc_hotk_add(struct acpi_device *device)
664 result = eeepc_hotk_check(); 668 result = eeepc_hotk_check();
665 if (result) 669 if (result)
666 goto ehotk_fail; 670 goto ehotk_fail;
667 status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
668 eeepc_hotk_notify, ehotk);
669 if (ACPI_FAILURE(status))
670 printk(EEEPC_ERR "Error installing notify handler\n");
671 671
672 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); 672 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
673 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); 673 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
@@ -725,14 +725,8 @@ static int eeepc_hotk_add(struct acpi_device *device)
725 725
726static int eeepc_hotk_remove(struct acpi_device *device, int type) 726static int eeepc_hotk_remove(struct acpi_device *device, int type)
727{ 727{
728 acpi_status status = 0;
729
730 if (!device || !acpi_driver_data(device)) 728 if (!device || !acpi_driver_data(device))
731 return -EINVAL; 729 return -EINVAL;
732 status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
733 eeepc_hotk_notify);
734 if (ACPI_FAILURE(status))
735 printk(EEEPC_ERR "Error removing notify handler\n");
736 730
737 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6"); 731 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
738 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7"); 732 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");