aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2009-08-31 12:39:54 -0400
committerLen Brown <len.brown@intel.com>2009-08-31 12:39:54 -0400
commit90c53ca426cb93d15eefea79dcf6bd15ad3ffeb4 (patch)
tree40ca4e3d2fd7a1b921abc9ced9af2fc78151a161 /drivers/acpi
parent4a703a8fe562824f269943d995ddff35077253a9 (diff)
ACPI video: work-around BIOS AML bug in _BQC
_BQC on some laptops returns an uninitialized value when it's invoked for the first time. Set the laptop to the maximum backlight level in this case. http://bugzilla.kernel.org/attachment.cgi?id=22675 Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/video.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index a8432c291f4..097f24c87d8 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -878,7 +878,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
878 br->flags._BCM_use_index = br->flags._BCL_use_index; 878 br->flags._BCM_use_index = br->flags._BCL_use_index;
879 879
880 /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ 880 /* _BQC uses INDEX while _BCL uses VALUE in some laptops */
881 br->curr = level_old = max_level; 881 br->curr = level = max_level;
882 882
883 if (!device->cap._BQC) 883 if (!device->cap._BQC)
884 goto set_level; 884 goto set_level;
@@ -900,15 +900,25 @@ acpi_video_init_brightness(struct acpi_video_device *device)
900 900
901 br->flags._BQC_use_index = (level == max_level ? 0 : 1); 901 br->flags._BQC_use_index = (level == max_level ? 0 : 1);
902 902
903 if (!br->flags._BQC_use_index) 903 if (!br->flags._BQC_use_index) {
904 /*
905 * Set the backlight to the initial state.
906 * On some buggy laptops, _BQC returns an uninitialized value
907 * when invoked for the first time, i.e. level_old is invalid.
908 * set the backlight to max_level in this case
909 */
910 for (i = 2; i < br->count; i++)
911 if (level_old == br->levels[i])
912 level = level_old;
904 goto set_level; 913 goto set_level;
914 }
905 915
906 if (br->flags._BCL_reversed) 916 if (br->flags._BCL_reversed)
907 level_old = (br->count - 1) - level_old; 917 level_old = (br->count - 1) - level_old;
908 level_old = br->levels[level_old]; 918 level = br->levels[level_old];
909 919
910set_level: 920set_level:
911 result = acpi_video_device_lcd_set_level(device, level_old); 921 result = acpi_video_device_lcd_set_level(device, level);
912 if (result) 922 if (result)
913 goto out_free_levels; 923 goto out_free_levels;
914 924