aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/intel/gma/acpi/brightness_levels.asl
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/intel/gma/acpi/brightness_levels.asl')
-rw-r--r--src/drivers/intel/gma/acpi/brightness_levels.asl23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/drivers/intel/gma/acpi/brightness_levels.asl b/src/drivers/intel/gma/acpi/brightness_levels.asl
index c186989fda..d0e70a9418 100644
--- a/src/drivers/intel/gma/acpi/brightness_levels.asl
+++ b/src/drivers/intel/gma/acpi/brightness_levels.asl
@@ -22,14 +22,25 @@
Method (XBCM, 1, NotSerialized)
{
- Store (ShiftLeft (Arg0, 4), BCLV)
- Store (0x80000000, CR1)
- Store (0x0610, BCLM)
+ Store (Divide (Multiply (Arg0, BCLM), 100), BCLV)
}
Method (XBQC, 0, NotSerialized)
{
- Store (BCLV, Local0)
- ShiftRight (Local0, 4, Local0)
- Return (Local0)
+ /* Find value close to BCLV in BRIG (which must be ordered) */
+ Store (BCLV, Local0) // Current value
+ Store (BCLM, Local1) // For calculations
+ Store (2, Local2) // Loop index
+ While (LLess (Local2, Subtract (SizeOf (BRIG), 1))) {
+ Store (DeRefOf (Index (BRIG, Local2)), Local3)
+ /* Use same calculation as XBCM, to get exact matches */
+ Store (Divide (Multiply (Local3, Local1), 100), Local3)
+
+ If (LLessEqual (Local0, Local3)) {
+ Return (DeRefOf (Index (BRIG, Local2)))
+ }
+ Add (Local2, 1, Local2)
+ }
+ /* Didn't find greater/equal value: use the last */
+ Return (DeRefOf (Index (BRIG, Local2)))
}