summaryrefslogtreecommitdiff
path: root/src/drivers/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/intel')
-rw-r--r--src/drivers/intel/gma/acpi/common.asl10
-rw-r--r--src/drivers/intel/gma/acpi/configure_brightness_levels.asl181
-rw-r--r--src/drivers/intel/gma/acpi/non-pch.asl6
-rw-r--r--src/drivers/intel/gma/acpi/pch.asl6
4 files changed, 183 insertions, 20 deletions
diff --git a/src/drivers/intel/gma/acpi/common.asl b/src/drivers/intel/gma/acpi/common.asl
index 7415859d5c..009e3a54cd 100644
--- a/src/drivers/intel/gma/acpi/common.asl
+++ b/src/drivers/intel/gma/acpi/common.asl
@@ -44,8 +44,11 @@
Store (And(Arg0, 7), DSEN)
}
- /* Using Notify is the right way. But Windows doesn't handle
- it well. So use both method in a way to avoid double action.
+ /*
+ * Decrement display brightness.
+ *
+ * Using Notify is the right way. But Windows doesn't handle
+ * it well. So use both method in a way to avoid double action.
*/
Method (DECB, 0, NotSerialized)
{
@@ -62,6 +65,9 @@
}
}
+ /*
+ * Increment display brightness.
+ */
Method (INCB, 0, NotSerialized)
{
If (BRCT)
diff --git a/src/drivers/intel/gma/acpi/configure_brightness_levels.asl b/src/drivers/intel/gma/acpi/configure_brightness_levels.asl
index 38eb116c67..8625f04a9f 100644
--- a/src/drivers/intel/gma/acpi/configure_brightness_levels.asl
+++ b/src/drivers/intel/gma/acpi/configure_brightness_levels.asl
@@ -1,24 +1,173 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Nico Huber <nico.huber@secunet.com>
+ * Copyright (C) 2018 Patrick Rudolph
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+ /*
+ * Pseudo device that contains methods to modify Opregion
+ * "Mailbox 3 BIOS to Driver Notification"
+ * The BIOS to Driver Notification mailbox is intended to support
+ * BIOS to Driver event notification or data storage for BIOS to
+ * Driver data synchronization purpose.
+ */
+ Device (BOX3)
+ {
+ Name (_ADR, 0)
+
+ OperationRegion (OPRG, SystemMemory, ASLS, 0x2000)
+ Field (OPRG, DWordAcc, NoLock, Preserve)
+ {
+ // OpRegion Header
+ Offset (0x58),
+ MBOX, 32,
+
+ // Mailbox 3
+ Offset (0x300),
+ ARDY, 1, /* Offset 0 Driver readiness */
+ , 31,
+ ASLC, 32, /* Offset 4 ASLE interrupt command / status */
+ TCHE, 32, /* Offset 8 Technology enabled indicator */
+ ALSI, 32, /* Offset 12 Current ALS illuminance reading */
+ BCLP, 32, /* Offset 16 Backlight britness to set */
+ PFIT, 32, /* Offset 20 Panel fitting Request */
+ CBLV, 32, /* Offset 24 Brightness Current State */
+ }
+
+ /*
+ * Request back-light brightness change through mailbox 3
+ *
+ * @param Arg0 The brightness level to set in percent
+ * @Return Zero on success, Ones on failure
+ * Errors: * ASLS is zero
+ * * Mailbox 3 support not advertised
+ * * Driver not loaded or not ready
+ * * Driver reported an error during ASLE IRQ
+ */
+ Method (XBCM, 1, NotSerialized)
+ {
+ If (LEqual(ASLS, Zero))
+ {
+ Return (Ones)
+ }
+ If (LEqual(And(MBOX, 0x4), Zero))
+ {
+ Return (Ones)
+ }
+ If (LEqual(ARDY, Zero))
+ {
+ Return (Ones)
+ }
+
+ Store (Or (Arg0, 0x80000000), BCLP)
+ /* Request back-light change */
+ Store (0x2, ASLC)
+ /* Trigger IRQ */
+ Store (0x1, ASLE)
+
+ Store (0x20, Local0)
+ While (LGreater(Local0, Zero))
+ {
+ Sleep (1)
+ If (LEqual(And(ShiftRight(ASLC, 12), 0x3), Zero))
+ {
+ Return (Zero)
+ }
+ Decrement (Local0)
+ }
+
+ Return (Ones)
+ }
+
+ /*
+ * Get current back-light brightness through mailbox 3
+ *
+ * @Return The current brightness or Ones on error
+ * Errors: * ASLS is zero
+ * * Mailbox 3 support not advertised
+ * * Driver not loaded or not ready
+ * * CBLV is not marked valid
+ */
+ Method (XBQC, 0, NotSerialized)
+ {
+ If (LEqual(ASLS, Zero))
+ {
+ Return (Ones)
+ }
+ If (LEqual(And(MBOX, 0x4), Zero))
+ {
+ Return (Ones)
+ }
+ If (LEqual(ARDY, Zero))
+ {
+ Return (Ones)
+ }
+ If (LEqual(And (CBLV, 0x80000000), Zero))
+ {
+ Return (Ones)
+ }
+ Return (And (CBLV, 0xff))
+ }
+ }
+
+ /*
+ * Pseudo device that contains methods to operate on GTT memory
+ */
+ Device (LEGA)
+ {
+ Name (_ADR, 0)
+
+ Method (XBCM, 1, NotSerialized)
+ {
+ Store (Divide (Multiply (Arg0, BCLM), 100), BCLV)
+ }
+
+ Method (XBQC, 0, NotSerialized)
+ {
+ /* 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)))
+ }
+ }
+
Method (XBCM, 1, NotSerialized)
{
- Store (Divide (Multiply (Arg0, BCLM), 100), BCLV)
+ If (LEqual(^BOX3.XBCM (Arg0), Ones))
+ {
+ ^LEGA.XBCM (Arg0)
+ }
}
Method (XBQC, 0, NotSerialized)
{
- /* 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)
+ Store (^BOX3.XBQC (), Local0)
+ If (LEqual(Local0, Ones))
+ {
+ Store (^LEGA.XBQC (), Local0)
}
- /* Didn't find greater/equal value: use the last */
- Return (DeRefOf (Index (BRIG, Local2)))
+
+ Return (Local0)
}
diff --git a/src/drivers/intel/gma/acpi/non-pch.asl b/src/drivers/intel/gma/acpi/non-pch.asl
index ef8f3ff1d4..c35d251c0f 100644
--- a/src/drivers/intel/gma/acpi/non-pch.asl
+++ b/src/drivers/intel/gma/acpi/non-pch.asl
@@ -22,7 +22,11 @@ Device (GFX0)
Field (GFXC, DWordAcc, NoLock, Preserve)
{
Offset (0x10),
- BAR0, 64
+ BAR0, 64,
+ Offset (0xe4),
+ ASLE, 32,
+ Offset (0xfc),
+ ASLS, 32,
}
OperationRegion (GFRG, SystemMemory, And (BAR0, 0xfffffffffffffff0), 0x400000)
diff --git a/src/drivers/intel/gma/acpi/pch.asl b/src/drivers/intel/gma/acpi/pch.asl
index 31911965cd..b7bb324b60 100644
--- a/src/drivers/intel/gma/acpi/pch.asl
+++ b/src/drivers/intel/gma/acpi/pch.asl
@@ -22,7 +22,11 @@ Device (GFX0)
Field (GFXC, DWordAcc, NoLock, Preserve)
{
Offset (0x10),
- BAR0, 64
+ BAR0, 64,
+ Offset (0xe4),
+ ASLE, 32,
+ Offset (0xfc),
+ ASLS, 32,
}
OperationRegion (GFRG, SystemMemory, And (BAR0, 0xfffffffffffffff0), 0x400000)