[ltp] Re: [ibm-acpi-devel] thinkpad-acpi release 0.17-20071002 uploaded to ibm-acpi.sf.net

Henrique de Moraes Holschuh linux-thinkpad@linux-thinkpad.org
Wed, 3 Oct 2007 09:07:35 -0300


--R3G7APHDIzY6R/pk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, 03 Oct 2007, Chris Hanson wrote:
> > because of the backlight class, but also because it means thinkpad-acpi is
> > supposed to refuse to write such stuff to the hardware).  But a backlight

But it was not refusing to *read* it.  Try the attached patch.  Does it
solve the issue?  If it does, it means the T60 has one extra bit of data in
NVRAM that might be interesting to find out.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

--R3G7APHDIzY6R/pk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

commit 2207713b918c5144d3b355150bf8cd53b48b991d
Author: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Date:   Wed Oct 3 09:04:46 2007 -0300

    ACPI: thinkpad-acpi: fix issues in brightness 16-levels support
    
    Fix some issues with the new 16-level brightness support.
    
    Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index b0ef877..45956f5 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -3584,6 +3584,13 @@ static int __init brightness_check_levels(void)
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *obj;
 
+	if (!vid_handle) {
+		IBM_ACPIHANDLE_INIT(vid);
+	}
+
+	if (!vid_handle)
+		return 0;
+
 	status = acpi_evaluate_object(vid_handle, "BCLL", NULL, &buffer);
 	if (!ACPI_SUCCESS(status))
 		return 0;
@@ -3693,6 +3700,7 @@ static int brightness_get(struct backlight_device *bd)
 		lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS)
 			 & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
 			>> TP_NVRAM_POS_LEVEL_BRIGHTNESS;
+		lcmos &= (tp_features.bright_16levels)? 0x0f : 0x07;
 		level = lcmos;
 	}
 

--R3G7APHDIzY6R/pk--