[coreboot-gerrit] Change in coreboot[master]: ec/lenovo/h8/acpi: Apply state on wake

Patrick Rudolph (Code Review) gerrit at coreboot.org
Wed Nov 8 19:55:42 CET 2017


Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/22377


Change subject: ec/lenovo/h8/acpi: Apply state on wake
......................................................................

ec/lenovo/h8/acpi: Apply state on wake

Store the requested state wake state for bluetooth and WWAN.
Add new methods to init the state and apply the requested state on wake.
Call the new method on all devices.

Change-Id: I13c08b8c6b1bf0f3deb25a464b26880d8469c005
Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
M src/ec/lenovo/h8/acpi/thinkpad.asl
M src/mainboard/lenovo/t400/acpi/platform.asl
M src/mainboard/lenovo/t420s/acpi/platform.asl
M src/mainboard/lenovo/t430/acpi/platform.asl
M src/mainboard/lenovo/t430s/acpi/platform.asl
M src/mainboard/lenovo/t520/acpi/platform.asl
M src/mainboard/lenovo/t530/acpi/platform.asl
M src/mainboard/lenovo/t60/acpi/platform.asl
M src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl
M src/mainboard/lenovo/x200/acpi/platform.asl
M src/mainboard/lenovo/x201/acpi/platform.asl
M src/mainboard/lenovo/x220/acpi/platform.asl
M src/mainboard/lenovo/x230/acpi/platform.asl
M src/mainboard/lenovo/x60/acpi/platform.asl
14 files changed, 80 insertions(+), 8 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/22377/1

diff --git a/src/ec/lenovo/h8/acpi/thinkpad.asl b/src/ec/lenovo/h8/acpi/thinkpad.asl
index b5ad013..2e8bf60 100644
--- a/src/ec/lenovo/h8/acpi/thinkpad.asl
+++ b/src/ec/lenovo/h8/acpi/thinkpad.asl
@@ -150,6 +150,11 @@
 		Return (0x0100)
 	}
 
