From patchwork Wed Mar 18 08:27:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 12773 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2I8QZat021718 for ; Wed, 18 Mar 2009 08:26:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752110AbZCRI0r (ORCPT ); Wed, 18 Mar 2009 04:26:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752192AbZCRI0r (ORCPT ); Wed, 18 Mar 2009 04:26:47 -0400 Received: from mga02.intel.com ([134.134.136.20]:18117 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbZCRI0r (ORCPT ); Wed, 18 Mar 2009 04:26:47 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 18 Mar 2009 01:20:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,383,1233561600"; d="scan'208";a="395436016" Received: from rzhang-dt.sh.intel.com (HELO [10.239.36.58]) ([10.239.36.58]) by orsmga002.jf.intel.com with ESMTP; 18 Mar 2009 01:35:07 -0700 Subject: [RESEND PATCH 4/6] ACPI video: support reversed _BCL method in ACPI video driver From: Zhang Rui To: Len Brown Cc: linux-acpi , Matthew Garrett , Thomas Renninger , "Zhang, Rui" Date: Wed, 18 Mar 2009 16:27:14 +0800 Message-Id: <1237364834.3826.60.camel@rzhang-dt> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1 (2.22.1-2.fc9) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Subject: support reversed _BCL method in ACPI video driver From: Zhang Rui 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 Acked-by: Matthew Garrett Acked-by: Thomas Renninger --- drivers/acpi/video.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/acpi/video.c =================================================================== --- linux-2.6.orig/drivers/acpi/video.c 2009-03-17 14:52:09.000000000 +0800 +++ linux-2.6/drivers/acpi/video.c 2009-03-17 14:53:04.000000000 +0800 @@ -170,6 +170,7 @@ 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 { @@ -744,9 +745,14 @@ } 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;