diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/battery.c | 47 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 47 | ||||
-rw-r--r-- | drivers/acpi/hardware/hwsleep.c | 19 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfeval.c | 2 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 32 | ||||
-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 | 47 | ||||
-rw-r--r-- | drivers/acpi/utilities/utglobal.c | 1 | ||||
-rw-r--r-- | drivers/acpi/video.c | 91 |
11 files changed, 301 insertions, 63 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 91dc4b316a08..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 | ||
@@ -895,7 +900,10 @@ static int acpi_battery_add(struct acpi_device *device) | |||
895 | if (!battery) | 900 | if (!battery) |
896 | return -ENOMEM; | 901 | return -ENOMEM; |
897 | 902 | ||
898 | mutex_init(&battery->lock); | 903 | mutex_init(&battery->mutex); |
904 | |||
905 | mutex_lock(&battery->mutex); | ||
906 | |||
899 | battery->device = device; | 907 | battery->device = device; |
900 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); | 908 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); |
901 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 909 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
@@ -931,6 +939,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
931 | kfree(battery); | 939 | kfree(battery); |
932 | } | 940 | } |
933 | 941 | ||
942 | mutex_unlock(&battery->mutex); | ||
934 | 943 | ||
935 | return result; | 944 | return result; |
936 | } | 945 | } |
@@ -945,6 +954,8 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
945 | 954 | ||
946 | battery = acpi_driver_data(device); | 955 | battery = acpi_driver_data(device); |
947 | 956 | ||
957 | mutex_lock(&battery->mutex); | ||
958 | |||
948 | status = acpi_remove_notify_handler(device->handle, | 959 | status = acpi_remove_notify_handler(device->handle, |
949 | ACPI_ALL_NOTIFY, | 960 | ACPI_ALL_NOTIFY, |
950 | acpi_battery_notify); | 961 | acpi_battery_notify); |
@@ -955,7 +966,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
955 | 966 | ||
956 | kfree(battery->bst_data.pointer); | 967 | kfree(battery->bst_data.pointer); |
957 | 968 | ||
958 | mutex_destroy(&battery->lock); | 969 | mutex_unlock(&battery->mutex); |
970 | |||
971 | mutex_destroy(&battery->mutex); | ||
959 | 972 | ||
960 | kfree(battery); | 973 | kfree(battery); |
961 | 974 | ||
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/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_idle.c b/drivers/acpi/processor_idle.c index a8634a0655fc..d9b8af763e1e 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -63,6 +63,7 @@ | |||
63 | ACPI_MODULE_NAME("processor_idle"); | 63 | ACPI_MODULE_NAME("processor_idle"); |
64 | #define ACPI_PROCESSOR_FILE_POWER "power" | 64 | #define ACPI_PROCESSOR_FILE_POWER "power" |
65 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) | 65 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) |
66 | #define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) | ||
66 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 67 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
67 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 68 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
68 | static void (*pm_idle_save) (void) __read_mostly; | 69 | static void (*pm_idle_save) (void) __read_mostly; |
@@ -462,6 +463,9 @@ static void acpi_processor_idle(void) | |||
462 | * TBD: Can't get time duration while in C1, as resumes | 463 | * TBD: Can't get time duration while in C1, as resumes |
463 | * go to an ISR rather than here. Need to instrument | 464 | * go to an ISR rather than here. Need to instrument |
464 | * base interrupt handler. | 465 | * base interrupt handler. |
466 | * | ||
467 | * Note: the TSC better not stop in C1, sched_clock() will | ||
468 | * skew otherwise. | ||
465 | */ | 469 | */ |
466 | sleep_ticks = 0xFFFFFFFF; | 470 | sleep_ticks = 0xFFFFFFFF; |
467 | break; | 471 | break; |
@@ -469,6 +473,8 @@ static void acpi_processor_idle(void) | |||
469 | case ACPI_STATE_C2: | 473 | case ACPI_STATE_C2: |
470 | /* Get start time (ticks) */ | 474 | /* Get start time (ticks) */ |
471 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 475 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
476 | /* Tell the scheduler that we are going deep-idle: */ | ||
477 | sched_clock_idle_sleep_event(); | ||
472 | /* Invoke C2 */ | 478 | /* Invoke C2 */ |
473 | acpi_state_timer_broadcast(pr, cx, 1); | 479 | acpi_state_timer_broadcast(pr, cx, 1); |
474 | acpi_cstate_enter(cx); | 480 | acpi_cstate_enter(cx); |
@@ -479,17 +485,22 @@ static void acpi_processor_idle(void) | |||
479 | /* TSC halts in C2, so notify users */ | 485 | /* TSC halts in C2, so notify users */ |
480 | mark_tsc_unstable("possible TSC halt in C2"); | 486 | mark_tsc_unstable("possible TSC halt in C2"); |
481 | #endif | 487 | #endif |
488 | /* Compute time (ticks) that we were actually asleep */ | ||
489 | sleep_ticks = ticks_elapsed(t1, t2); | ||
490 | |||
491 | /* Tell the scheduler how much we idled: */ | ||
492 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
493 | |||
482 | /* Re-enable interrupts */ | 494 | /* Re-enable interrupts */ |
483 | local_irq_enable(); | 495 | local_irq_enable(); |
496 | /* Do not account our idle-switching overhead: */ | ||
497 | sleep_ticks -= cx->latency_ticks + C2_OVERHEAD; | ||
498 | |||
484 | current_thread_info()->status |= TS_POLLING; | 499 | current_thread_info()->status |= TS_POLLING; |
485 | /* Compute time (ticks) that we were actually asleep */ | ||
486 | sleep_ticks = | ||
487 | ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; | ||
488 | acpi_state_timer_broadcast(pr, cx, 0); | 500 | acpi_state_timer_broadcast(pr, cx, 0); |
489 | break; | 501 | break; |
490 | 502 | ||
491 | case ACPI_STATE_C3: | 503 | case ACPI_STATE_C3: |
492 | |||
493 | /* | 504 | /* |
494 | * disable bus master | 505 | * disable bus master |
495 | * bm_check implies we need ARB_DIS | 506 | * bm_check implies we need ARB_DIS |
@@ -518,6 +529,8 @@ static void acpi_processor_idle(void) | |||
518 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 529 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
519 | /* Invoke C3 */ | 530 | /* Invoke C3 */ |
520 | acpi_state_timer_broadcast(pr, cx, 1); | 531 | acpi_state_timer_broadcast(pr, cx, 1); |
532 | /* Tell the scheduler that we are going deep-idle: */ | ||
533 | sched_clock_idle_sleep_event(); | ||
521 | acpi_cstate_enter(cx); | 534 | acpi_cstate_enter(cx); |
522 | /* Get end time (ticks) */ | 535 | /* Get end time (ticks) */ |
523 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 536 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
@@ -531,12 +544,17 @@ static void acpi_processor_idle(void) | |||
531 | /* TSC halts in C3, so notify users */ | 544 | /* TSC halts in C3, so notify users */ |
532 | mark_tsc_unstable("TSC halts in C3"); | 545 | mark_tsc_unstable("TSC halts in C3"); |
533 | #endif | 546 | #endif |
547 | /* Compute time (ticks) that we were actually asleep */ | ||
548 | sleep_ticks = ticks_elapsed(t1, t2); | ||
549 | /* Tell the scheduler how much we idled: */ | ||
550 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
551 | |||
534 | /* Re-enable interrupts */ | 552 | /* Re-enable interrupts */ |
535 | local_irq_enable(); | 553 | local_irq_enable(); |
554 | /* Do not account our idle-switching overhead: */ | ||
555 | sleep_ticks -= cx->latency_ticks + C3_OVERHEAD; | ||
556 | |||
536 | current_thread_info()->status |= TS_POLLING; | 557 | current_thread_info()->status |= TS_POLLING; |
537 | /* Compute time (ticks) that we were actually asleep */ | ||
538 | sleep_ticks = | ||
539 | ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD; | ||
540 | acpi_state_timer_broadcast(pr, cx, 0); | 558 | acpi_state_timer_broadcast(pr, cx, 0); |
541 | break; | 559 | break; |
542 | 560 | ||
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 2c9cfe297f73..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 = |
@@ -1075,9 +1093,9 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1075 | entry->owner = THIS_MODULE; | 1093 | entry->owner = THIS_MODULE; |
1076 | } | 1094 | } |
1077 | 1095 | ||
1078 | /* 'trip_points' [R/W] */ | 1096 | /* 'trip_points' [R] */ |
1079 | entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, | 1097 | entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, |
1080 | S_IFREG | S_IRUGO | S_IWUSR, | 1098 | S_IRUGO, |
1081 | acpi_device_dir(device)); | 1099 | acpi_device_dir(device)); |
1082 | if (!entry) | 1100 | if (!entry) |
1083 | return -ENODEV; | 1101 | return -ENODEV; |
@@ -1351,6 +1369,13 @@ static int thermal_act(struct dmi_system_id *d) { | |||
1351 | } | 1369 | } |
1352 | return 0; | 1370 | return 0; |
1353 | } | 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 | } | ||
1354 | static int thermal_tzp(struct dmi_system_id *d) { | 1379 | static int thermal_tzp(struct dmi_system_id *d) { |
1355 | 1380 | ||
1356 | if (tzp == 0) { | 1381 | if (tzp == 0) { |
@@ -1399,6 +1424,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = { | |||
1399 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), | 1424 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), |
1400 | }, | 1425 | }, |
1401 | }, | 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 | }, | ||
1402 | {} | 1435 | {} |
1403 | }; | 1436 | }; |
1404 | #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 9a5cfcfd8da5..6659bdd2a454 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_proc_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 |
@@ -1784,21 +1791,37 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
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_proc_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_proc_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) */ | 1844 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ |
1817 | case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ | 1845 | acpi_video_switch_brightness(video_device, event); |
1818 | acpi_bus_generate_proc_event(device, event, 0); | 1846 | acpi_bus_generate_proc_event(device, event, 0); |
1847 | keycode = KEY_BRIGHTNESS_CYCLE; | ||
1819 | break; | 1848 | break; |
1820 | case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ | ||
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_proc_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 | ||
@@ -1838,6 +1886,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1838 | int result = 0; | 1886 | int result = 0; |
1839 | acpi_status status = 0; | 1887 | acpi_status status = 0; |
1840 | struct acpi_video_bus *video = NULL; | 1888 | struct acpi_video_bus *video = NULL; |
1889 | struct input_dev *input; | ||
1841 | 1890 | ||
1842 | 1891 | ||
1843 | if (!device) | 1892 | if (!device) |
@@ -1881,6 +1930,39 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1881 | goto end; | 1930 | goto end; |
1882 | } | 1931 | } |
1883 | 1932 | ||
1933 | |||
1934 | video->input = input = input_allocate_device(); | ||
1935 | |||
1936 | snprintf(video->phys, sizeof(video->phys), | ||
1937 | "%s/video/input0", acpi_device_hid(video->device)); | ||
1938 | |||
1939 | input->name = acpi_device_name(video->device); | ||
1940 | input->phys = video->phys; | ||
1941 | input->id.bustype = BUS_HOST; | ||
1942 | input->id.product = 0x06; | ||
1943 | input->evbit[0] = BIT(EV_KEY); | ||
1944 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); | ||
1945 | set_bit(KEY_VIDEO_NEXT, input->keybit); | ||
1946 | set_bit(KEY_VIDEO_PREV, input->keybit); | ||
1947 | set_bit(KEY_BRIGHTNESS_CYCLE, input->keybit); | ||
1948 | set_bit(KEY_BRIGHTNESSUP, input->keybit); | ||
1949 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); | ||
1950 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | ||
1951 | set_bit(KEY_DISPLAY_OFF, input->keybit); | ||
1952 | set_bit(KEY_UNKNOWN, input->keybit); | ||
1953 | result = input_register_device(input); | ||
1954 | if (result) { | ||
1955 | acpi_remove_notify_handler(video->device->handle, | ||
1956 | ACPI_DEVICE_NOTIFY, | ||
1957 | acpi_video_bus_notify); | ||
1958 | acpi_video_bus_stop_devices(video); | ||
1959 | acpi_video_bus_put_devices(video); | ||
1960 | kfree(video->attached_array); | ||
1961 | acpi_video_bus_remove_fs(device); | ||
1962 | goto end; | ||
1963 | } | ||
1964 | |||
1965 | |||
1884 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1966 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
1885 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1967 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
1886 | video->flags.multihead ? "yes" : "no", | 1968 | video->flags.multihead ? "yes" : "no", |
@@ -1914,6 +1996,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
1914 | acpi_video_bus_put_devices(video); | 1996 | acpi_video_bus_put_devices(video); |
1915 | acpi_video_bus_remove_fs(device); | 1997 | acpi_video_bus_remove_fs(device); |
1916 | 1998 | ||
1999 | input_unregister_device(video->input); | ||
1917 | kfree(video->attached_array); | 2000 | kfree(video->attached_array); |
1918 | kfree(video); | 2001 | kfree(video); |
1919 | 2002 | ||