diff options
author | Len Brown <len.brown@intel.com> | 2009-04-24 01:35:46 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-24 01:35:46 -0400 |
commit | 2d40570786c7c208539c65893818119557327ba0 (patch) | |
tree | 5284c00a3df86b95302d0b98a1332a0489920ad0 /drivers/acpi | |
parent | 04a2e6297df5ff04ddfbd6f2bdeefc218195ce96 (diff) | |
parent | e047cca66c6bb0b1c346e91305011aab79dfc4b0 (diff) | |
download | op-kernel-dev-2d40570786c7c208539c65893818119557327ba0.zip op-kernel-dev-2d40570786c7c208539c65893818119557327ba0.tar.gz |
Merge branch 'bugzilla-12249' into release
Diffstat (limited to 'drivers/acpi')
-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 21968ae..1705d94 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -809,12 +809,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) br->flags._BCM_use_index = br->flags._BCL_use_index; /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ - br->curr = max_level; + br->curr = level_old = max_level; + + if (!device->cap._BQC) + goto set_level; + result = acpi_video_device_lcd_get_level_current(device, &level_old); if (result) goto out_free_levels; - result = acpi_video_device_lcd_set_level(device, br->curr); + /* + * Set the level to maximum and check if _BQC uses indexed value + */ + result = acpi_video_device_lcd_set_level(device, max_level); if (result) goto out_free_levels; @@ -822,25 +829,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) if (result) goto out_free_levels; - if ((level != level_old) && !br->flags._BCM_use_index) { - /* Note: - * This piece of code does not work correctly if the current - * brightness levels is 0. - * But I guess boxes that boot with such a dark screen are rare - * and no more code is needed to cover this specifial case. - */ - - if (level_ac_battery != 2) { - /* - * For now, we don't support the _BCL like this: - * 16, 15, 0, 1, 2, 3, ..., 14, 15, 16 - * because we may mess up the index returned by _BQC. - * Plus: we have not got a box like this. - */ - ACPI_ERROR((AE_INFO, "_BCL not supported\n")); - } - br->flags._BQC_use_index = 1; - } + br->flags._BQC_use_index = (level == max_level ? 0 : 1); + + if (!br->flags._BQC_use_index) + goto set_level; + + if (br->flags._BCL_reversed) + level_old = (br->count - 1) - level_old; + level_old = br->levels[level_old]; + +set_level: + result = acpi_video_device_lcd_set_level(device, level_old); + if (result) + goto out_free_levels; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "found %d brightness levels\n", count - 2)); |