diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 21968ae6ed91..1705d947ea09 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -809,12 +809,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
809 | br->flags._BCM_use_index = br->flags._BCL_use_index; | 809 | br->flags._BCM_use_index = br->flags._BCL_use_index; |
810 | 810 | ||
811 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ | 811 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ |
812 | br->curr = max_level; | 812 | br->curr = level_old = max_level; |
813 | |||
814 | if (!device->cap._BQC) | ||
815 | goto set_level; | ||
816 | |||
813 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 817 | result = acpi_video_device_lcd_get_level_current(device, &level_old); |
814 | if (result) | 818 | if (result) |
815 | goto out_free_levels; | 819 | goto out_free_levels; |
816 | 820 | ||
817 | 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); | ||
818 | if (result) | 825 | if (result) |
819 | goto out_free_levels; | 826 | goto out_free_levels; |
820 | 827 | ||
@@ -822,25 +829,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
822 | if (result) | 829 | if (result) |
823 | goto out_free_levels; | 830 | goto out_free_levels; |
824 | 831 | ||
825 | if ((level != level_old) && !br->flags._BCM_use_index) { | 832 | br->flags._BQC_use_index = (level == max_level ? 0 : 1); |
826 | /* Note: | 833 | |
827 | * This piece of code does not work correctly if the current | 834 | if (!br->flags._BQC_use_index) |
828 | * brightness levels is 0. | 835 | goto set_level; |
829 | * But I guess boxes that boot with such a dark screen are rare | 836 | |
830 | * and no more code is needed to cover this specifial case. | 837 | if (br->flags._BCL_reversed) |
831 | */ | 838 | level_old = (br->count - 1) - level_old; |
832 | 839 | level_old = br->levels[level_old]; | |
833 | if (level_ac_battery != 2) { | 840 | |
834 | /* | 841 | set_level: |
835 | * For now, we don't support the _BCL like this: | 842 | result = acpi_video_device_lcd_set_level(device, level_old); |
836 | * 16, 15, 0, 1, 2, 3, ..., 14, 15, 16 | 843 | if (result) |
837 | * because we may mess up the index returned by _BQC. | 844 | goto out_free_levels; |
838 | * Plus: we have not got a box like this. | ||
839 | */ | ||
840 | ACPI_ERROR((AE_INFO, "_BCL not supported\n")); | ||
841 | } | ||
842 | br->flags._BQC_use_index = 1; | ||
843 | } | ||
844 | 845 | ||
845 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 846 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
846 | "found %d brightness levels\n", count - 2)); | 847 | "found %d brightness levels\n", count - 2)); |