+	/* Has thinkpad_acpi module loaded */
+	Name (HAST, 0)
+
+	/* State after sleep */
+	Name (WBDC, 0)
 	/*
 	 * Returns the current state:
 	 *  Bit 0: BT HW present
@@ -158,14 +163,15 @@
 	 */
 	Method (GBDC, 0)
 	{
+		Store (One, HAST)
+
 		If (HBDC) {
 			Store(One, Local0)
 			If(\_SB.PCI0.LPCB.EC.BTEB)
 			{
 				Or(Local0, 2, Local0)
 			}
-			/* FIXME: Implement state at resume, for now Enabled */
-			Or(Local0, 4, Local0)
+			Or(Local0, ShiftLeft(WBDC, 2), Local0)
 			Return (Local0)
 		} Else {
 			Return (0)
@@ -179,14 +185,18 @@
 	 */
 	Method (SBDC, 1)
 	{
+		Store (One, HAST)
+
 		If (HBDC) {
 			ShiftRight (And(Arg0, 2), 1, Local0)
 			Store (Local0, \_SB.PCI0.LPCB.EC.BTEB)
-
-			/* FIXME: Store state at resume */
+			ShiftRight (And(Arg0, 4), 2, Local0)
+			Store (Local0, WBDC)
 		}
 	}
 
+	/* State after sleep */
+	Name (WWAN, 0)
 	/*
 	 * Returns the current state:
 	 *  Bit 0: WWAN HW present
@@ -195,14 +205,15 @@
 	 */
 	Method (GWAN, 0)
 	{
+		Store (One, HAST)
+
 		If (HWAN) {
 			Store(One, Local0)
 			If(\_SB.PCI0.LPCB.EC.WWEB)
 			{
 				Or(Local0, 2, Local0)
 			}
-			/* FIXME: Implement state at resume, for now Enabled */
-			Or(Local0, 4, Local0)
+			Or(Local0, ShiftLeft(WWAN, 2), Local0)
 			Return (Local0)
 		} Else {
 			Return (0)
@@ -216,11 +227,12 @@
 	 */
 	Method (SWAN, 1)
 	{
+		Store (One, HAST)
+
 		If (HWAN) {
 			ShiftRight (And(Arg0, 2), 1, Local0)
 			Store (Local0, \_SB.PCI0.LPCB.EC.WWEB)
-
-			/* FIXME: Store state at resume */
+			ShiftRight (And(Arg0, 4), 2, WWAN)
 		}
 	}
 
@@ -284,4 +296,24 @@
 			Store (Local0, \_SB.PCI0.LPCB.EC.UWBE)
 		}
 	}
+
+	/*
+	 * Store initial state
+	 */
+	Method (_INI, 0, NotSerialized)
+	{
+		Store (\_SB.PCI0.LPCB.EC.BTEB, WBDC)
+		Store (\_SB.PCI0.LPCB.EC.WWEB, WWAN)
+	}
+
+	/*
+	 * Called from _WAK
+	 */
+	Method (WAKE, 1)
+	{
+		If (HAST) {
+			Store (WBDC, \_SB.PCI0.LPCB.EC.BTEB)
+			Store (WWAN, \_SB.PCI0.LPCB.EC.WWEB)
+		}
+	}
 }
diff --git a/src/mainboard/lenovo/t400/acpi/platform.asl b/src/mainboard/lenovo/t400/acpi/platform.asl
index 5c6f968..85357a5 100644
--- a/src/mainboard/lenovo/t400/acpi/platform.asl
+++ b/src/mainboard/lenovo/t400/acpi/platform.asl
@@ -31,6 +31,9 @@
 
 Method(_WAK,1)
 {
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	// CPU specific part
 
 	// Notify PCI Express slots in case a card
diff --git a/src/mainboard/lenovo/t420s/acpi/platform.asl b/src/mainboard/lenovo/t420s/acpi/platform.asl
index 6f26c5a..e4c8a24 100644
--- a/src/mainboard/lenovo/t420s/acpi/platform.asl
+++ b/src/mainboard/lenovo/t420s/acpi/platform.asl
@@ -32,6 +32,9 @@
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
 
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented. */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/t430/acpi/platform.asl b/src/mainboard/lenovo/t430/acpi/platform.asl
index efbf0ea..13ea2c1 100644
--- a/src/mainboard/lenovo/t430/acpi/platform.asl
+++ b/src/mainboard/lenovo/t430/acpi/platform.asl
@@ -18,6 +18,10 @@
 	/* ME may not be up yet.  */
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
+
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	Return(Package(){0,0})
 }
 
diff --git a/src/mainboard/lenovo/t430s/acpi/platform.asl b/src/mainboard/lenovo/t430s/acpi/platform.asl
index 6f26c5a..e4c8a24 100644
--- a/src/mainboard/lenovo/t430s/acpi/platform.asl
+++ b/src/mainboard/lenovo/t430s/acpi/platform.asl
@@ -32,6 +32,9 @@
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
 
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented. */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/t520/acpi/platform.asl b/src/mainboard/lenovo/t520/acpi/platform.asl
index 6f26c5a..e4c8a24 100644
--- a/src/mainboard/lenovo/t520/acpi/platform.asl
+++ b/src/mainboard/lenovo/t520/acpi/platform.asl
@@ -32,6 +32,9 @@
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
 
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented. */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/t530/acpi/platform.asl b/src/mainboard/lenovo/t530/acpi/platform.asl
index 9cd327a..bf686f4 100644
--- a/src/mainboard/lenovo/t530/acpi/platform.asl
+++ b/src/mainboard/lenovo/t530/acpi/platform.asl
@@ -32,6 +32,9 @@
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
 
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented.  */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/t60/acpi/platform.asl b/src/mainboard/lenovo/t60/acpi/platform.asl
index 006b6f0..f9e991b 100644
--- a/src/mainboard/lenovo/t60/acpi/platform.asl
+++ b/src/mainboard/lenovo/t60/acpi/platform.asl
@@ -29,6 +29,9 @@
 
 Method(_WAK,1)
 {
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	// CPU specific part
 
 	// Notify PCI Express slots in case a card
diff --git a/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl b/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl
index 3e9225c..b63c91c 100644
--- a/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl
+++ b/src/mainboard/lenovo/x1_carbon_gen1/acpi/platform.asl
@@ -30,6 +30,9 @@
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
 
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented.  */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/x200/acpi/platform.asl b/src/mainboard/lenovo/x200/acpi/platform.asl
index 5c6f968..85357a5 100644
--- a/src/mainboard/lenovo/x200/acpi/platform.asl
+++ b/src/mainboard/lenovo/x200/acpi/platform.asl
@@ -31,6 +31,9 @@
 
 Method(_WAK,1)
 {
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	// CPU specific part
 
 	// Notify PCI Express slots in case a card
diff --git a/src/mainboard/lenovo/x201/acpi/platform.asl b/src/mainboard/lenovo/x201/acpi/platform.asl
index 0a6d5f3..7d7013b 100644
--- a/src/mainboard/lenovo/x201/acpi/platform.asl
+++ b/src/mainboard/lenovo/x201/acpi/platform.asl
@@ -63,6 +63,9 @@
 
 Method(_WAK,1)
 {
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented.  */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/x220/acpi/platform.asl b/src/mainboard/lenovo/x220/acpi/platform.asl
index 9cd327a..bf686f4 100644
--- a/src/mainboard/lenovo/x220/acpi/platform.asl
+++ b/src/mainboard/lenovo/x220/acpi/platform.asl
@@ -32,6 +32,9 @@
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
 
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented.  */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/x230/acpi/platform.asl b/src/mainboard/lenovo/x230/acpi/platform.asl
index 9cd327a..bf686f4 100644
--- a/src/mainboard/lenovo/x230/acpi/platform.asl
+++ b/src/mainboard/lenovo/x230/acpi/platform.asl
@@ -32,6 +32,9 @@
 	Store (0, \_TZ.MEB1)
 	Store (0, \_TZ.MEB2)
 
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	/* Not implemented.  */
 	Return(Package(){0,0})
 }
diff --git a/src/mainboard/lenovo/x60/acpi/platform.asl b/src/mainboard/lenovo/x60/acpi/platform.asl
index 006b6f0..f9e991b 100644
--- a/src/mainboard/lenovo/x60/acpi/platform.asl
+++ b/src/mainboard/lenovo/x60/acpi/platform.asl
@@ -29,6 +29,9 @@
 
 Method(_WAK,1)
 {
+	/* Wake the HKEY to init BT/WWAN */
+	\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
+
 	// CPU specific part
 
 	// Notify PCI Express slots in case a card

-- 
To view, visit https://review.coreboot.org/22377
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I13c08b8c6b1bf0f3deb25a464b26880d8469c005
Gerrit-Change-Number: 22377
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171108/319299b1/attachment-0001.html>


More information about the coreboot-gerrit mailing list