ec/lenovo/h8/acpi: Apply state on wake
Implement ACPI S3 resume control to restore the state before entering sleep. * 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@das-labor.org> Reviewed-on: https://review.coreboot.org/22377 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
parent
f281b6d175
commit
31fb846c59
|
@ -157,6 +157,11 @@ Device (HKEY)
|
||||||
Return (\_SB.PCI0.LPCB.EC.GSTS)
|
Return (\_SB.PCI0.LPCB.EC.GSTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Has thinkpad_acpi module loaded */
|
||||||
|
Name (HAST, 0)
|
||||||
|
|
||||||
|
/* State after sleep */
|
||||||
|
Name (WBDC, 0)
|
||||||
/*
|
/*
|
||||||
* Returns the current state:
|
* Returns the current state:
|
||||||
* Bit 0: BT HW present
|
* Bit 0: BT HW present
|
||||||
|
@ -165,14 +170,15 @@ Device (HKEY)
|
||||||
*/
|
*/
|
||||||
Method (GBDC, 0)
|
Method (GBDC, 0)
|
||||||
{
|
{
|
||||||
|
Store (One, HAST)
|
||||||
|
|
||||||
If (HBDC) {
|
If (HBDC) {
|
||||||
Store(One, Local0)
|
Store(One, Local0)
|
||||||
If(\_SB.PCI0.LPCB.EC.BTEB)
|
If(\_SB.PCI0.LPCB.EC.BTEB)
|
||||||
{
|
{
|
||||||
Or(Local0, 2, Local0)
|
Or(Local0, 2, Local0)
|
||||||
}
|
}
|
||||||
/* FIXME: Implement state at resume, for now Enabled */
|
Or(Local0, ShiftLeft(WBDC, 2), Local0)
|
||||||
Or(Local0, 4, Local0)
|
|
||||||
Return (Local0)
|
Return (Local0)
|
||||||
} Else {
|
} Else {
|
||||||
Return (0)
|
Return (0)
|
||||||
|
@ -186,14 +192,18 @@ Device (HKEY)
|
||||||
*/
|
*/
|
||||||
Method (SBDC, 1)
|
Method (SBDC, 1)
|
||||||
{
|
{
|
||||||
|
Store (One, HAST)
|
||||||
|
|
||||||
If (HBDC) {
|
If (HBDC) {
|
||||||
ShiftRight (And(Arg0, 2), 1, Local0)
|
ShiftRight (And(Arg0, 2), 1, Local0)
|
||||||
Store (Local0, \_SB.PCI0.LPCB.EC.BTEB)
|
Store (Local0, \_SB.PCI0.LPCB.EC.BTEB)
|
||||||
|
ShiftRight (And(Arg0, 4), 2, Local0)
|
||||||
/* FIXME: Store state at resume */
|
Store (Local0, WBDC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* State after sleep */
|
||||||
|
Name (WWAN, 0)
|
||||||
/*
|
/*
|
||||||
* Returns the current state:
|
* Returns the current state:
|
||||||
* Bit 0: WWAN HW present
|
* Bit 0: WWAN HW present
|
||||||
|
@ -202,14 +212,15 @@ Device (HKEY)
|
||||||
*/
|
*/
|
||||||
Method (GWAN, 0)
|
Method (GWAN, 0)
|
||||||
{
|
{
|
||||||
|
Store (One, HAST)
|
||||||
|
|
||||||
If (HWAN) {
|
If (HWAN) {
|
||||||
Store(One, Local0)
|
Store(One, Local0)
|
||||||
If(\_SB.PCI0.LPCB.EC.WWEB)
|
If(\_SB.PCI0.LPCB.EC.WWEB)
|
||||||
{
|
{
|
||||||
Or(Local0, 2, Local0)
|
Or(Local0, 2, Local0)
|
||||||
}
|
}
|
||||||
/* FIXME: Implement state at resume, for now Enabled */
|
Or(Local0, ShiftLeft(WWAN, 2), Local0)
|
||||||
Or(Local0, 4, Local0)
|
|
||||||
Return (Local0)
|
Return (Local0)
|
||||||
} Else {
|
} Else {
|
||||||
Return (0)
|
Return (0)
|
||||||
|
@ -223,11 +234,12 @@ Device (HKEY)
|
||||||
*/
|
*/
|
||||||
Method (SWAN, 1)
|
Method (SWAN, 1)
|
||||||
{
|
{
|
||||||
|
Store (One, HAST)
|
||||||
|
|
||||||
If (HWAN) {
|
If (HWAN) {
|
||||||
ShiftRight (And(Arg0, 2), 1, Local0)
|
ShiftRight (And(Arg0, 2), 1, Local0)
|
||||||
Store (Local0, \_SB.PCI0.LPCB.EC.WWEB)
|
Store (Local0, \_SB.PCI0.LPCB.EC.WWEB)
|
||||||
|
ShiftRight (And(Arg0, 4), 2, WWAN)
|
||||||
/* FIXME: Store state at resume */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,4 +303,24 @@ Device (HKEY)
|
||||||
Store (Local0, \_SB.PCI0.LPCB.EC.UWBE)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ Method(_PTS,1)
|
||||||
|
|
||||||
Method(_WAK,1)
|
Method(_WAK,1)
|
||||||
{
|
{
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
// CPU specific part
|
// CPU specific part
|
||||||
|
|
||||||
// Notify PCI Express slots in case a card
|
// Notify PCI Express slots in case a card
|
||||||
|
|
|
@ -32,6 +32,9 @@ Method(_WAK,1)
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,10 @@ Method(_WAK,1)
|
||||||
/* ME may not be up yet. */
|
/* ME may not be up yet. */
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ Method(_WAK,1)
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ Method(_WAK,1)
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ Method(_WAK,1)
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@ Method(_PTS,1)
|
||||||
|
|
||||||
Method(_WAK,1)
|
Method(_WAK,1)
|
||||||
{
|
{
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
// CPU specific part
|
// CPU specific part
|
||||||
|
|
||||||
// Notify PCI Express slots in case a card
|
// Notify PCI Express slots in case a card
|
||||||
|
|
|
@ -30,6 +30,9 @@ Method(_WAK,1)
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ Method(_PTS,1)
|
||||||
|
|
||||||
Method(_WAK,1)
|
Method(_WAK,1)
|
||||||
{
|
{
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
// CPU specific part
|
// CPU specific part
|
||||||
|
|
||||||
// Notify PCI Express slots in case a card
|
// Notify PCI Express slots in case a card
|
||||||
|
|
|
@ -63,6 +63,9 @@ Method(_PTS,1)
|
||||||
|
|
||||||
Method(_WAK,1)
|
Method(_WAK,1)
|
||||||
{
|
{
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ Method(_WAK,1)
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ Method(_WAK,1)
|
||||||
Store (0, \_TZ.MEB1)
|
Store (0, \_TZ.MEB1)
|
||||||
Store (0, \_TZ.MEB2)
|
Store (0, \_TZ.MEB2)
|
||||||
|
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
Return(Package(){0,0})
|
Return(Package(){0,0})
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@ Method(_PTS,1)
|
||||||
|
|
||||||
Method(_WAK,1)
|
Method(_WAK,1)
|
||||||
{
|
{
|
||||||
|
/* Wake the HKEY to init BT/WWAN */
|
||||||
|
\_SB.PCI0.LPCB.EC.HKEY.WAKE (Arg0)
|
||||||
|
|
||||||
// CPU specific part
|
// CPU specific part
|
||||||
|
|
||||||
// Notify PCI Express slots in case a card
|
// Notify PCI Express slots in case a card
|
||||||
|
|
Loading…
Reference in New Issue