From patchwork Thu Mar 12 08:57:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 11299 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 n2C8u29G007246 for ; Thu, 12 Mar 2009 08:56:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753650AbZCLI4T (ORCPT ); Thu, 12 Mar 2009 04:56:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753616AbZCLI4T (ORCPT ); Thu, 12 Mar 2009 04:56:19 -0400 Received: from mga01.intel.com ([192.55.52.88]:42909 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753738AbZCLI4O (ORCPT ); Thu, 12 Mar 2009 04:56:14 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 12 Mar 2009 01:48:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,349,1233561600"; d="scan'208";a="672334629" Received: from rzhang-dt.sh.intel.com (HELO [10.239.36.58]) ([10.239.36.58]) by fmsmga001.fm.intel.com with ESMTP; 12 Mar 2009 01:59:54 -0700 Subject: [RESEND PATCH 4/7] 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: Thu, 12 Mar 2009 16:57:05 +0800 Message-Id: <1236848225.2807.73.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 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 +++ 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 { @@ -744,9 +745,14 @@ acpi_video_init_brightness(struct acpi_v } 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, + "Brightness levels in _BCL is in a mess\n")); br->count = count; device->brightness = br;