diff mbox

[1/2] ACPI video: ignore buggy _BQC

Message ID 1254340105-19372-2-git-send-email-stefan.bader@canonical.com
State Accepted
Headers show

Commit Message

Stefan Bader Sept. 30, 2009, 7:48 p.m. UTC
From: Vladimir Serbinenko <phcoder@gmail.com>

BugLink: https://bugs.launchpad.net/bugs/428910

commit 4e231fa4cbd3ff53fcb7d76eccd6fd86a152a95f upstream

_BQC doesn't return a value listed in _BCL method.
http://bugzilla.kernel.org/show_bug.cgi?id=13511

ingore the buggy _BQC method in this case

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Scott Howard <showard314@gmail.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 drivers/acpi/video.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index cf090f4..57abb8c 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -603,6 +603,7 @@  acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
 					unsigned long long *level)
 {
 	acpi_status status = AE_OK;
+	int i;
 
 	if (device->cap._BQC || device->cap._BCQ) {
 		char *buf = device->cap._BQC ? "_BQC" : "_BCQ";
@@ -618,8 +619,15 @@  acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
 
 			}
 			*level += bqc_offset_aml_bug_workaround;
-			device->brightness->curr = *level;
-			return 0;
+			for (i = 2; i < device->brightness->count; i++)
+				if (device->brightness->levels[i] == *level) {
+					device->brightness->curr = *level;
+					return 0;
+			}
+			/* BQC returned an invalid level. Stop using it.  */
+			ACPI_WARNING((AE_INFO, "%s returned an invalid level",
+						buf));
+			device->cap._BQC = device->cap._BCQ = 0;
 		} else {
 			/* Fixme:
 			 * should we return an error or ignore this failure?