diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/hwsleep.c | 43 | ||||
-rw-r--r-- | drivers/acpi/acpica/rscreate.c | 27 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 1 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 4 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 19 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 27 | ||||
-rw-r--r-- | drivers/acpi/system.c | 11 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 2 | ||||
-rw-r--r-- | drivers/acpi/video.c | 51 |
9 files changed, 102 insertions, 83 deletions
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index baa5fc05e124..db307a356f08 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -211,6 +211,12 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
211 | 211 | ||
212 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) | 212 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) |
213 | 213 | ||
214 | static unsigned int gts, bfs; | ||
215 | module_param(gts, uint, 0644); | ||
216 | module_param(bfs, uint, 0644); | ||
217 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
218 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
219 | |||
214 | /******************************************************************************* | 220 | /******************************************************************************* |
215 | * | 221 | * |
216 | * FUNCTION: acpi_enter_sleep_state | 222 | * FUNCTION: acpi_enter_sleep_state |
@@ -278,16 +284,18 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
278 | return_ACPI_STATUS(status); | 284 | return_ACPI_STATUS(status); |
279 | } | 285 | } |
280 | 286 | ||
281 | /* Execute the _GTS method */ | 287 | if (gts) { |
288 | /* Execute the _GTS method */ | ||
282 | 289 | ||
283 | arg_list.count = 1; | 290 | arg_list.count = 1; |
284 | arg_list.pointer = &arg; | 291 | arg_list.pointer = &arg; |
285 | arg.type = ACPI_TYPE_INTEGER; | 292 | arg.type = ACPI_TYPE_INTEGER; |
286 | arg.integer.value = sleep_state; | 293 | arg.integer.value = sleep_state; |
287 | 294 | ||
288 | status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); | 295 | status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); |
289 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 296 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
290 | return_ACPI_STATUS(status); | 297 | return_ACPI_STATUS(status); |
298 | } | ||
291 | } | 299 | } |
292 | 300 | ||
293 | /* Get current value of PM1A control */ | 301 | /* Get current value of PM1A control */ |
@@ -513,18 +521,19 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) | |||
513 | } | 521 | } |
514 | } | 522 | } |
515 | 523 | ||
516 | /* Execute the _BFS method */ | 524 | if (bfs) { |
525 | /* Execute the _BFS method */ | ||
517 | 526 | ||
518 | arg_list.count = 1; | 527 | arg_list.count = 1; |
519 | arg_list.pointer = &arg; | 528 | arg_list.pointer = &arg; |
520 | arg.type = ACPI_TYPE_INTEGER; | 529 | arg.type = ACPI_TYPE_INTEGER; |
521 | arg.integer.value = sleep_state; | 530 | arg.integer.value = sleep_state; |
522 | 531 | ||
523 | status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); | 532 | status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); |
524 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 533 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
525 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); | 534 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); |
535 | } | ||
526 | } | 536 | } |
527 | |||
528 | return_ACPI_STATUS(status); | 537 | return_ACPI_STATUS(status); |
529 | } | 538 | } |
530 | 539 | ||
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 663f692fffcf..a3c23d686d5f 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -191,8 +191,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); | 191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
192 | 192 | ||
193 | for (index = 0; index < number_of_elements; index++) { | 193 | for (index = 0; index < number_of_elements; index++) { |
194 | int source_name_index = 2; | ||
195 | int source_index_index = 3; | ||
196 | 194 | ||
197 | /* | 195 | /* |
198 | * Point user_prt past this current structure | 196 | * Point user_prt past this current structure |
@@ -261,27 +259,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
261 | return_ACPI_STATUS(AE_BAD_DATA); | 259 | return_ACPI_STATUS(AE_BAD_DATA); |
262 | } | 260 | } |
263 | 261 | ||
264 | /* | ||
265 | * If BIOS erroneously reversed the _PRT source_name and source_index, | ||
266 | * then reverse them back. | ||
267 | */ | ||
268 | if ((sub_object_list[3])->common.type != | ||
269 | ACPI_TYPE_INTEGER) { | ||
270 | if (acpi_gbl_enable_interpreter_slack) { | ||
271 | source_name_index = 3; | ||
272 | source_index_index = 2; | ||
273 | printk(KERN_WARNING | ||
274 | "ACPI: Handling Garbled _PRT entry\n"); | ||
275 | } else { | ||
276 | ACPI_ERROR((AE_INFO, | ||
277 | "(PRT[%X].source_index) Need Integer, found %s", | ||
278 | index, | ||
279 | acpi_ut_get_object_type_name | ||
280 | (sub_object_list[3]))); | ||
281 | return_ACPI_STATUS(AE_BAD_DATA); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | user_prt->pin = (u32) obj_desc->integer.value; | 262 | user_prt->pin = (u32) obj_desc->integer.value; |
286 | 263 | ||
287 | /* | 264 | /* |
@@ -304,7 +281,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
304 | * 3) Third subobject: Dereference the PRT.source_name | 281 | * 3) Third subobject: Dereference the PRT.source_name |
305 | * The name may be unresolved (slack mode), so allow a null object | 282 | * The name may be unresolved (slack mode), so allow a null object |
306 | */ | 283 | */ |
307 | obj_desc = sub_object_list[source_name_index]; | 284 | obj_desc = sub_object_list[2]; |
308 | if (obj_desc) { | 285 | if (obj_desc) { |
309 | switch (obj_desc->common.type) { | 286 | switch (obj_desc->common.type) { |
310 | case ACPI_TYPE_LOCAL_REFERENCE: | 287 | case ACPI_TYPE_LOCAL_REFERENCE: |
@@ -378,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
378 | 355 | ||
379 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 356 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
380 | 357 | ||
381 | obj_desc = sub_object_list[source_index_index]; | 358 | obj_desc = sub_object_list[3]; |
382 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { | 359 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { |
383 | ACPI_ERROR((AE_INFO, | 360 | ACPI_ERROR((AE_INFO, |
384 | "(PRT[%X].SourceIndex) Need Integer, found %s", | 361 | "(PRT[%X].SourceIndex) Need Integer, found %s", |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 04e90443eff7..391f331674c7 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device) | |||
1065 | struct acpi_ec *ec = acpi_driver_data(device); | 1065 | struct acpi_ec *ec = acpi_driver_data(device); |
1066 | /* Enable use of GPE back */ | 1066 | /* Enable use of GPE back */ |
1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); |
1068 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
1068 | acpi_enable_gpe(NULL, ec->gpe); | 1069 | acpi_enable_gpe(NULL, ec->gpe); |
1069 | return 0; | 1070 | return 0; |
1070 | } | 1071 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index d59f08ecaf16..d916bea729f1 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -353,8 +353,10 @@ static irqreturn_t acpi_irq(int irq, void *dev_id) | |||
353 | if (handled) { | 353 | if (handled) { |
354 | acpi_irq_handled++; | 354 | acpi_irq_handled++; |
355 | return IRQ_HANDLED; | 355 | return IRQ_HANDLED; |
356 | } else | 356 | } else { |
357 | acpi_irq_not_handled++; | ||
357 | return IRQ_NONE; | 358 | return IRQ_NONE; |
359 | } | ||
358 | } | 360 | } |
359 | 361 | ||
360 | acpi_status | 362 | acpi_status |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index ea23c64bd766..07c7d216c89d 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -581,6 +581,11 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
581 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 581 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
582 | struct acpi_processor_cx *cx = &pr->power.states[i]; | 582 | struct acpi_processor_cx *cx = &pr->power.states[i]; |
583 | 583 | ||
584 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
585 | /* TSC could halt in idle, so notify users */ | ||
586 | if (tsc_halts_in_c(cx->type)) | ||
587 | mark_tsc_unstable("TSC halts in idle");; | ||
588 | #endif | ||
584 | switch (cx->type) { | 589 | switch (cx->type) { |
585 | case ACPI_STATE_C1: | 590 | case ACPI_STATE_C1: |
586 | cx->valid = 1; | 591 | cx->valid = 1; |
@@ -657,11 +662,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
657 | 662 | ||
658 | seq_printf(seq, "active state: C%zd\n" | 663 | seq_printf(seq, "active state: C%zd\n" |
659 | "max_cstate: C%d\n" | 664 | "max_cstate: C%d\n" |
660 | "bus master activity: %08x\n" | ||
661 | "maximum allowed latency: %d usec\n", | 665 | "maximum allowed latency: %d usec\n", |
662 | pr->power.state ? pr->power.state - pr->power.states : 0, | 666 | pr->power.state ? pr->power.state - pr->power.states : 0, |
663 | max_cstate, (unsigned)pr->power.bm_activity, | 667 | max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); |
664 | pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); | ||
665 | 668 | ||
666 | seq_puts(seq, "states:\n"); | 669 | seq_puts(seq, "states:\n"); |
667 | 670 | ||
@@ -871,11 +874,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
871 | kt2 = ktime_get_real(); | 874 | kt2 = ktime_get_real(); |
872 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | 875 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); |
873 | 876 | ||
874 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
875 | /* TSC could halt in idle, so notify users */ | ||
876 | if (tsc_halts_in_c(cx->type)) | ||
877 | mark_tsc_unstable("TSC halts in idle");; | ||
878 | #endif | ||
879 | sleep_ticks = us_to_pm_timer_ticks(idle_time); | 877 | sleep_ticks = us_to_pm_timer_ticks(idle_time); |
880 | 878 | ||
881 | /* Tell the scheduler how much we idled: */ | 879 | /* Tell the scheduler how much we idled: */ |
@@ -989,11 +987,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
989 | kt2 = ktime_get_real(); | 987 | kt2 = ktime_get_real(); |
990 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | 988 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); |
991 | 989 | ||
992 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
993 | /* TSC could halt in idle, so notify users */ | ||
994 | if (tsc_halts_in_c(ACPI_STATE_C3)) | ||
995 | mark_tsc_unstable("TSC halts in idle"); | ||
996 | #endif | ||
997 | sleep_ticks = us_to_pm_timer_ticks(idle_time); | 990 | sleep_ticks = us_to_pm_timer_ticks(idle_time); |
998 | /* Tell the scheduler how much we idled: */ | 991 | /* Tell the scheduler how much we idled: */ |
999 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | 992 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index d060e6fd7fd5..01574a066534 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -713,6 +713,32 @@ static void acpi_power_off(void) | |||
713 | acpi_enter_sleep_state(ACPI_STATE_S5); | 713 | acpi_enter_sleep_state(ACPI_STATE_S5); |
714 | } | 714 | } |
715 | 715 | ||
716 | /* | ||
717 | * ACPI 2.0 created the optional _GTS and _BFS, | ||
718 | * but industry adoption has been neither rapid nor broad. | ||
719 | * | ||
720 | * Linux gets into trouble when it executes poorly validated | ||
721 | * paths through the BIOS, so disable _GTS and _BFS by default, | ||
722 | * but do speak up and offer the option to enable them. | ||
723 | */ | ||
724 | void __init acpi_gts_bfs_check(void) | ||
725 | { | ||
726 | acpi_handle dummy; | ||
727 | |||
728 | if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__GTS, &dummy))) | ||
729 | { | ||
730 | printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n"); | ||
731 | printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, " | ||
732 | "please notify linux-acpi@vger.kernel.org\n"); | ||
733 | } | ||
734 | if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__BFS, &dummy))) | ||
735 | { | ||
736 | printk(KERN_NOTICE PREFIX "BIOS offers _BFS\n"); | ||
737 | printk(KERN_NOTICE PREFIX "If \"acpi.bfs=1\" improves resume, " | ||
738 | "please notify linux-acpi@vger.kernel.org\n"); | ||
739 | } | ||
740 | } | ||
741 | |||
716 | int __init acpi_sleep_init(void) | 742 | int __init acpi_sleep_init(void) |
717 | { | 743 | { |
718 | acpi_status status; | 744 | acpi_status status; |
@@ -771,5 +797,6 @@ int __init acpi_sleep_init(void) | |||
771 | * object can also be evaluated when the system enters S5. | 797 | * object can also be evaluated when the system enters S5. |
772 | */ | 798 | */ |
773 | register_reboot_notifier(&tts_notifier); | 799 | register_reboot_notifier(&tts_notifier); |
800 | acpi_gts_bfs_check(); | ||
774 | return 0; | 801 | return 0; |
775 | } | 802 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index da51f05ef8d8..0944daec064f 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -38,6 +38,7 @@ ACPI_MODULE_NAME("system"); | |||
38 | #define ACPI_SYSTEM_DEVICE_NAME "System" | 38 | #define ACPI_SYSTEM_DEVICE_NAME "System" |
39 | 39 | ||
40 | u32 acpi_irq_handled; | 40 | u32 acpi_irq_handled; |
41 | u32 acpi_irq_not_handled; | ||
41 | 42 | ||
42 | /* | 43 | /* |
43 | * Make ACPICA version work as module param | 44 | * Make ACPICA version work as module param |
@@ -214,8 +215,9 @@ err: | |||
214 | 215 | ||
215 | #define COUNT_GPE 0 | 216 | #define COUNT_GPE 0 |
216 | #define COUNT_SCI 1 /* acpi_irq_handled */ | 217 | #define COUNT_SCI 1 /* acpi_irq_handled */ |
217 | #define COUNT_ERROR 2 /* other */ | 218 | #define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */ |
218 | #define NUM_COUNTERS_EXTRA 3 | 219 | #define COUNT_ERROR 3 /* other */ |
220 | #define NUM_COUNTERS_EXTRA 4 | ||
219 | 221 | ||
220 | struct event_counter { | 222 | struct event_counter { |
221 | u32 count; | 223 | u32 count; |
@@ -317,6 +319,8 @@ static ssize_t counter_show(struct kobject *kobj, | |||
317 | 319 | ||
318 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = | 320 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = |
319 | acpi_irq_handled; | 321 | acpi_irq_handled; |
322 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count = | ||
323 | acpi_irq_not_handled; | ||
320 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = | 324 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = |
321 | acpi_gpe_count; | 325 | acpi_gpe_count; |
322 | 326 | ||
@@ -363,6 +367,7 @@ static ssize_t counter_set(struct kobject *kobj, | |||
363 | all_counters[i].count = 0; | 367 | all_counters[i].count = 0; |
364 | acpi_gpe_count = 0; | 368 | acpi_gpe_count = 0; |
365 | acpi_irq_handled = 0; | 369 | acpi_irq_handled = 0; |
370 | acpi_irq_not_handled = 0; | ||
366 | goto end; | 371 | goto end; |
367 | } | 372 | } |
368 | 373 | ||
@@ -456,6 +461,8 @@ void acpi_irq_stats_init(void) | |||
456 | sprintf(buffer, "gpe_all"); | 461 | sprintf(buffer, "gpe_all"); |
457 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) | 462 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) |
458 | sprintf(buffer, "sci"); | 463 | sprintf(buffer, "sci"); |
464 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT) | ||
465 | sprintf(buffer, "sci_not"); | ||
459 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) | 466 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) |
460 | sprintf(buffer, "error"); | 467 | sprintf(buffer, "error"); |
461 | else | 468 | else |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 9cd15e8c8932..564ea1424288 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -909,7 +909,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
909 | thermal_zone_device_register("acpitz", trips, tz, | 909 | thermal_zone_device_register("acpitz", trips, tz, |
910 | &acpi_thermal_zone_ops, | 910 | &acpi_thermal_zone_ops, |
911 | 0, 0, 0, | 911 | 0, 0, 0, |
912 | tz->polling_frequency); | 912 | tz->polling_frequency*100); |
913 | if (IS_ERR(tz->thermal_zone)) | 913 | if (IS_ERR(tz->thermal_zone)) |
914 | return -ENODEV; | 914 | return -ENODEV; |
915 | 915 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index cd4fb7543a90..1705d947ea09 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -770,10 +770,12 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
770 | * In this case, the first two elements in _BCL packages | 770 | * In this case, the first two elements in _BCL packages |
771 | * are also supported brightness levels that OS should take care of. | 771 | * are also supported brightness levels that OS should take care of. |
772 | */ | 772 | */ |
773 | for (i = 2; i < count; i++) | 773 | for (i = 2; i < count; i++) { |
774 | if (br->levels[i] == br->levels[0] || | 774 | if (br->levels[i] == br->levels[0]) |
775 | br->levels[i] == br->levels[1]) | ||
776 | level_ac_battery++; | 775 | level_ac_battery++; |
776 | if (br->levels[i] == br->levels[1]) | ||
777 | level_ac_battery++; | ||
778 | } | ||
777 | 779 | ||
778 | if (level_ac_battery < 2) { | 780 | if (level_ac_battery < 2) { |
779 | level_ac_battery = 2 - level_ac_battery; | 781 | level_ac_battery = 2 - level_ac_battery; |
@@ -807,12 +809,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
807 | br->flags._BCM_use_index = br->flags._BCL_use_index; | 809 | br->flags._BCM_use_index = br->flags._BCL_use_index; |
808 | 810 | ||
809 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ | 811 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ |
810 | br->curr = max_level; | 812 | br->curr = level_old = max_level; |
813 | |||
814 | if (!device->cap._BQC) | ||
815 | goto set_level; | ||
816 | |||
811 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 817 | result = acpi_video_device_lcd_get_level_current(device, &level_old); |
812 | if (result) | 818 | if (result) |
813 | goto out_free_levels; | 819 | goto out_free_levels; |
814 | 820 | ||
815 | result = acpi_video_device_lcd_set_level(device, br->curr); | 821 | /* |
822 | * Set the level to maximum and check if _BQC uses indexed value | ||
823 | */ | ||
824 | result = acpi_video_device_lcd_set_level(device, max_level); | ||
816 | if (result) | 825 | if (result) |
817 | goto out_free_levels; | 826 | goto out_free_levels; |
818 | 827 | ||
@@ -820,25 +829,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
820 | if (result) | 829 | if (result) |
821 | goto out_free_levels; | 830 | goto out_free_levels; |
822 | 831 | ||
823 | if ((level != level_old) && !br->flags._BCM_use_index) { | 832 | br->flags._BQC_use_index = (level == max_level ? 0 : 1); |
824 | /* Note: | 833 | |
825 | * This piece of code does not work correctly if the current | 834 | if (!br->flags._BQC_use_index) |
826 | * brightness levels is 0. | 835 | goto set_level; |
827 | * But I guess boxes that boot with such a dark screen are rare | 836 | |
828 | * and no more code is needed to cover this specifial case. | 837 | if (br->flags._BCL_reversed) |
829 | */ | 838 | level_old = (br->count - 1) - level_old; |
830 | 839 | level_old = br->levels[level_old]; | |
831 | if (level_ac_battery != 2) { | 840 | |
832 | /* | 841 | set_level: |
833 | * For now, we don't support the _BCL like this: | 842 | result = acpi_video_device_lcd_set_level(device, level_old); |
834 | * 16, 15, 0, 1, 2, 3, ..., 14, 15, 16 | 843 | if (result) |
835 | * because we may mess up the index returned by _BQC. | 844 | goto out_free_levels; |
836 | * Plus: we have not got a box like this. | ||
837 | */ | ||
838 | ACPI_ERROR((AE_INFO, "_BCL not supported\n")); | ||
839 | } | ||
840 | br->flags._BQC_use_index = 1; | ||
841 | } | ||
842 | 845 | ||
843 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 846 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
844 | "found %d brightness levels\n", count - 2)); | 847 | "found %d brightness levels\n", count - 2)); |