summaryrefslogtreecommitdiff
path: root/src/ec/apple/acpi/lid.asl
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2019-05-30 05:28:56 +0300
committerPatrick Georgi <pgeorgi@google.com>2021-02-05 09:39:31 +0000
commitab5eb89a6f272bf0af49737cb8a4392f566e7b13 (patch)
treed9e64b4144836f6b406d4dd369fb92ee1dac72d9 /src/ec/apple/acpi/lid.asl
parent6e732d34a0c1b87803925065b66076599c1e5642 (diff)
ec/apple: Add ACPI code for Apple MacBooks
- Move ACPI code for Apple MacBooks to a separate directory to avoid its duplication in mainboards - Add AC and lid implementations for newer generations - Rewrite old code using the new ASL syntax Tested on MBA 5,2, MBP 8,1 and MBP 10,1. Change-Id: I3d4585aac8e3ebbfed6ce4d4e39fbc33ac983069 Signed-off-by: Evgeny Zinoviev <me@ch1p.io> Reviewed-on: https://review.coreboot.org/c/coreboot/+/33102 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/ec/apple/acpi/lid.asl')
-rw-r--r--src/ec/apple/acpi/lid.asl41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/ec/apple/acpi/lid.asl b/src/ec/apple/acpi/lid.asl
new file mode 100644
index 0000000000..ec91d8f106
--- /dev/null
+++ b/src/ec/apple/acpi/lid.asl
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Scope(\_SB.PCI0.LPCB.EC)
+{
+ Field(ERAM, ByteAcc, NoLock, Preserve)
+ {
+ Offset(LIDS_OFFSET),
+ LIDS, 1, /* Lid status */
+
+ Offset(WKLD_OFFSET),
+ WKLD, 1, /* Lid wake */
+ }
+
+ Device(LID)
+ {
+ Name(_HID, "PNP0C0D")
+
+ Method(_LID, 0, NotSerialized)
+ {
+ Return(LIDS)
+ }
+
+ Method(_PRW, 0, NotSerialized)
+ {
+#if LIDS_OFFSET == 0x01
+ Return(Package() { 0x1d, 0x03 })
+#else
+ Return(Package() { 0x23, 0x04 })
+#endif
+ }
+
+ Method(_PSW, 1, NotSerialized)
+ {
+ if (Arg0) {
+ WKLD = 1
+ } else {
+ WKLD = 0
+ }
+ }
+ }
+}