diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 14 | ||||
-rw-r--r-- | drivers/acpi/ac.c | 5 | ||||
-rw-r--r-- | drivers/acpi/asus_acpi.c | 2 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 52 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 10 | ||||
-rw-r--r-- | drivers/acpi/button.c | 2 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 47 | ||||
-rw-r--r-- | drivers/acpi/event.c | 22 | ||||
-rw-r--r-- | drivers/acpi/hardware/hwsleep.c | 19 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfeval.c | 2 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 13 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 3 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 5 | ||||
-rw-r--r-- | drivers/acpi/sleep/main.c | 2 | ||||
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 71 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 67 | ||||
-rw-r--r-- | drivers/acpi/utilities/utglobal.c | 1 | ||||
-rw-r--r-- | drivers/acpi/video.c | 101 |
18 files changed, 354 insertions, 84 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index f1372de4ce79..574259476fbf 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -68,6 +68,20 @@ config ACPI_PROCFS | |||
68 | 68 | ||
69 | Say N to delete /proc/acpi/ files that have moved to /sys/ | 69 | Say N to delete /proc/acpi/ files that have moved to /sys/ |
70 | 70 | ||
71 | config ACPI_PROC_EVENT | ||
72 | bool "Deprecated /proc/acpi/event support" | ||
73 | depends on PROC_FS | ||
74 | ---help--- | ||
75 | A user-space daemon, acpi, typically read /proc/acpi/event | ||
76 | and handled all ACPI sub-system generated events. | ||
77 | |||
78 | These events are now delivered to user-space via | ||
79 | either the input layer, or as netlink events. | ||
80 | |||
81 | This build option enables the old code for for legacy | ||
82 | user-space implementation. After some time, this will | ||
83 | be moved under CONFIG_ACPI_PROCFS, and then deleted. | ||
84 | |||
71 | config ACPI_AC | 85 | config ACPI_AC |
72 | tristate "AC Adapter" | 86 | tristate "AC Adapter" |
73 | depends on X86 | 87 | depends on X86 |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index d8b35093527a..26d70702b313 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -204,7 +204,10 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) | |||
204 | case ACPI_NOTIFY_BUS_CHECK: | 204 | case ACPI_NOTIFY_BUS_CHECK: |
205 | case ACPI_NOTIFY_DEVICE_CHECK: | 205 | case ACPI_NOTIFY_DEVICE_CHECK: |
206 | acpi_ac_get_state(ac); | 206 | acpi_ac_get_state(ac); |
207 | acpi_bus_generate_event(device, event, (u32) ac->state); | 207 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); |
208 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
209 | device->dev.bus_id, event, | ||
210 | (u32) ac->state); | ||
208 | break; | 211 | break; |
209 | default: | 212 | default: |
210 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 213 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 86fd142f4bf3..d915fec9bf63 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -1069,7 +1069,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) | |||
1069 | hotk->brightness = (event & ~((u32) BR_DOWN)); | 1069 | hotk->brightness = (event & ~((u32) BR_DOWN)); |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | acpi_bus_generate_event(hotk->device, event, | 1072 | acpi_bus_generate_proc_event(hotk->device, event, |
1073 | hotk->event_count[event % 128]++); | 1073 | hotk->event_count[event % 128]++); |
1074 | 1074 | ||
1075 | return; | 1075 | return; |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index d7b499fe0cd9..9b2c0f74f869 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -113,7 +113,7 @@ struct acpi_battery_info { | |||
113 | acpi_string oem_info; | 113 | acpi_string oem_info; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | enum acpi_battery_files { | 116 | enum acpi_battery_files{ |
117 | ACPI_BATTERY_INFO = 0, | 117 | ACPI_BATTERY_INFO = 0, |
118 | ACPI_BATTERY_STATE, | 118 | ACPI_BATTERY_STATE, |
119 | ACPI_BATTERY_ALARM, | 119 | ACPI_BATTERY_ALARM, |
@@ -129,14 +129,13 @@ struct acpi_battery_flags { | |||
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct acpi_battery { | 131 | struct acpi_battery { |
132 | struct mutex mutex; | ||
132 | struct acpi_device *device; | 133 | struct acpi_device *device; |
133 | struct acpi_battery_flags flags; | 134 | struct acpi_battery_flags flags; |
134 | struct acpi_buffer bif_data; | 135 | struct acpi_buffer bif_data; |
135 | struct acpi_buffer bst_data; | 136 | struct acpi_buffer bst_data; |
136 | struct mutex lock; | ||
137 | unsigned long alarm; | 137 | unsigned long alarm; |
138 | unsigned long update_time[ACPI_BATTERY_NUMFILES]; | 138 | unsigned long update_time[ACPI_BATTERY_NUMFILES]; |
139 | |||
140 | }; | 139 | }; |
141 | 140 | ||
142 | inline int acpi_battery_present(struct acpi_battery *battery) | 141 | inline int acpi_battery_present(struct acpi_battery *battery) |
@@ -236,10 +235,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
236 | return 0; | 235 | return 0; |
237 | 236 | ||
238 | /* Evaluate _BIF */ | 237 | /* Evaluate _BIF */ |
239 | mutex_lock(&battery->lock); | 238 | |
240 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", | 239 | status = |
241 | NULL, &buffer); | 240 | acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, |
242 | mutex_unlock(&battery->lock); | 241 | &buffer); |
243 | if (ACPI_FAILURE(status)) { | 242 | if (ACPI_FAILURE(status)) { |
244 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); | 243 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); |
245 | return -ENODEV; | 244 | return -ENODEV; |
@@ -286,10 +285,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
286 | return 0; | 285 | return 0; |
287 | 286 | ||
288 | /* Evaluate _BST */ | 287 | /* Evaluate _BST */ |
289 | mutex_lock(&battery->lock); | 288 | |
290 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST", | 289 | status = |
291 | NULL, &buffer); | 290 | acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, |
292 | mutex_unlock(&battery->lock); | 291 | &buffer); |
293 | if (ACPI_FAILURE(status)) { | 292 | if (ACPI_FAILURE(status)) { |
294 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); | 293 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); |
295 | return -ENODEV; | 294 | return -ENODEV; |
@@ -337,10 +336,9 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery, | |||
337 | 336 | ||
338 | arg0.integer.value = alarm; | 337 | arg0.integer.value = alarm; |
339 | 338 | ||
340 | mutex_lock(&battery->lock); | 339 | status = |
341 | status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", | 340 | acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", |
342 | &arg_list, NULL); | 341 | &arg_list, NULL); |
343 | mutex_unlock(&battery->lock); | ||
344 | if (ACPI_FAILURE(status)) | 342 | if (ACPI_FAILURE(status)) |
345 | return -ENODEV; | 343 | return -ENODEV; |
346 | 344 | ||
@@ -660,6 +658,8 @@ acpi_battery_write_alarm(struct file *file, | |||
660 | if (!battery || (count > sizeof(alarm_string) - 1)) | 658 | if (!battery || (count > sizeof(alarm_string) - 1)) |
661 | return -EINVAL; | 659 | return -EINVAL; |
662 | 660 | ||
661 | mutex_lock(&battery->mutex); | ||
662 | |||
663 | result = acpi_battery_update(battery, 1, &update_result); | 663 | result = acpi_battery_update(battery, 1, &update_result); |
664 | if (result) { | 664 | if (result) { |
665 | result = -ENODEV; | 665 | result = -ENODEV; |
@@ -688,7 +688,9 @@ acpi_battery_write_alarm(struct file *file, | |||
688 | acpi_battery_check_result(battery, result); | 688 | acpi_battery_check_result(battery, result); |
689 | 689 | ||
690 | if (!result) | 690 | if (!result) |
691 | return count; | 691 | result = count; |
692 | |||
693 | mutex_unlock(&battery->mutex); | ||
692 | 694 | ||
693 | return result; | 695 | return result; |
694 | } | 696 | } |
@@ -712,6 +714,8 @@ static int acpi_battery_read(int fid, struct seq_file *seq) | |||
712 | int update_result = ACPI_BATTERY_NONE_UPDATE; | 714 | int update_result = ACPI_BATTERY_NONE_UPDATE; |
713 | int update = 0; | 715 | int update = 0; |
714 | 716 | ||
717 | mutex_lock(&battery->mutex); | ||
718 | |||
715 | update = (get_seconds() - battery->update_time[fid] >= update_time); | 719 | update = (get_seconds() - battery->update_time[fid] >= update_time); |
716 | update = (update | battery->flags.update[fid]); | 720 | update = (update | battery->flags.update[fid]); |
717 | 721 | ||
@@ -729,6 +733,7 @@ static int acpi_battery_read(int fid, struct seq_file *seq) | |||
729 | result = acpi_read_funcs[fid].print(seq, result); | 733 | result = acpi_read_funcs[fid].print(seq, result); |
730 | acpi_battery_check_result(battery, result); | 734 | acpi_battery_check_result(battery, result); |
731 | battery->flags.update[fid] = result; | 735 | battery->flags.update[fid] = result; |
736 | mutex_unlock(&battery->mutex); | ||
732 | return result; | 737 | return result; |
733 | } | 738 | } |
734 | 739 | ||
@@ -867,8 +872,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
867 | case ACPI_NOTIFY_DEVICE_CHECK: | 872 | case ACPI_NOTIFY_DEVICE_CHECK: |
868 | device = battery->device; | 873 | device = battery->device; |
869 | acpi_battery_notify_update(battery); | 874 | acpi_battery_notify_update(battery); |
870 | acpi_bus_generate_event(device, event, | 875 | acpi_bus_generate_proc_event(device, event, |
871 | acpi_battery_present(battery)); | 876 | acpi_battery_present(battery)); |
877 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
878 | device->dev.bus_id, event, | ||
879 | acpi_battery_present(battery)); | ||
872 | break; | 880 | break; |
873 | default: | 881 | default: |
874 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 882 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -892,7 +900,10 @@ static int acpi_battery_add(struct acpi_device *device) | |||
892 | if (!battery) | 900 | if (!battery) |
893 | return -ENOMEM; | 901 | return -ENOMEM; |
894 | 902 | ||
895 | mutex_init(&battery->lock); | 903 | mutex_init(&battery->mutex); |
904 | |||
905 | mutex_lock(&battery->mutex); | ||
906 | |||
896 | battery->device = device; | 907 | battery->device = device; |
897 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); | 908 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); |
898 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 909 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
@@ -928,6 +939,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
928 | kfree(battery); | 939 | kfree(battery); |
929 | } | 940 | } |
930 | 941 | ||
942 | mutex_unlock(&battery->mutex); | ||
931 | 943 | ||
932 | return result; | 944 | return result; |
933 | } | 945 | } |
@@ -942,6 +954,8 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
942 | 954 | ||
943 | battery = acpi_driver_data(device); | 955 | battery = acpi_driver_data(device); |
944 | 956 | ||
957 | mutex_lock(&battery->mutex); | ||
958 | |||
945 | status = acpi_remove_notify_handler(device->handle, | 959 | status = acpi_remove_notify_handler(device->handle, |
946 | ACPI_ALL_NOTIFY, | 960 | ACPI_ALL_NOTIFY, |
947 | acpi_battery_notify); | 961 | acpi_battery_notify); |
@@ -952,7 +966,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
952 | 966 | ||
953 | kfree(battery->bst_data.pointer); | 967 | kfree(battery->bst_data.pointer); |
954 | 968 | ||
955 | mutex_destroy(&battery->lock); | 969 | mutex_unlock(&battery->mutex); |
970 | |||
971 | mutex_destroy(&battery->mutex); | ||
956 | 972 | ||
957 | kfree(battery); | 973 | kfree(battery); |
958 | 974 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 6b2658c96242..9ba778a2b484 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -276,6 +276,7 @@ EXPORT_SYMBOL(acpi_bus_set_power); | |||
276 | Event Management | 276 | Event Management |
277 | -------------------------------------------------------------------------- */ | 277 | -------------------------------------------------------------------------- */ |
278 | 278 | ||
279 | #ifdef CONFIG_ACPI_PROC_EVENT | ||
279 | static DEFINE_SPINLOCK(acpi_bus_event_lock); | 280 | static DEFINE_SPINLOCK(acpi_bus_event_lock); |
280 | 281 | ||
281 | LIST_HEAD(acpi_bus_event_list); | 282 | LIST_HEAD(acpi_bus_event_list); |
@@ -283,7 +284,7 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue); | |||
283 | 284 | ||
284 | extern int event_is_open; | 285 | extern int event_is_open; |
285 | 286 | ||
286 | int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) | 287 | int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) |
287 | { | 288 | { |
288 | struct acpi_bus_event *event = NULL; | 289 | struct acpi_bus_event *event = NULL; |
289 | unsigned long flags = 0; | 290 | unsigned long flags = 0; |
@@ -292,10 +293,6 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) | |||
292 | if (!device) | 293 | if (!device) |
293 | return -EINVAL; | 294 | return -EINVAL; |
294 | 295 | ||
295 | if (acpi_bus_generate_genetlink_event(device, type, data)) | ||
296 | printk(KERN_WARNING PREFIX | ||
297 | "Failed to generate an ACPI event via genetlink!\n"); | ||
298 | |||
299 | /* drop event on the floor if no one's listening */ | 296 | /* drop event on the floor if no one's listening */ |
300 | if (!event_is_open) | 297 | if (!event_is_open) |
301 | return 0; | 298 | return 0; |
@@ -318,7 +315,7 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) | |||
318 | return 0; | 315 | return 0; |
319 | } | 316 | } |
320 | 317 | ||
321 | EXPORT_SYMBOL(acpi_bus_generate_event); | 318 | EXPORT_SYMBOL(acpi_bus_generate_proc_event); |
322 | 319 | ||
323 | int acpi_bus_receive_event(struct acpi_bus_event *event) | 320 | int acpi_bus_receive_event(struct acpi_bus_event *event) |
324 | { | 321 | { |
@@ -364,6 +361,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) | |||
364 | } | 361 | } |
365 | 362 | ||
366 | EXPORT_SYMBOL(acpi_bus_receive_event); | 363 | EXPORT_SYMBOL(acpi_bus_receive_event); |
364 | #endif /* CONFIG_ACPI_PROC_EVENT */ | ||
367 | 365 | ||
368 | /* -------------------------------------------------------------------------- | 366 | /* -------------------------------------------------------------------------- |
369 | Notification Handling | 367 | Notification Handling |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 540581338ef5..2e79a3395ecf 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -284,7 +284,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) | |||
284 | } | 284 | } |
285 | input_sync(input); | 285 | input_sync(input); |
286 | 286 | ||
287 | acpi_bus_generate_event(button->device, event, | 287 | acpi_bus_generate_proc_event(button->device, event, |
288 | ++button->pushed); | 288 | ++button->pushed); |
289 | break; | 289 | break; |
290 | default: | 290 | default: |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 56bee9e065cf..43749c86861f 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -696,14 +696,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | |||
696 | return AE_CTRL_TERMINATE; | 696 | return AE_CTRL_TERMINATE; |
697 | } | 697 | } |
698 | 698 | ||
699 | static void ec_remove_handlers(struct acpi_ec *ec) | ||
700 | { | ||
701 | acpi_remove_address_space_handler(ec->handle, | ||
702 | ACPI_ADR_SPACE_EC, | ||
703 | &acpi_ec_space_handler); | ||
704 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | ||
705 | } | ||
706 | |||
707 | static int acpi_ec_add(struct acpi_device *device) | 699 | static int acpi_ec_add(struct acpi_device *device) |
708 | { | 700 | { |
709 | struct acpi_ec *ec = NULL; | 701 | struct acpi_ec *ec = NULL; |
@@ -727,13 +719,16 @@ static int acpi_ec_add(struct acpi_device *device) | |||
727 | /* Check if we found the boot EC */ | 719 | /* Check if we found the boot EC */ |
728 | if (boot_ec) { | 720 | if (boot_ec) { |
729 | if (boot_ec->gpe == ec->gpe) { | 721 | if (boot_ec->gpe == ec->gpe) { |
730 | ec_remove_handlers(boot_ec); | 722 | /* We might have incorrect info for GL at boot time */ |
731 | mutex_destroy(&boot_ec->lock); | 723 | mutex_lock(&boot_ec->lock); |
732 | kfree(boot_ec); | 724 | boot_ec->global_lock = ec->global_lock; |
733 | first_ec = boot_ec = NULL; | 725 | /* Copy handlers from new ec into boot ec */ |
726 | list_splice(&ec->list, &boot_ec->list); | ||
727 | mutex_unlock(&boot_ec->lock); | ||
728 | kfree(ec); | ||
729 | ec = boot_ec; | ||
734 | } | 730 | } |
735 | } | 731 | } else |
736 | if (!first_ec) | ||
737 | first_ec = ec; | 732 | first_ec = ec; |
738 | ec->handle = device->handle; | 733 | ec->handle = device->handle; |
739 | acpi_driver_data(device) = ec; | 734 | acpi_driver_data(device) = ec; |
@@ -762,6 +757,9 @@ static int acpi_ec_remove(struct acpi_device *device, int type) | |||
762 | if (ec == first_ec) | 757 | if (ec == first_ec) |
763 | first_ec = NULL; | 758 | first_ec = NULL; |
764 | 759 | ||
760 | /* Don't touch boot EC */ | ||
761 | if (boot_ec != ec) | ||
762 | kfree(ec); | ||
765 | return 0; | 763 | return 0; |
766 | } | 764 | } |
767 | 765 | ||
@@ -825,7 +823,9 @@ static int acpi_ec_start(struct acpi_device *device) | |||
825 | if (!ec) | 823 | if (!ec) |
826 | return -EINVAL; | 824 | return -EINVAL; |
827 | 825 | ||
828 | ret = ec_install_handlers(ec); | 826 | /* Boot EC is already working */ |
827 | if (ec != boot_ec) | ||
828 | ret = ec_install_handlers(ec); | ||
829 | 829 | ||
830 | /* EC is fully operational, allow queries */ | 830 | /* EC is fully operational, allow queries */ |
831 | atomic_set(&ec->query_pending, 0); | 831 | atomic_set(&ec->query_pending, 0); |
@@ -835,6 +835,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
835 | 835 | ||
836 | static int acpi_ec_stop(struct acpi_device *device, int type) | 836 | static int acpi_ec_stop(struct acpi_device *device, int type) |
837 | { | 837 | { |
838 | acpi_status status; | ||
838 | struct acpi_ec *ec; | 839 | struct acpi_ec *ec; |
839 | 840 | ||
840 | if (!device) | 841 | if (!device) |
@@ -843,7 +844,21 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
843 | ec = acpi_driver_data(device); | 844 | ec = acpi_driver_data(device); |
844 | if (!ec) | 845 | if (!ec) |
845 | return -EINVAL; | 846 | return -EINVAL; |
846 | ec_remove_handlers(ec); | 847 | |
848 | /* Don't touch boot EC */ | ||
849 | if (ec == boot_ec) | ||
850 | return 0; | ||
851 | |||
852 | status = acpi_remove_address_space_handler(ec->handle, | ||
853 | ACPI_ADR_SPACE_EC, | ||
854 | &acpi_ec_space_handler); | ||
855 | if (ACPI_FAILURE(status)) | ||
856 | return -ENODEV; | ||
857 | |||
858 | status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | ||
859 | if (ACPI_FAILURE(status)) | ||
860 | return -ENODEV; | ||
861 | |||
847 | return 0; | 862 | return 0; |
848 | } | 863 | } |
849 | 864 | ||
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index 95637a4ff782..a2b9304596ce 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 17 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
18 | ACPI_MODULE_NAME("event"); | 18 | ACPI_MODULE_NAME("event"); |
19 | 19 | ||
20 | #ifdef CONFIG_ACPI_PROC_EVENT | ||
20 | /* Global vars for handling event proc entry */ | 21 | /* Global vars for handling event proc entry */ |
21 | static DEFINE_SPINLOCK(acpi_system_event_lock); | 22 | static DEFINE_SPINLOCK(acpi_system_event_lock); |
22 | int event_is_open = 0; | 23 | int event_is_open = 0; |
@@ -106,6 +107,7 @@ static const struct file_operations acpi_system_event_ops = { | |||
106 | .release = acpi_system_close_event, | 107 | .release = acpi_system_close_event, |
107 | .poll = acpi_system_poll_event, | 108 | .poll = acpi_system_poll_event, |
108 | }; | 109 | }; |
110 | #endif /* CONFIG_ACPI_PROC_EVENT */ | ||
109 | 111 | ||
110 | #ifdef CONFIG_NET | 112 | #ifdef CONFIG_NET |
111 | static unsigned int acpi_event_seqnum; | 113 | static unsigned int acpi_event_seqnum; |
@@ -147,7 +149,8 @@ static struct genl_multicast_group acpi_event_mcgrp = { | |||
147 | .name = ACPI_GENL_MCAST_GROUP_NAME, | 149 | .name = ACPI_GENL_MCAST_GROUP_NAME, |
148 | }; | 150 | }; |
149 | 151 | ||
150 | int acpi_bus_generate_genetlink_event(struct acpi_device *device, | 152 | int acpi_bus_generate_netlink_event(const char *device_class, |
153 | const char *bus_id, | ||
151 | u8 type, int data) | 154 | u8 type, int data) |
152 | { | 155 | { |
153 | struct sk_buff *skb; | 156 | struct sk_buff *skb; |
@@ -191,8 +194,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device, | |||
191 | 194 | ||
192 | memset(event, 0, sizeof(struct acpi_genl_event)); | 195 | memset(event, 0, sizeof(struct acpi_genl_event)); |
193 | 196 | ||
194 | strcpy(event->device_class, device->pnp.device_class); | 197 | strcpy(event->device_class, device_class); |
195 | strcpy(event->bus_id, device->dev.bus_id); | 198 | strcpy(event->bus_id, bus_id); |
196 | event->type = type; | 199 | event->type = type; |
197 | event->data = data; | 200 | event->data = data; |
198 | 201 | ||
@@ -211,6 +214,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device, | |||
211 | return 0; | 214 | return 0; |
212 | } | 215 | } |
213 | 216 | ||
217 | EXPORT_SYMBOL(acpi_bus_generate_netlink_event); | ||
218 | |||
214 | static int acpi_event_genetlink_init(void) | 219 | static int acpi_event_genetlink_init(void) |
215 | { | 220 | { |
216 | int result; | 221 | int result; |
@@ -228,12 +233,15 @@ static int acpi_event_genetlink_init(void) | |||
228 | } | 233 | } |
229 | 234 | ||
230 | #else | 235 | #else |
231 | int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type, | 236 | int acpi_bus_generate_netlink_event(const char *device_class, |
232 | int data) | 237 | const char *bus_id, |
238 | u8 type, int data) | ||
233 | { | 239 | { |
234 | return 0; | 240 | return 0; |
235 | } | 241 | } |
236 | 242 | ||
243 | EXPORT_SYMBOL(acpi_generate_netlink_event); | ||
244 | |||
237 | static int acpi_event_genetlink_init(void) | 245 | static int acpi_event_genetlink_init(void) |
238 | { | 246 | { |
239 | return -ENODEV; | 247 | return -ENODEV; |
@@ -242,7 +250,9 @@ static int acpi_event_genetlink_init(void) | |||
242 | 250 | ||
243 | static int __init acpi_event_init(void) | 251 | static int __init acpi_event_init(void) |
244 | { | 252 | { |
253 | #ifdef CONFIG_ACPI_PROC_EVENT | ||
245 | struct proc_dir_entry *entry; | 254 | struct proc_dir_entry *entry; |
255 | #endif | ||
246 | int error = 0; | 256 | int error = 0; |
247 | 257 | ||
248 | if (acpi_disabled) | 258 | if (acpi_disabled) |
@@ -254,12 +264,14 @@ static int __init acpi_event_init(void) | |||
254 | printk(KERN_WARNING PREFIX | 264 | printk(KERN_WARNING PREFIX |
255 | "Failed to create genetlink family for ACPI event\n"); | 265 | "Failed to create genetlink family for ACPI event\n"); |
256 | 266 | ||
267 | #ifdef CONFIG_ACPI_PROC_EVENT | ||
257 | /* 'event' [R] */ | 268 | /* 'event' [R] */ |
258 | entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); | 269 | entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); |
259 | if (entry) | 270 | if (entry) |
260 | entry->proc_fops = &acpi_system_event_ops; | 271 | entry->proc_fops = &acpi_system_event_ops; |
261 | else | 272 | else |
262 | return -ENODEV; | 273 | return -ENODEV; |
274 | #endif | ||
263 | 275 | ||
264 | return 0; | 276 | return 0; |
265 | } | 277 | } |
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 76c525dc590b..cf69c0040a39 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -576,13 +576,10 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
576 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); | 576 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); |
577 | } | 577 | } |
578 | 578 | ||
579 | status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); | ||
580 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
581 | ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK")); | ||
582 | } | ||
583 | /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ | ||
584 | |||
585 | /* | 579 | /* |
580 | * GPEs must be enabled before _WAK is called as GPEs | ||
581 | * might get fired there | ||
582 | * | ||
586 | * Restore the GPEs: | 583 | * Restore the GPEs: |
587 | * 1) Disable/Clear all GPEs | 584 | * 1) Disable/Clear all GPEs |
588 | * 2) Enable all runtime GPEs | 585 | * 2) Enable all runtime GPEs |
@@ -591,13 +588,19 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
591 | if (ACPI_FAILURE(status)) { | 588 | if (ACPI_FAILURE(status)) { |
592 | return_ACPI_STATUS(status); | 589 | return_ACPI_STATUS(status); |
593 | } | 590 | } |
594 | acpi_gbl_system_awake_and_running = TRUE; | ||
595 | |||
596 | status = acpi_hw_enable_all_runtime_gpes(); | 591 | status = acpi_hw_enable_all_runtime_gpes(); |
597 | if (ACPI_FAILURE(status)) { | 592 | if (ACPI_FAILURE(status)) { |
598 | return_ACPI_STATUS(status); | 593 | return_ACPI_STATUS(status); |
599 | } | 594 | } |
600 | 595 | ||
596 | status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); | ||
597 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
598 | ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK")); | ||
599 | } | ||
600 | /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ | ||
601 | |||
602 | acpi_gbl_system_awake_and_running = TRUE; | ||
603 | |||
601 | /* Enable power button */ | 604 | /* Enable power button */ |
602 | 605 | ||
603 | (void) | 606 | (void) |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index ab65b2c2560e..f39fbc6b9237 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -540,7 +540,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
540 | ******************************************************************************/ | 540 | ******************************************************************************/ |
541 | 541 | ||
542 | acpi_status | 542 | acpi_status |
543 | acpi_get_devices(char *HID, | 543 | acpi_get_devices(const char *HID, |
544 | acpi_walk_callback user_function, | 544 | acpi_walk_callback user_function, |
545 | void *context, void **return_value) | 545 | void *context, void **return_value) |
546 | { | 546 | { |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 498422343f38..e944aaee4e06 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -698,16 +698,23 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
698 | switch (event) { | 698 | switch (event) { |
699 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | 699 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: |
700 | acpi_processor_ppc_has_changed(pr); | 700 | acpi_processor_ppc_has_changed(pr); |
701 | acpi_bus_generate_event(device, event, | 701 | acpi_bus_generate_proc_event(device, event, |
702 | pr->performance_platform_limit); | 702 | pr->performance_platform_limit); |
703 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
704 | device->dev.bus_id, event, | ||
705 | pr->performance_platform_limit); | ||
703 | break; | 706 | break; |
704 | case ACPI_PROCESSOR_NOTIFY_POWER: | 707 | case ACPI_PROCESSOR_NOTIFY_POWER: |
705 | acpi_processor_cst_has_changed(pr); | 708 | acpi_processor_cst_has_changed(pr); |
706 | acpi_bus_generate_event(device, event, 0); | 709 | acpi_bus_generate_proc_event(device, event, 0); |
710 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
711 | device->dev.bus_id, event, 0); | ||
707 | break; | 712 | break; |
708 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | 713 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: |
709 | acpi_processor_tstate_has_changed(pr); | 714 | acpi_processor_tstate_has_changed(pr); |
710 | acpi_bus_generate_event(device, event, 0); | 715 | acpi_bus_generate_proc_event(device, event, 0); |
716 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
717 | device->dev.bus_id, event, 0); | ||
711 | default: | 718 | default: |
712 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 719 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
713 | "Unsupported event [0x%x]\n", event)); | 720 | "Unsupported event [0x%x]\n", event)); |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 82c3a550016d..a578986e3214 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -440,11 +440,12 @@ static int acpi_sbs_generate_event(struct acpi_device *device, | |||
440 | strcpy(acpi_device_bid(device), bid); | 440 | strcpy(acpi_device_bid(device), bid); |
441 | strcpy(acpi_device_class(device), class); | 441 | strcpy(acpi_device_class(device), class); |
442 | 442 | ||
443 | result = acpi_bus_generate_event(device, event, state); | 443 | result = acpi_bus_generate_proc_event(device, event, state); |
444 | 444 | ||
445 | strcpy(acpi_device_bid(device), bid_saved); | 445 | strcpy(acpi_device_bid(device), bid_saved); |
446 | strcpy(acpi_device_class(device), class_saved); | 446 | strcpy(acpi_device_class(device), class_saved); |
447 | 447 | ||
448 | acpi_bus_generate_netlink_event(class, bid, event, state); | ||
448 | return result; | 449 | return result; |
449 | } | 450 | } |
450 | 451 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index be74347d1354..64620d668742 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -35,8 +35,9 @@ struct acpi_device_bus_id{ | |||
35 | * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: | 35 | * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: |
36 | * char *modalias: "acpi:IBM0001:ACPI0001" | 36 | * char *modalias: "acpi:IBM0001:ACPI0001" |
37 | */ | 37 | */ |
38 | int create_modalias(struct acpi_device *acpi_dev, char *modalias, int size){ | 38 | static int create_modalias(struct acpi_device *acpi_dev, char *modalias, |
39 | 39 | int size) | |
40 | { | ||
40 | int len; | 41 | int len; |
41 | 42 | ||
42 | if (!acpi_dev->flags.hardware_id) | 43 | if (!acpi_dev->flags.hardware_id) |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index e8cff5dd4cbc..c52ade816fb4 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -305,7 +305,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) | |||
305 | unsigned long d_min, d_max; | 305 | unsigned long d_min, d_max; |
306 | 306 | ||
307 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | 307 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { |
308 | printk(KERN_ERR "ACPI handle has no context!\n"); | 308 | printk(KERN_DEBUG "ACPI handle has no context!\n"); |
309 | return -ENODEV; | 309 | return -ENODEV; |
310 | } | 310 | } |
311 | 311 | ||
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 1da64b4518c0..8cc9492ffbf2 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -51,6 +51,65 @@ ACPI_MODULE_NAME("tbutils") | |||
51 | static acpi_physical_address | 51 | static acpi_physical_address |
52 | acpi_tb_get_root_table_entry(u8 * table_entry, | 52 | acpi_tb_get_root_table_entry(u8 * table_entry, |
53 | acpi_native_uint table_entry_size); | 53 | acpi_native_uint table_entry_size); |
54 | /******************************************************************************* | ||
55 | * | ||
56 | * FUNCTION: acpi_tb_check_xsdt | ||
57 | * | ||
58 | * PARAMETERS: address - Pointer to the XSDT | ||
59 | * | ||
60 | * RETURN: status | ||
61 | * AE_OK - XSDT is okay | ||
62 | * AE_NO_MEMORY - can't map XSDT | ||
63 | * AE_INVALID_TABLE_LENGTH - invalid table length | ||
64 | * AE_NULL_ENTRY - XSDT has NULL entry | ||
65 | * | ||
66 | * DESCRIPTION: validate XSDT | ||
67 | ******************************************************************************/ | ||
68 | |||
69 | static acpi_status | ||
70 | acpi_tb_check_xsdt(acpi_physical_address address) | ||
71 | { | ||
72 | struct acpi_table_header *table; | ||
73 | u32 length; | ||
74 | u64 xsdt_entry_address; | ||
75 | u8 *table_entry; | ||
76 | u32 table_count; | ||
77 | int i; | ||
78 | |||
79 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); | ||
80 | if (!table) | ||
81 | return AE_NO_MEMORY; | ||
82 | |||
83 | length = table->length; | ||
84 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); | ||
85 | if (length < sizeof(struct acpi_table_header)) | ||
86 | return AE_INVALID_TABLE_LENGTH; | ||
87 | |||
88 | table = acpi_os_map_memory(address, length); | ||
89 | if (!table) | ||
90 | return AE_NO_MEMORY; | ||
91 | |||
92 | /* Calculate the number of tables described in XSDT */ | ||
93 | table_count = | ||
94 | (u32) ((table->length - | ||
95 | sizeof(struct acpi_table_header)) / sizeof(u64)); | ||
96 | table_entry = | ||
97 | ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header); | ||
98 | for (i = 0; i < table_count; i++) { | ||
99 | ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry); | ||
100 | if (!xsdt_entry_address) { | ||
101 | /* XSDT has NULL entry */ | ||
102 | break; | ||
103 | } | ||
104 | table_entry += sizeof(u64); | ||
105 | } | ||
106 | acpi_os_unmap_memory(table, length); | ||
107 | |||
108 | if (i < table_count) | ||
109 | return AE_NULL_ENTRY; | ||
110 | else | ||
111 | return AE_OK; | ||
112 | } | ||
54 | 113 | ||
55 | /******************************************************************************* | 114 | /******************************************************************************* |
56 | * | 115 | * |
@@ -341,6 +400,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | |||
341 | u32 table_count; | 400 | u32 table_count; |
342 | struct acpi_table_header *table; | 401 | struct acpi_table_header *table; |
343 | acpi_physical_address address; | 402 | acpi_physical_address address; |
403 | acpi_physical_address rsdt_address; | ||
344 | u32 length; | 404 | u32 length; |
345 | u8 *table_entry; | 405 | u8 *table_entry; |
346 | acpi_status status; | 406 | acpi_status status; |
@@ -369,6 +429,8 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | |||
369 | */ | 429 | */ |
370 | address = (acpi_physical_address) rsdp->xsdt_physical_address; | 430 | address = (acpi_physical_address) rsdp->xsdt_physical_address; |
371 | table_entry_size = sizeof(u64); | 431 | table_entry_size = sizeof(u64); |
432 | rsdt_address = (acpi_physical_address) | ||
433 | rsdp->rsdt_physical_address; | ||
372 | } else { | 434 | } else { |
373 | /* Root table is an RSDT (32-bit physical addresses) */ | 435 | /* Root table is an RSDT (32-bit physical addresses) */ |
374 | 436 | ||
@@ -382,6 +444,15 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | |||
382 | */ | 444 | */ |
383 | acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); | 445 | acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); |
384 | 446 | ||
447 | if (table_entry_size == sizeof(u64)) { | ||
448 | if (acpi_tb_check_xsdt(address) == AE_NULL_ENTRY) { | ||
449 | /* XSDT has NULL entry, RSDT is used */ | ||
450 | address = rsdt_address; | ||
451 | table_entry_size = sizeof(u32); | ||
452 | ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry," | ||
453 | "using RSDT")); | ||
454 | } | ||
455 | } | ||
385 | /* Map the RSDT/XSDT table header to get the full table length */ | 456 | /* Map the RSDT/XSDT table header to get the full table length */ |
386 | 457 | ||
387 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); | 458 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 1e06159fd9c4..bc6d5866ef98 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -77,23 +77,27 @@ MODULE_LICENSE("GPL"); | |||
77 | 77 | ||
78 | static int act; | 78 | static int act; |
79 | module_param(act, int, 0644); | 79 | module_param(act, int, 0644); |
80 | MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n"); | 80 | MODULE_PARM_DESC(act, "Disable or override all lowest active trip points."); |
81 | |||
82 | static int crt; | ||
83 | module_param(crt, int, 0644); | ||
84 | MODULE_PARM_DESC(crt, "Disable or lower all critical trip points."); | ||
81 | 85 | ||
82 | static int tzp; | 86 | static int tzp; |
83 | module_param(tzp, int, 0444); | 87 | module_param(tzp, int, 0444); |
84 | MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); | 88 | MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds."); |
85 | 89 | ||
86 | static int nocrt; | 90 | static int nocrt; |
87 | module_param(nocrt, int, 0); | 91 | module_param(nocrt, int, 0); |
88 | MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n"); | 92 | MODULE_PARM_DESC(nocrt, "Set to take no action upon ACPI thermal zone critical trips points."); |
89 | 93 | ||
90 | static int off; | 94 | static int off; |
91 | module_param(off, int, 0); | 95 | module_param(off, int, 0); |
92 | MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n"); | 96 | MODULE_PARM_DESC(off, "Set to disable ACPI thermal support."); |
93 | 97 | ||
94 | static int psv; | 98 | static int psv; |
95 | module_param(psv, int, 0644); | 99 | module_param(psv, int, 0644); |
96 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n"); | 100 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); |
97 | 101 | ||
98 | static int acpi_thermal_add(struct acpi_device *device); | 102 | static int acpi_thermal_add(struct acpi_device *device); |
99 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 103 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
@@ -340,6 +344,20 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
340 | tz->trips.critical.temperature)); | 344 | tz->trips.critical.temperature)); |
341 | } | 345 | } |
342 | 346 | ||
347 | if (tz->trips.critical.flags.valid == 1) { | ||
348 | if (crt == -1) { | ||
349 | tz->trips.critical.flags.valid = 0; | ||
350 | } else if (crt > 0) { | ||
351 | unsigned long crt_k = CELSIUS_TO_KELVIN(crt); | ||
352 | |||
353 | /* | ||
354 | * Allow override to lower critical threshold | ||
355 | */ | ||
356 | if (crt_k < tz->trips.critical.temperature) | ||
357 | tz->trips.critical.temperature = crt_k; | ||
358 | } | ||
359 | } | ||
360 | |||
343 | /* Critical Sleep (optional) */ | 361 | /* Critical Sleep (optional) */ |
344 | 362 | ||
345 | status = | 363 | status = |
@@ -485,8 +503,12 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
485 | printk(KERN_EMERG | 503 | printk(KERN_EMERG |
486 | "Critical temperature reached (%ld C), shutting down.\n", | 504 | "Critical temperature reached (%ld C), shutting down.\n", |
487 | KELVIN_TO_CELSIUS(tz->temperature)); | 505 | KELVIN_TO_CELSIUS(tz->temperature)); |
488 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, | 506 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, |
489 | tz->trips.critical.flags.enabled); | 507 | tz->trips.critical.flags.enabled); |
508 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | ||
509 | tz->device->dev.bus_id, | ||
510 | ACPI_THERMAL_NOTIFY_CRITICAL, | ||
511 | tz->trips.critical.flags.enabled); | ||
490 | 512 | ||
491 | orderly_poweroff(true); | 513 | orderly_poweroff(true); |
492 | 514 | ||
@@ -504,8 +526,12 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
504 | } else if (tz->trips.hot.flags.enabled) | 526 | } else if (tz->trips.hot.flags.enabled) |
505 | tz->trips.hot.flags.enabled = 0; | 527 | tz->trips.hot.flags.enabled = 0; |
506 | 528 | ||
507 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, | 529 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, |
508 | tz->trips.hot.flags.enabled); | 530 | tz->trips.hot.flags.enabled); |
531 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | ||
532 | tz->device->dev.bus_id, | ||
533 | ACPI_THERMAL_NOTIFY_HOT, | ||
534 | tz->trips.hot.flags.enabled); | ||
509 | 535 | ||
510 | /* TBD: Call user-mode "sleep(S4)" function */ | 536 | /* TBD: Call user-mode "sleep(S4)" function */ |
511 | 537 | ||
@@ -1067,9 +1093,9 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1067 | entry->owner = THIS_MODULE; | 1093 | entry->owner = THIS_MODULE; |
1068 | } | 1094 | } |
1069 | 1095 | ||
1070 | /* 'trip_points' [R/W] */ | 1096 | /* 'trip_points' [R] */ |
1071 | entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, | 1097 | entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, |
1072 | S_IFREG | S_IRUGO | S_IWUSR, | 1098 | S_IRUGO, |
1073 | acpi_device_dir(device)); | 1099 | acpi_device_dir(device)); |
1074 | if (!entry) | 1100 | if (!entry) |
1075 | return -ENODEV; | 1101 | return -ENODEV; |
@@ -1149,12 +1175,16 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1149 | case ACPI_THERMAL_NOTIFY_THRESHOLDS: | 1175 | case ACPI_THERMAL_NOTIFY_THRESHOLDS: |
1150 | acpi_thermal_get_trip_points(tz); | 1176 | acpi_thermal_get_trip_points(tz); |
1151 | acpi_thermal_check(tz); | 1177 | acpi_thermal_check(tz); |
1152 | acpi_bus_generate_event(device, event, 0); | 1178 | acpi_bus_generate_proc_event(device, event, 0); |
1179 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
1180 | device->dev.bus_id, event, 0); | ||
1153 | break; | 1181 | break; |
1154 | case ACPI_THERMAL_NOTIFY_DEVICES: | 1182 | case ACPI_THERMAL_NOTIFY_DEVICES: |
1155 | if (tz->flags.devices) | 1183 | if (tz->flags.devices) |
1156 | acpi_thermal_get_devices(tz); | 1184 | acpi_thermal_get_devices(tz); |
1157 | acpi_bus_generate_event(device, event, 0); | 1185 | acpi_bus_generate_proc_event(device, event, 0); |
1186 | acpi_bus_generate_netlink_event(device->pnp.device_class, | ||
1187 | device->dev.bus_id, event, 0); | ||
1158 | break; | 1188 | break; |
1159 | default: | 1189 | default: |
1160 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1190 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -1339,6 +1369,13 @@ static int thermal_act(struct dmi_system_id *d) { | |||
1339 | } | 1369 | } |
1340 | return 0; | 1370 | return 0; |
1341 | } | 1371 | } |
1372 | static int thermal_nocrt(struct dmi_system_id *d) { | ||
1373 | |||
1374 | printk(KERN_NOTICE "ACPI: %s detected: " | ||
1375 | "disabling all critical thermal trip point actions.\n", d->ident); | ||
1376 | nocrt = 1; | ||
1377 | return 0; | ||
1378 | } | ||
1342 | static int thermal_tzp(struct dmi_system_id *d) { | 1379 | static int thermal_tzp(struct dmi_system_id *d) { |
1343 | 1380 | ||
1344 | if (tzp == 0) { | 1381 | if (tzp == 0) { |
@@ -1387,6 +1424,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = { | |||
1387 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), | 1424 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), |
1388 | }, | 1425 | }, |
1389 | }, | 1426 | }, |
1427 | { | ||
1428 | .callback = thermal_nocrt, | ||
1429 | .ident = "Gigabyte GA-7ZX", | ||
1430 | .matches = { | ||
1431 | DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), | ||
1432 | DMI_MATCH(DMI_BOARD_NAME, "7ZX"), | ||
1433 | }, | ||
1434 | }, | ||
1390 | {} | 1435 | {} |
1391 | }; | 1436 | }; |
1392 | #endif /* CONFIG_DMI */ | 1437 | #endif /* CONFIG_DMI */ |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 1621655d6e2b..93ea8290b4f7 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -126,6 +126,7 @@ const char *acpi_format_exception(acpi_status status) | |||
126 | "Unknown exception code: 0x%8.8X", status)); | 126 | "Unknown exception code: 0x%8.8X", status)); |
127 | 127 | ||
128 | exception = "UNKNOWN_STATUS_CODE"; | 128 | exception = "UNKNOWN_STATUS_CODE"; |
129 | dump_stack(); | ||
129 | } | 130 | } |
130 | 131 | ||
131 | return (ACPI_CAST_PTR(const char, exception)); | 132 | return (ACPI_CAST_PTR(const char, exception)); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index ac63be4e8197..3c9bb85a6a93 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | 34 | #include <linux/input.h> | |
35 | #include <linux/backlight.h> | 35 | #include <linux/backlight.h> |
36 | #include <linux/video_output.h> | 36 | #include <linux/video_output.h> |
37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
@@ -138,6 +138,8 @@ struct acpi_video_bus { | |||
138 | struct semaphore sem; | 138 | struct semaphore sem; |
139 | struct list_head video_device_list; | 139 | struct list_head video_device_list; |
140 | struct proc_dir_entry *dir; | 140 | struct proc_dir_entry *dir; |
141 | struct input_dev *input; | ||
142 | char phys[32]; /* for input device */ | ||
141 | }; | 143 | }; |
142 | 144 | ||
143 | struct acpi_video_device_flags { | 145 | struct acpi_video_device_flags { |
@@ -1764,6 +1766,9 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1764 | { | 1766 | { |
1765 | struct acpi_video_bus *video = data; | 1767 | struct acpi_video_bus *video = data; |
1766 | struct acpi_device *device = NULL; | 1768 | struct acpi_device *device = NULL; |
1769 | struct input_dev *input; | ||
1770 | int keycode; | ||
1771 | |||
1767 | 1772 | ||
1768 | printk("video bus notify\n"); | 1773 | printk("video bus notify\n"); |
1769 | 1774 | ||
@@ -1771,11 +1776,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1771 | return; | 1776 | return; |
1772 | 1777 | ||
1773 | device = video->device; | 1778 | device = video->device; |
1779 | input = video->input; | ||
1774 | 1780 | ||
1775 | switch (event) { | 1781 | switch (event) { |
1776 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, | 1782 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, |
1777 | * most likely via hotkey. */ | 1783 | * most likely via hotkey. */ |
1778 | acpi_bus_generate_event(device, event, 0); | 1784 | acpi_bus_generate_proc_event(device, event, 0); |
1785 | keycode = KEY_SWITCHVIDEOMODE; | ||
1779 | break; | 1786 | break; |
1780 | 1787 | ||
1781 | case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video | 1788 | case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video |
@@ -1783,22 +1790,38 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1783 | acpi_video_device_enumerate(video); | 1790 | acpi_video_device_enumerate(video); |
1784 | acpi_video_device_rebind(video); | 1791 | acpi_video_device_rebind(video); |
1785 | acpi_video_switch_output(video, event); | 1792 | acpi_video_switch_output(video, event); |
1786 | acpi_bus_generate_event(device, event, 0); | 1793 | acpi_bus_generate_proc_event(device, event, 0); |
1794 | keycode = KEY_SWITCHVIDEOMODE; | ||
1787 | break; | 1795 | break; |
1788 | 1796 | ||
1789 | case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ | 1797 | case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ |
1798 | acpi_video_switch_output(video, event); | ||
1799 | acpi_bus_generate_proc_event(device, event, 0); | ||
1800 | keycode = KEY_SWITCHVIDEOMODE; | ||
1801 | break; | ||
1790 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ | 1802 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ |
1803 | acpi_video_switch_output(video, event); | ||
1804 | acpi_bus_generate_proc_event(device, event, 0); | ||
1805 | keycode = KEY_VIDEO_NEXT; | ||
1806 | break; | ||
1791 | case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ | 1807 | case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ |
1792 | acpi_video_switch_output(video, event); | 1808 | acpi_video_switch_output(video, event); |
1793 | acpi_bus_generate_event(device, event, 0); | 1809 | acpi_bus_generate_proc_event(device, event, 0); |
1810 | keycode = KEY_VIDEO_PREV; | ||
1794 | break; | 1811 | break; |
1795 | 1812 | ||
1796 | default: | 1813 | default: |
1814 | keycode = KEY_UNKNOWN; | ||
1797 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1815 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1798 | "Unsupported event [0x%x]\n", event)); | 1816 | "Unsupported event [0x%x]\n", event)); |
1799 | break; | 1817 | break; |
1800 | } | 1818 | } |
1801 | 1819 | ||
1820 | input_report_key(input, keycode, 1); | ||
1821 | input_sync(input); | ||
1822 | input_report_key(input, keycode, 0); | ||
1823 | input_sync(input); | ||
1824 | |||
1802 | return; | 1825 | return; |
1803 | } | 1826 | } |
1804 | 1827 | ||
@@ -1806,30 +1829,55 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
1806 | { | 1829 | { |
1807 | struct acpi_video_device *video_device = data; | 1830 | struct acpi_video_device *video_device = data; |
1808 | struct acpi_device *device = NULL; | 1831 | struct acpi_device *device = NULL; |
1832 | struct acpi_video_bus *bus; | ||
1833 | struct input_dev *input; | ||
1834 | int keycode; | ||
1809 | 1835 | ||
1810 | if (!video_device) | 1836 | if (!video_device) |
1811 | return; | 1837 | return; |
1812 | 1838 | ||
1813 | device = video_device->dev; | 1839 | device = video_device->dev; |
1840 | bus = video_device->video; | ||
1841 | input = bus->input; | ||
1814 | 1842 | ||
1815 | switch (event) { | 1843 | switch (event) { |
1816 | case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ | ||
1817 | case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ | ||
1818 | acpi_bus_generate_event(device, event, 0); | ||
1819 | break; | ||
1820 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ | 1844 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ |
1845 | acpi_video_switch_brightness(video_device, event); | ||
1846 | acpi_bus_generate_proc_event(device, event, 0); | ||
1847 | keycode = KEY_BRIGHTNESS_CYCLE; | ||
1848 | break; | ||
1821 | case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ | 1849 | case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ |
1850 | acpi_video_switch_brightness(video_device, event); | ||
1851 | acpi_bus_generate_proc_event(device, event, 0); | ||
1852 | keycode = KEY_BRIGHTNESSUP; | ||
1853 | break; | ||
1822 | case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ | 1854 | case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ |
1855 | acpi_video_switch_brightness(video_device, event); | ||
1856 | acpi_bus_generate_proc_event(device, event, 0); | ||
1857 | keycode = KEY_BRIGHTNESSDOWN; | ||
1858 | break; | ||
1823 | case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ | 1859 | case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ |
1860 | acpi_video_switch_brightness(video_device, event); | ||
1861 | acpi_bus_generate_proc_event(device, event, 0); | ||
1862 | keycode = KEY_BRIGHTNESS_ZERO; | ||
1863 | break; | ||
1824 | case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ | 1864 | case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ |
1825 | acpi_video_switch_brightness(video_device, event); | 1865 | acpi_video_switch_brightness(video_device, event); |
1826 | acpi_bus_generate_event(device, event, 0); | 1866 | acpi_bus_generate_proc_event(device, event, 0); |
1867 | keycode = KEY_DISPLAY_OFF; | ||
1827 | break; | 1868 | break; |
1828 | default: | 1869 | default: |
1870 | keycode = KEY_UNKNOWN; | ||
1829 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1871 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1830 | "Unsupported event [0x%x]\n", event)); | 1872 | "Unsupported event [0x%x]\n", event)); |
1831 | break; | 1873 | break; |
1832 | } | 1874 | } |
1875 | |||
1876 | input_report_key(input, keycode, 1); | ||
1877 | input_sync(input); | ||
1878 | input_report_key(input, keycode, 0); | ||
1879 | input_sync(input); | ||
1880 | |||
1833 | return; | 1881 | return; |
1834 | } | 1882 | } |
1835 | 1883 | ||
@@ -1839,6 +1887,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1839 | int result = 0; | 1887 | int result = 0; |
1840 | acpi_status status = 0; | 1888 | acpi_status status = 0; |
1841 | struct acpi_video_bus *video = NULL; | 1889 | struct acpi_video_bus *video = NULL; |
1890 | struct input_dev *input; | ||
1842 | 1891 | ||
1843 | 1892 | ||
1844 | if (!device) | 1893 | if (!device) |
@@ -1889,6 +1938,39 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1889 | goto end; | 1938 | goto end; |
1890 | } | 1939 | } |
1891 | 1940 | ||
1941 | |||
1942 | video->input = input = input_allocate_device(); | ||
1943 | |||
1944 | snprintf(video->phys, sizeof(video->phys), | ||
1945 | "%s/video/input0", acpi_device_hid(video->device)); | ||
1946 | |||
1947 | input->name = acpi_device_name(video->device); | ||
1948 | input->phys = video->phys; | ||
1949 | input->id.bustype = BUS_HOST; | ||
1950 | input->id.product = 0x06; | ||
1951 | input->evbit[0] = BIT(EV_KEY); | ||
1952 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); | ||
1953 | set_bit(KEY_VIDEO_NEXT, input->keybit); | ||
1954 | set_bit(KEY_VIDEO_PREV, input->keybit); | ||
1955 | set_bit(KEY_BRIGHTNESS_CYCLE, input->keybit); | ||
1956 | set_bit(KEY_BRIGHTNESSUP, input->keybit); | ||
1957 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); | ||
1958 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | ||
1959 | set_bit(KEY_DISPLAY_OFF, input->keybit); | ||
1960 | set_bit(KEY_UNKNOWN, input->keybit); | ||
1961 | result = input_register_device(input); | ||
1962 | if (result) { | ||
1963 | acpi_remove_notify_handler(video->device->handle, | ||
1964 | ACPI_DEVICE_NOTIFY, | ||
1965 | acpi_video_bus_notify); | ||
1966 | acpi_video_bus_stop_devices(video); | ||
1967 | acpi_video_bus_put_devices(video); | ||
1968 | kfree(video->attached_array); | ||
1969 | acpi_video_bus_remove_fs(device); | ||
1970 | goto end; | ||
1971 | } | ||
1972 | |||
1973 | |||
1892 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1974 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
1893 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1975 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
1894 | video->flags.multihead ? "yes" : "no", | 1976 | video->flags.multihead ? "yes" : "no", |
@@ -1922,6 +2004,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
1922 | acpi_video_bus_put_devices(video); | 2004 | acpi_video_bus_put_devices(video); |
1923 | acpi_video_bus_remove_fs(device); | 2005 | acpi_video_bus_remove_fs(device); |
1924 | 2006 | ||
2007 | input_unregister_device(video->input); | ||
1925 | kfree(video->attached_array); | 2008 | kfree(video->attached_array); |
1926 | kfree(video); | 2009 | kfree(video); |
1927 | 2010 | ||