From patchwork Wed Sep 30 19:48:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 34618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 169C1B7BAA for ; Thu, 1 Oct 2009 05:49:00 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1Mt5AP-0002hF-Vk; Wed, 30 Sep 2009 20:48:50 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1Mt59y-0002Z2-Ug for kernel-team@lists.canonical.com; Wed, 30 Sep 2009 20:48:23 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1Mt59y-0004VT-T7 for ; Wed, 30 Sep 2009 20:48:22 +0100 Received: from p5b2e4121.dip.t-dialin.net ([91.46.65.33] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Mt59y-0005OZ-LC for kernel-team@lists.canonical.com; Wed, 30 Sep 2009 20:48:22 +0100 From: Stefan Bader To: kernel-team@lists.canonical.com Subject: [PATCH 1/2] ACPI video: ignore buggy _BQC Date: Wed, 30 Sep 2009 21:48:24 +0200 Message-Id: <1254340105-19372-2-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1254340105-19372-1-git-send-email-stefan.bader@canonical.com> References: <1254340105-19372-1-git-send-email-stefan.bader@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.8 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Vladimir Serbinenko 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 Signed-off-by: Scott Howard Acked-by: Zhang Rui Signed-off-by: Len Brown Signed-off-by: Stefan Bader --- drivers/acpi/video.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) 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?