aboutsummaryrefslogtreecommitdiff
path: root/src/ec/hp/kbc1126/acpi/ac.asl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ec/hp/kbc1126/acpi/ac.asl')
-rw-r--r--src/ec/hp/kbc1126/acpi/ac.asl89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/ec/hp/kbc1126/acpi/ac.asl b/src/ec/hp/kbc1126/acpi/ac.asl
new file mode 100644
index 0000000000..3a80f8dedb
--- /dev/null
+++ b/src/ec/hp/kbc1126/acpi/ac.asl
@@ -0,0 +1,89 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Iru Cai <mytbk920423@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+Name (ACST, 0x01)
+Name (SMAR, 0x00)
+
+Field (ECRM, ByteAcc, NoLock, Preserve)
+{
+ Offset (0x84),
+ ADP, 1,
+ ADID, 2
+}
+
+Method (UPAD, 0, Serialized)
+{
+ Acquire (BTMX, 0xFFFF)
+ If ((GACP & 0x01))
+ {
+ GACP &= 0x06
+ Release (BTMX)
+ Acquire (ECMX, 0xFFFF)
+ Local0 = ADP
+ Local1 = ADID
+ Release (ECMX)
+ ACST = Local0
+ SMAR = Local1
+ }
+ Else
+ {
+ Release (BTMX)
+ }
+}
+
+Method (GPID, 0, Serialized)
+{
+ UPAD ()
+ Return (SMAR)
+}
+
+Method (GACS, 0, Serialized) /* get AC status */
+{
+ UPAD ()
+ Return (ACST)
+}
+
+Device (AC)
+{
+ Name (_HID, "ACPI0003")
+ Name (_PCL, Package () { \_SB })
+
+ Method (_STA)
+ {
+ Return (0x0F)
+ }
+
+ Method (_PSR, 0, NotSerialized)
+ {
+ Local0 = GACS ()
+ PWRS = Local0 /* GNVS.PWRS */
+ Local1 = GPID ()
+ ACST = Local0
+ SMAR = Local1
+ Return (Local0)
+ }
+}
+
+Method (_Q06, 0, NotSerialized)
+{
+ Store ("EC: AC STATUS", Debug)
+ PWUP (0x05, (0x02 | 0x01))
+ If (BTDR (0x02))
+ {
+ Notify (AC, 0x80)
+ PNOT ()
+ }
+}