summaryrefslogtreecommitdiff
path: root/src/mainboard/system76/bonw14/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/system76/bonw14/acpi')
-rw-r--r--src/mainboard/system76/bonw14/acpi/dgpu.asl123
-rw-r--r--src/mainboard/system76/bonw14/acpi/gpe.asl11
-rw-r--r--src/mainboard/system76/bonw14/acpi/mainboard.asl15
-rw-r--r--src/mainboard/system76/bonw14/acpi/sleep.asl11
4 files changed, 160 insertions, 0 deletions
diff --git a/src/mainboard/system76/bonw14/acpi/dgpu.asl b/src/mainboard/system76/bonw14/acpi/dgpu.asl
new file mode 100644
index 0000000000..6521ee947e
--- /dev/null
+++ b/src/mainboard/system76/bonw14/acpi/dgpu.asl
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Device (\_SB.PCI0.PEG0)
+{
+ Name (_ADR, 0x00010000)
+
+ Device (PEGP)
+ {
+ Name (_ADR, 0)
+
+ // Convert a byte to a hex string, trimming extra parts
+ Method (BHEX, 1)
+ {
+ Local0 = ToHexString(Arg0)
+ Return (Mid(Local0, SizeOf(Local0) - 2, 2))
+ }
+
+ // UUID to string
+ Method (IDST, 1)
+ {
+ Local0 = ""
+ Fprintf(
+ Local0,
+ "%o%o%o%o-%o%o-%o%o-%o%o-%o%o%o%o%o%o",
+ BHEX(DerefOf(Arg0[3])),
+ BHEX(DerefOf(Arg0[2])),
+ BHEX(DerefOf(Arg0[1])),
+ BHEX(DerefOf(Arg0[0])),
+ BHEX(DerefOf(Arg0[5])),
+ BHEX(DerefOf(Arg0[4])),
+ BHEX(DerefOf(Arg0[7])),
+ BHEX(DerefOf(Arg0[6])),
+ BHEX(DerefOf(Arg0[8])),
+ BHEX(DerefOf(Arg0[9])),
+ BHEX(DerefOf(Arg0[10])),
+ BHEX(DerefOf(Arg0[11])),
+ BHEX(DerefOf(Arg0[12])),
+ BHEX(DerefOf(Arg0[13])),
+ BHEX(DerefOf(Arg0[14])),
+ BHEX(DerefOf(Arg0[15]))
+ )
+ Return (Local0)
+ }
+
+ // Safe hex conversion, checks type first
+ Method (SFST, 1)
+ {
+ Local0 = ObjectType(Arg0)
+ If (Local0 == 1 || Local0 == 2 || Local0 == 3) {
+ Return (ToHexString(Arg0))
+ } Else {
+ Return (Concatenate("Type: ", Arg0))
+ }
+ }
+
+ Method (_DSM, 4, Serialized)
+ {
+ Debug = "NVIDIA _DSM"
+ Printf(" Arg0: %o", IDST(Arg0))
+ Printf(" Arg1: %o", SFST(Arg1))
+ Printf(" Arg2: %o", SFST(Arg2))
+ Printf(" Arg3: %o", SFST(Arg3))
+
+ If (Arg0 == ToUUID ("d4a50b75-65c7-46f7-bfb7-41514cea0244")) {
+ If (Arg1 != 0x0102) {
+ Printf(" Invalid Arg1, return 0x80000002")
+ Return (0x80000002)
+ }
+
+ If (Arg2 == 0) {
+ Printf(" Arg2 == 0x00, return supported functions")
+ Return (Buffer (4) { 0x01, 0x00, 0x10, 0x00 })
+ }
+
+ If (Arg2 == 0x14) {
+ Printf(" Arg2 == 0x14, return backlight package")
+ Return (Package (9) {
+ 0x8000A450,
+ 0x0200,
+ 0,
+ 0,
+ 1,
+ 1,
+ 200,
+ 32,
+ 1000
+ })
+ }
+
+ Printf(" Unknown Arg2, return 0x80000002")
+ Return (0x80000002)
+ }
+
+ Printf(" Unknown Arg0, return 0x80000001")
+ Return (0x80000001)
+ }
+
+ // _DOD: Display Output Devices
+ Method (_DOD, 0, NotSerialized)
+ {
+ Return (Package (3) {
+ 0x80008320,
+ 0x80006330,
+ 0x8000A450
+ })
+ }
+
+ Device (HDM0)
+ {
+ Name (_ADR, 0x80008320)
+ }
+
+ Device (DSP0)
+ {
+ Name (_ADR, 0x80006330)
+ }
+
+ Device (DSP1)
+ {
+ Name (_ADR, 0x8000A450)
+ }
+ }
+}
diff --git a/src/mainboard/system76/bonw14/acpi/gpe.asl b/src/mainboard/system76/bonw14/acpi/gpe.asl
new file mode 100644
index 0000000000..7ef9a989c0
--- /dev/null
+++ b/src/mainboard/system76/bonw14/acpi/gpe.asl
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+// GPP_K6 SCI
+Method (_L06, 0, Serialized) {
+ Debug = Concatenate("GPE _L06: ", ToHexString(\_SB.PCI0.LPCB.EC0.WFNO))
+ If (\_SB.PCI0.LPCB.EC0.ECOK) {
+ If (\_SB.PCI0.LPCB.EC0.WFNO == 1) {
+ Notify(\_SB.LID0, 0x80)
+ }
+ }
+}
diff --git a/src/mainboard/system76/bonw14/acpi/mainboard.asl b/src/mainboard/system76/bonw14/acpi/mainboard.asl
new file mode 100644
index 0000000000..0a4c64cc67
--- /dev/null
+++ b/src/mainboard/system76/bonw14/acpi/mainboard.asl
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#define EC_GPE_SCI 0x03 /* GPP_K3 */
+#define EC_GPE_SWI 0x06 /* GPP_K6 */
+#include <ec/system76/ec/acpi/ec.asl>
+
+Scope (\_SB) {
+ #include "sleep.asl"
+}
+
+Scope (\_GPE) {
+ #include "gpe.asl"
+}
+
+#include "dgpu.asl"
diff --git a/src/mainboard/system76/bonw14/acpi/sleep.asl b/src/mainboard/system76/bonw14/acpi/sleep.asl
new file mode 100644
index 0000000000..48c50e075e
--- /dev/null
+++ b/src/mainboard/system76/bonw14/acpi/sleep.asl
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/* Method called from _PTS prior to enter sleep state */
+Method (MPTS, 1) {
+ \_SB.PCI0.LPCB.EC0.PTS (Arg0)
+}
+
+/* Method called from _WAK prior to wakeup */
+Method (MWAK, 1) {
+ \_SB.PCI0.LPCB.EC0.WAK (Arg0)
+}