public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 4/5] ACPI video: support reversed _BCL method
@ 2009-03-10  8:03 Zhang Rui
  2009-03-10 17:08 ` Matthew Garrett
  2009-03-10 17:11 ` Matthew Garrett
  0 siblings, 2 replies; 5+ messages in thread
From: Zhang Rui @ 2009-03-10  8:03 UTC (permalink / raw)
  To: linux-acpi; +Cc: Len Brown, Thomas Renninger, Matthew Garrett, Zhang, Rui

Subject: support reversed _BCL method in ACPI video driver
From: Zhang Rui <rui.zhang@intel.com>

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>
---
 drivers/acpi/video.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/acpi/video.c
===================================================================
--- linux-2.6.orig/drivers/acpi/video.c
+++ linux-2.6/drivers/acpi/video.c
@@ -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 {
@@ -746,9 +747,16 @@ acpi_video_init_brightness(struct acpi_v
 		count += level_ac_battery;
 	}
 
-	/* don't sort the first two 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,
+			    "Brightness levels in _BCL is in a mess\n"));
+		goto out_free_levels;
+	}
 
 	br->count = count;
 	device->brightness = br;



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-11  1:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-10  8:03 [RFC PATCH 4/5] ACPI video: support reversed _BCL method Zhang Rui
2009-03-10 17:08 ` Matthew Garrett
2009-03-10 17:11 ` Matthew Garrett
2009-03-11  1:42   ` Zhang Rui
2009-03-11  1:45     ` Matthew Garrett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox