aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2009-03-18 04:27:14 -0400
committerLen Brown <len.brown@intel.com>2009-03-27 21:56:24 -0400
commitd80fb99fdcd56f4934f11cc44ca016463842dc8b (patch)
treeecc0e6c7beab6b77190353873026716685c41029 /drivers/acpi/video.c
parentd32f69470c2081ffdfd82740ac19f940790f9e93 (diff)
ACPI video: support reversed _BCL method in ACPI video driver
The brightness levels returned by _BCL package are in a reversed order on some laptops. http://bugzilla.kernel.org/show_bug.cgi?id=12037 http://bugzilla.kernel.org/show_bug.cgi?id=12302 http://bugzilla.kernel.org/show_bug.cgi?id=12235 sort the _BCL packge in case it's reversed. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Acked-by: Matthew Garrett <mjg59@srcf.ucam.org> Acked-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 398b3eee37fb..dc84970ce1e9 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -170,6 +170,7 @@ struct acpi_video_device_cap {
170 170
171struct acpi_video_brightness_flags { 171struct acpi_video_brightness_flags {
172 u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */ 172 u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
173 u8 _BCL_reversed:1; /* _BCL package is in a reversed order*/
173}; 174};
174 175
175struct acpi_video_device_brightness { 176struct acpi_video_device_brightness {
@@ -744,9 +745,14 @@ acpi_video_init_brightness(struct acpi_video_device *device)
744 } else if (level_ac_battery > 2) 745 } else if (level_ac_battery > 2)
745 ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package\n")); 746 ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package\n"));
746 747
747 /* sort all the supported brightness levels */ 748 /* Check if the _BCL package is in a reversed order */
748 sort(&br->levels[2], count - 2, sizeof(br->levels[2]), 749 if (max_level == br->levels[2]) {
749 acpi_video_cmp_level, NULL); 750 br->flags._BCL_reversed = 1;
751 sort(&br->levels[2], count - 2, sizeof(br->levels[2]),
752 acpi_video_cmp_level, NULL);
753 } else if (max_level != br->levels[count - 1])
754 ACPI_ERROR((AE_INFO,
755 "Found unordered _BCL package\n"));
750 756
751 br->count = count; 757 br->count = count;
752 device->brightness = br; 758 device->brightness = br;