summaryrefslogtreecommitdiff
path: root/src/drivers/intel/gma/acpi
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2015-08-27 13:31:46 +0200
committerNico Huber <nico.h@gmx.de>2015-10-12 10:10:03 +0000
commitdeeec18520f4c8ccdd53abbbdb07a13b7f3124bf (patch)
tree82e55596fa5ac0e6726783844cadb51bad908171 /src/drivers/intel/gma/acpi
parentd5842f5b5facce03365415633359584002639a00 (diff)
gma ACPI: Do not overwrite backlight configuration
Changes to CR1 and CR2 were effectively overwriting the backlight configuration from the devicetree with static values. Instead read the maximum brightness value from BCLM (backlight modulation frequency) and calculate the target level (Arg0 is the target level as percentage). Turned out that _BQC has to return a value from the list returned by _BCL. So XBQC got a little heavier to search for the correct value. Change-Id: I35419993c8250c95fc69ba4db30db9dba9e6f8ff Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: http://review.coreboot.org/11704 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Diffstat (limited to 'src/drivers/intel/gma/acpi')
-rw-r--r--src/drivers/intel/gma/acpi/brightness_levels.asl23
-rw-r--r--src/drivers/intel/gma/acpi/non-pch.asl2
-rw-r--r--src/drivers/intel/gma/acpi/pch.asl2
3 files changed, 17 insertions, 10 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)))
}
diff --git a/src/drivers/intel/gma/acpi/non-pch.asl b/src/drivers/intel/gma/acpi/non-pch.asl
index c445c97c8c..0e156272b1 100644
--- a/src/drivers/intel/gma/acpi/non-pch.asl
+++ b/src/drivers/intel/gma/acpi/non-pch.asl
@@ -32,8 +32,6 @@ Device (GFX0)
OperationRegion (GFRG, SystemMemory, And (BAR0, 0xfffffffffffffff0), 0x400000)
Field (GFRG, DWordAcc, NoLock, Preserve)
{
- Offset (0x61250),
- CR1, 32,
Offset (0x61254),
BCLV, 16,
BCLM, 16,
diff --git a/src/drivers/intel/gma/acpi/pch.asl b/src/drivers/intel/gma/acpi/pch.asl
index 0a6b5834b9..98746e809d 100644
--- a/src/drivers/intel/gma/acpi/pch.asl
+++ b/src/drivers/intel/gma/acpi/pch.asl
@@ -34,8 +34,6 @@ Device (GFX0)
{
Offset (0x48254),
BCLV, 16,
- Offset (0xc8250),
- CR1, 32,
Offset (0xc8256),
BCLM, 16
}