Patchwork X60: Add _PRW/_PSW methods to LID/SLPB objects

login
register
about
Submitter Sven Schnelle
Date 2011-03-14 12:47:18
Message ID <1300106838-23881-1-git-send-email-svens@stackframe.org>
Download mbox | patch
Permalink /patch/2776/
State Accepted
Headers show

Comments

Sven Schnelle - 2011-03-14 12:47:18
This patch adds the required methods for enabling/disabling
the LID and SLPB objects as wake source. On Thinkpads, the
Fn key can (and is by the Vendor BIOS) programmed as Wake source,
so let's do it the same way.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
---
 src/mainboard/lenovo/x60/acpi/lid.asl         |   21 +++++++++++++++++++--
 src/mainboard/lenovo/x60/acpi/sleepbutton.asl |   24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 2 deletions(-)
Peter Stuge - 2011-03-14 13:34:13
Sven Schnelle wrote:
> This patch adds the required methods for enabling/disabling
> the LID and SLPB objects as wake source. On Thinkpads, the
> Fn key can (and is by the Vendor BIOS) programmed as Wake source,
> so let's do it the same way.
> 
> Signed-off-by: Sven Schnelle <svens@stackframe.org>

Acked-by: Peter Stuge <peter@stuge.se>

Patch

diff --git a/src/mainboard/lenovo/x60/acpi/lid.asl b/src/mainboard/lenovo/x60/acpi/lid.asl
index 2c92ee6..2dfa8d1 100644
--- a/src/mainboard/lenovo/x60/acpi/lid.asl
+++ b/src/mainboard/lenovo/x60/acpi/lid.asl
@@ -21,9 +21,12 @@ 
 
 Field(ERAM, ByteAcc, NoLock, Preserve)
 {
+                Offset (0x32),
+			    , 2,
+			WKLD, 1,
 		Offset (0x46),
-				, 2,
-			LIDS	, 1
+			    , 2,
+			LIDS, 1
 }
 
 Device(LID)
@@ -34,4 +37,18 @@  Device(LID)
 	{
 		return (LIDS)
 	}
+
+	Method(_PRW, 0, NotSerialized)
+	{
+		Return (Package() { 0x18, 0x03 })
+	}
+
+	Method(_PSW, 1, NotSerialized)
+	{
+		if (Arg0) {
+			Store(1, WKLD)
+		} else {
+			Store(0, WKLD)
+		}
+	}
 }
diff --git a/src/mainboard/lenovo/x60/acpi/sleepbutton.asl b/src/mainboard/lenovo/x60/acpi/sleepbutton.asl
index c339158..09e88aa 100644
--- a/src/mainboard/lenovo/x60/acpi/sleepbutton.asl
+++ b/src/mainboard/lenovo/x60/acpi/sleepbutton.asl
@@ -19,7 +19,31 @@ 
  * MA 02110-1301 USA
  */
 
+Field(ERAM, ByteAcc, NoLock, Preserve)
+{
+		Offset (0x32),
+			    , 4,
+			WKFN, 1,
+		Offset(0x83),
+			FNKY, 8
+}
+
 Device(SLPB)
 {
         Name (_HID, EisaId ("PNP0C0E"))
+	Method(_PRW, 0, NotSerialized)
+	{
+		Return (Package() { 0x18, 0x03 })
+	}
+
+	Method(_PSW, 1, NotSerialized)
+	{
+		if (Arg0) {
+			Store(6, FNKY) /* Fn key acts as wake button */
+			Store(1, WKFN)
+		} else {
+			Store(0, FNKY) /* Fn key normal operation */
+			Store(0, WKFN)
+		}
+	}
 }