mb/lenovo/x200/dock.asl: Issue DOCK ACPI events based on Dock ID
Some Dock events only need to happen based on the Dock Id (which functions as a presence detect GPIO). Inspired by vendor bios DSDT. This fixes undock ACPI events being issued when pulling out the power when docked or undocked (but still generates one when forcibly undocked) Tested on X200: pull power and see if undock events are generated in dmesg. Change-Id: I1eef971d49508bcd94d5d1cf2b70395b7cd80b1c Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/22919 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kevin Keijzer <kevin@quietlife.nl> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
b2fa1b2494
commit
a17796e601
|
@ -41,6 +41,24 @@ Scope (\_SB)
|
||||||
{
|
{
|
||||||
Return (\_SB.PCI0.LPCB.EC.DKR1)
|
Return (\_SB.PCI0.LPCB.EC.DKR1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Name (G_ID, 0xFFFFFFFF)
|
||||||
|
/* Returns 0x7 (dock absent) or 0x3 (dock present) */
|
||||||
|
Method(GGID, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
Store(G_ID, Local0)
|
||||||
|
if (LEqual(Local0, 0xFFFFFFFF))
|
||||||
|
{
|
||||||
|
Store(Or (Or (GP02, ShiftLeft(GP03, 1)),
|
||||||
|
ShiftLeft(GP04, 2)), Local0)
|
||||||
|
If (LEqual(Local0, 0x00))
|
||||||
|
{
|
||||||
|
Store(0x03, Local0)
|
||||||
|
}
|
||||||
|
Store(Local0, G_ID)
|
||||||
|
}
|
||||||
|
return (Local0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,18 +79,37 @@ Scope(\_SB.PCI0.LPCB.EC)
|
||||||
Notify(\_SB.DOCK, 3)
|
Notify(\_SB.DOCK, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Undock button on dock */
|
||||||
Method(_Q50, 0, NotSerialized)
|
Method(_Q50, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
Store(\_SB.DOCK.GGID (), Local0)
|
||||||
|
if (LNotEqual(Local0, 0x07))
|
||||||
{
|
{
|
||||||
Notify(\_SB.DOCK, 3)
|
Notify(\_SB.DOCK, 3)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Method(_Q58, 0, NotSerialized)
|
Method(_Q58, 0, NotSerialized)
|
||||||
{
|
{
|
||||||
Notify(\_SB.DOCK, 0)
|
Notify(\_SB.DOCK, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unplug power: only disconnect dock on force eject */
|
||||||
Method(_Q5A, 0, NotSerialized)
|
Method(_Q5A, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
Store(\_SB.DOCK.GGID (), Local0)
|
||||||
|
if (LEqual(Local0, 0x07))
|
||||||
{
|
{
|
||||||
Notify(\_SB.DOCK, 3)
|
Notify(\_SB.DOCK, 3)
|
||||||
}
|
}
|
||||||
|
if (LEqual(Local0, 0x03))
|
||||||
|
{
|
||||||
|
Sleep(0x64)
|
||||||
|
Store(DKR1, Local1)
|
||||||
|
if (LEqual(Local1, 1))
|
||||||
|
{
|
||||||
|
Notify(\_SB.DOCK, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue