Skip to content

Commit

Permalink
ACPI video: support reversed _BCL method in ACPI video driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zhang Rui authored and Len Brown committed Mar 28, 2009
1 parent d32f694 commit d80fb99
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/acpi/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ struct acpi_video_device_cap {

struct acpi_video_brightness_flags {
u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
u8 _BCL_reversed:1; /* _BCL package is in a reversed order*/
};

struct acpi_video_device_brightness {
Expand Down Expand Up @@ -744,9 +745,14 @@ acpi_video_init_brightness(struct acpi_video_device *device)
} else if (level_ac_battery > 2)
ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package\n"));

/* sort all the supported brightness levels */
sort(&br->levels[2], count - 2, sizeof(br->levels[2]),
acpi_video_cmp_level, NULL);
/* Check if the _BCL package is in a reversed order */
if (max_level == br->levels[2]) {
br->flags._BCL_reversed = 1;
sort(&br->levels[2], count - 2, sizeof(br->levels[2]),
acpi_video_cmp_level, NULL);
} else if (max_level != br->levels[count - 1])
ACPI_ERROR((AE_INFO,
"Found unordered _BCL package\n"));

br->count = count;
device->brightness = br;
Expand Down

0 comments on commit d80fb99

Please sign in to comment.