Subject: Re: [PATCH 1/2] ACPI Video: Ignore devices that aren't present in hardware

From: Matthew Garrett <[email-masked]>
Date: Fri, 4 Jul 2008 18:39:10 +0100

Got it. The reason for the delay is that BRTO sits in a loop for no 
obvious reason unless BRTF is cleared. The only thing that clears BRTF 
is the PWMS function, which isn't called anywhere in the ACPI tables. 
The NetBSD driver has the following code:

	/* Claim ownership of brightness control */
	param[0].Integer.Value = 0;
	(void)AcpiEvaluateObject(sc->sc_node->ad_handle, "PWMS", &params, NULL);

and doing this in thinkpad_acpi means my brightness control works in an 
acceptably speedy manner with opregion. Henrique, any thoughts on this? 
If you're happy with it, we can get opregion support into .27 and add 
the patch to remove duplicate ACPI video devices and everything will 
work in a beautiful and harmonious manner.

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index b596929..bbc45c8 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -899,6 +899,9 @@ static int __init tpacpi_check_std_acpi_brightness_support(void)
 
 	if (ACPI_SUCCESS(status) && bcl_levels > 2) {
 		tp_features.bright_acpimode = 1;
+		/* Set ACPI mode */
+		if (!acpi_evalf(hkey_handle, NULL, "PWMS", "vd", 0))
+			printk(TPACPI_INFO "Failed to claim backlight\n");
 		return (bcl_levels - 2);
 	}

-- 
Matthew Garrett | [email-masked]