summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2017-12-17 13:34:30 +0100
committerStefan Reinauer <stefan.reinauer@coreboot.org>2018-01-15 01:06:27 +0000
commita17796e6012041e2d8ebe16b0bde0b99809ee87c (patch)
tree63e9ed0a676648ac7f8bba769dceb70816df4f4d
parentb2fa1b2494d7182852010ddc33f2bbe28e11f06c (diff)
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>
-rw-r--r--src/mainboard/lenovo/x200/acpi/dock.asl41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/mainboard/lenovo/x200/acpi/dock.asl b/src/mainboard/lenovo/x200/acpi/dock.asl
index 0c7c9abcfb..93ad24c418 100644
--- a/src/mainboard/lenovo/x200/acpi/dock.asl
+++ b/src/mainboard/lenovo/x200/acpi/dock.asl
@@ -41,6 +41,24 @@ Scope (\_SB)
{
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,9 +79,14 @@ Scope(\_SB.PCI0.LPCB.EC)
Notify(\_SB.DOCK, 3)
}
+ /* Undock button on dock */
Method(_Q50, 0, NotSerialized)
{
- Notify(\_SB.DOCK, 3)
+ Store(\_SB.DOCK.GGID (), Local0)
+ if (LNotEqual(Local0, 0x07))
+ {
+ Notify(\_SB.DOCK, 3)
+ }
}
Method(_Q58, 0, NotSerialized)
@@ -71,8 +94,22 @@ Scope(\_SB.PCI0.LPCB.EC)
Notify(\_SB.DOCK, 0)
}
+ /* Unplug power: only disconnect dock on force eject */
Method(_Q5A, 0, NotSerialized)
{
- Notify(\_SB.DOCK, 3)
+ Store(\_SB.DOCK.GGID (), Local0)
+ if (LEqual(Local0, 0x07))
+ {
+ Notify(\_SB.DOCK, 3)
+ }
+ if (LEqual(Local0, 0x03))
+ {
+ Sleep(0x64)
+ Store(DKR1, Local1)
+ if (LEqual(Local1, 1))
+ {
+ Notify(\_SB.DOCK, 0)
+ }
+ }
}
}