summaryrefslogtreecommitdiff
path: root/src/ec/starlabs/merlin/variants
diff options
context:
space:
mode:
authorSean Rhodes <sean@starlabs.systems>2021-10-14 20:58:15 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-11-22 14:46:20 +0000
commit296994bec80d27c0dc1f155530fd495fa00bda6c (patch)
tree94049a26b84e3c92e32ece723f0291f21fc29542 /src/ec/starlabs/merlin/variants
parent6973a3e7c481efc89845ecc3c78d7994a3e48b3c (diff)
ec/starlabs: Add standardised ITE EC support
Add EC support that supports different Q Events and EC memory. Created from the ITE IT5570E and IT8987E datasheets, all using data port 0x4e. Tested with Ubuntu 20.04.3 and Windows 10 on: * StarBook Mk V (TGL + IT5570E): * ITE Firmware 1.00 * Merlin Firmware 1.00 * LabTop Mk IV (CML + IT8987E): * ITE Firmware 1.04 * LabTop Mk III (KBL + IT8987E): * ITE Firmware 3.12 Signed-off-by: Sean Rhodes <sean@starlabs.systems> Change-Id: I8023c26de23c874c84106fda96e64dcfa0c5ba32 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58343 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Andy Pont <andy.pont@sdcsystems.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec/starlabs/merlin/variants')
-rw-r--r--src/ec/starlabs/merlin/variants/apl/ecdefs.h26
-rw-r--r--src/ec/starlabs/merlin/variants/apl/emem.asl173
-rw-r--r--src/ec/starlabs/merlin/variants/apl/events.asl99
-rw-r--r--src/ec/starlabs/merlin/variants/cml/ecdefs.h23
-rw-r--r--src/ec/starlabs/merlin/variants/cml/emem.asl171
-rw-r--r--src/ec/starlabs/merlin/variants/cml/events.asl143
-rw-r--r--src/ec/starlabs/merlin/variants/glk/ecdefs.h26
-rw-r--r--src/ec/starlabs/merlin/variants/glk/emem.asl173
-rw-r--r--src/ec/starlabs/merlin/variants/glk/events.asl99
-rw-r--r--src/ec/starlabs/merlin/variants/kbl/ecdefs.h23
-rw-r--r--src/ec/starlabs/merlin/variants/kbl/emem.asl160
-rw-r--r--src/ec/starlabs/merlin/variants/kbl/events.asl275
-rw-r--r--src/ec/starlabs/merlin/variants/merlin/ecdefs.h23
-rw-r--r--src/ec/starlabs/merlin/variants/merlin/emem.asl161
-rw-r--r--src/ec/starlabs/merlin/variants/merlin/events.asl280
-rw-r--r--src/ec/starlabs/merlin/variants/tgl/ecdefs.h23
-rw-r--r--src/ec/starlabs/merlin/variants/tgl/emem.asl168
-rw-r--r--src/ec/starlabs/merlin/variants/tgl/events.asl279
18 files changed, 2325 insertions, 0 deletions
diff --git a/src/ec/starlabs/merlin/variants/apl/ecdefs.h b/src/ec/starlabs/merlin/variants/apl/ecdefs.h
new file mode 100644
index 0000000000..1057da83ff
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/apl/ecdefs.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <assert.h>
+#include <stdint.h>
+
+/*
+ * EC communication interface for ITE Embedded Controller.
+ */
+
+#ifndef _EC_STARLABS_APL_EC_DEFS_H
+#define _EC_STARLABS_APL_EC_DEFS_H
+
+/* IT8987 chip ID byte values. */
+#define ITE_CHIPID_VAL 0x8987
+
+/* EC RAM offsets. */
+#define ECRAM_TRACKPAD_STATE 0x14
+#define ECRAM_KBL_STATE 0x18
+#define ECRAM_KBL_BRIGHTNESS 0x19
+#define ECRAM_KBL_TIMEOUT 0x1a
+#define ECRAM_FN_LOCK_STATE 0x2c
+#define ECRAM_FN_CTRL_REVERSE 0x2d
+#define ECRAM_MAX_CHARGE 0x46
+#define ECRAM_FAN_MODE dead_code_t(uint8_t)
+
+#endif
diff --git a/src/ec/starlabs/merlin/variants/apl/emem.asl b/src/ec/starlabs/merlin/variants/apl/emem.asl
new file mode 100644
index 0000000000..8341bf2bf2
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/apl/emem.asl
@@ -0,0 +1,173 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+OperationRegion (ECF2, EmbeddedControl, 0x00, 0x100)
+Field (ECF2, ByteAcc, Lock, Preserve)
+{
+ Offset(0x00),
+ ECMV, 8, // Major Version Number
+ ECSV, 8, // Minor Version Number
+ KBVS, 8, // Keyboard Controller Version
+ ECTV, 8, // Test Version Number
+ FRMF, 8, // Force Mirror Flag
+ TXEL, 8, // TXE Lock
+
+ Offset(0x10),
+ CPWR, 8, // Control Power
+ CDEV, 8, // Control Device
+ OSFG, 8, // OS Flag
+ CWFU, 8, // CW2015 Full
+ TPLA, 8, // Trackpad State
+ AFG3, 8, // After G3
+ CLTP, 8, // Close Trackpad
+ WKOL, 8, // Wake on Lid
+ KLSE, 8, // Keyboard Backlight State
+ KLBE, 8, // Keyboard Backlight Brightness
+
+ Offset(0x1a),
+ KLTE, 8, // Keyboard Backlight Timeout
+
+ Offset(0x22),
+ ECT0, 8, // EC Build Time 0
+ ECT1, 8, // EC Build Time 1
+ ECT2, 8, // EC Build Time 2
+ ECT3, 8, // EC Build Time 3
+ ECT4, 8, // EC Build Time 4
+ ECT5, 8, // EC Build Time 5
+ ECT6, 8, // EC Build Time 6
+ ECT7, 8, // EC Build Time 7
+ ECT8, 8, // EC Build Time 8
+ ECT9, 8, // EC Build Time 9
+
+ Offset(0x2c),
+ FLKA, 8, // Function Lock State
+
+ Offset(0x30),
+ STEF, 8, // Sensor T Error F
+ ECD0, 8, // EC Build Date 0
+ ECD1, 8, // EC Build Date 1
+ ECD2, 8, // EC Build Date 2
+ ECD3, 8, // EC Build Date 3
+ ECD4, 8, // EC Build Date 4
+ ECD5, 8, // EC Build Date 5
+ ECD6, 8, // EC Build Date 6
+ ECD7, 8, // EC Build Date 7
+ ECD8, 8, // EC Build Date 8
+ ECD9, 8, // EC Build Date 9
+
+ Offset(0x40),
+ SHIP, 8, // Shipping Mode Flag
+ LEDF, 8, // LED Control Flag
+ LIDF, 8, // Lid Flag
+ KBFL, 8, // Keyboard Flag
+ CYCC, 8, // Cycle Count
+
+ Offset(0x46),
+ BFCP, 8, // Battery Full Charge Percentage
+
+ Offset(0x62),
+ TSE2, 8, // Sensor 2 Temperature
+ SENF, 8, // Sensor F
+ TSHT, 8, // Thermal Sensor High Trip Point
+ TSLT, 8, // Thermal Sensor Low Trip Point
+ THER, 8, // Thermal Source
+
+ Offset(0x70),
+ CPUT, 8, // PECI CPU Temperature
+ PMXT, 8, // PLMX Temperature
+ CHAR, 8, // Charger Temperature
+
+ Offset(0x7e),
+ OCTF, 8, // OEM Control Flag
+ LSTE, 1, // Lid Status
+ , 7, // Reserved
+
+ Offset(0x80),
+ ECPS, 8, // AC & Battery status
+ B1MN, 8, // Battery Model Number Code
+ B1SN, 16, // Battery Serial Number
+ B1DC, 16, // Battery Design Capacity
+ B1DV, 16, // Battery Design Voltage
+ B1FC, 16, // Battery Last Full Charge Capacity
+ B1TP, 16, // Battery Trip Point
+ B1ST, 8, // Battery State
+ B1PR, 16, // Battery Present Rate
+ B1RC, 16, // Battery Remaining Capacity
+ B1PV, 16, // Battery Present Voltage
+ BPRP, 8, // Battery Remaining percentage
+ BT1A, 8, // Bt1 ASOC
+ BT1T, 16, // Bt1 Temperature
+ BT1C, 8, // Bt1 Control
+
+ // Unicorn - doesn't actually exist
+ Offset(0x9d),
+ OPWE, 8, // OPM write to EC flag for UCSI
+ // Unicorn - doesn't actually exist
+
+ Offset(0xbf),
+ EJ8A, 8, // EJ898A Firmware Version
+
+ Offset(0xc0),
+ MGI0, 8, // UCSI DS MGI 0
+ MGI1, 8, // UCSI DS MGI 1
+ MGI2, 8, // UCSI DS MGI 2
+ MGI3, 8, // UCSI DS MGI 3
+ MGI4, 8, // UCSI DS MGI 4
+ MGI5, 8, // UCSI DS MGI 5
+ MGI6, 8, // UCSI DS MGI 6
+ MGI7, 8, // UCSI DS MGI 7
+ MGI8, 8, // UCSI DS MGI 8
+ MGI9, 8, // UCSI DS MGI 9
+ MGIA, 8, // UCSI DS MGI A
+ MGIB, 8, // UCSI DS MGI B
+ MGIC, 8, // UCSI DS MGI C
+ MGID, 8, // UCSI DS MGI D
+ MGIE, 8, // UCSI DS MGI E
+ MGIF, 8, // UCSI DS MGI F
+
+ Offset(0xd0),
+ MGO0, 8, // UCSI DS MGO 0
+ MGO1, 8, // UCSI DS MGO 1
+ MGO2, 8, // UCSI DS MGO 2
+ MGO3, 8, // UCSI DS MGO 3
+ MGO4, 8, // UCSI DS MGO 4
+ MGO5, 8, // UCSI DS MGO 5
+ MGO6, 8, // UCSI DS MGO 6
+ MGO7, 8, // UCSI DS MGO 7
+ MGO8, 8, // UCSI DS MGO 8
+ MGO9, 8, // UCSI DS MGO 9
+ MGOA, 8, // UCSI DS MGO A
+ MGOB, 8, // UCSI DS MGO B
+ MGOC, 8, // UCSI DS MGO C
+ MGOD, 8, // UCSI DS MGO D
+ MGOE, 8, // UCSI DS MGO E
+ MGOF, 8, // UCSI DS MGO F
+
+ Offset(0xe0),
+ UCSV, 16, // UCSI DS Version
+ UCSD, 16, // UCSI DS Reserved
+ CCI0, 8, // UCSI DS CCI 0
+ CCI1, 8, // UCSI DS CCI 1
+ CCI2, 8, // UCSI DS CCI 2
+ CCI3, 8, // UCSI DS CCI 3
+ CTL0, 8, // UCSI DS Control 0
+ CTL1, 8, // UCSI DS Control 0
+ CTL2, 8, // UCSI DS Control 0
+ CTL3, 8, // UCSI DS Control 0
+ CTL4, 8, // UCSI DS Control 0
+ CTL5, 8, // UCSI DS Control 0
+ CTL6, 8, // UCSI DS Control 0
+ CTL7, 8, // UCSI DS Control 0
+
+ Offset(0xf0),
+ P0SD, 8, // PD Port Status DD
+ P0S4, 8, // PD Port Status 4
+ P0S5, 8, // PD Port Status 5
+ P0SE, 8, // PD Port Status E
+ P0SA, 8, // PD Port Status 10
+ P0SB, 8, // PD Port Status 11
+
+ Offset(0xfd),
+ STCD, 8, // Shutdown Code
+ EJ8R, 8, // EJ898A Need Reboot
+ EJ8E, 8, // EJ898A Error
+}
diff --git a/src/ec/starlabs/merlin/variants/apl/events.asl b/src/ec/starlabs/merlin/variants/apl/events.asl
new file mode 100644
index 0000000000..5271d8e930
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/apl/events.asl
@@ -0,0 +1,99 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Method (_Q0D, 0, NotSerialized) // Event: Lid Opened
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0C, 0, NotSerialized) // Event: Lid Closed
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0A, 0, NotSerialized) // Event: AC Power Connected
+{
+ Notify (BAT0, 0x81)
+ Notify (ADP1, 0x80)
+}
+
+Method (_Q0B, 0, NotSerialized) // Event: AC Power Disconnected
+{
+ Notify (BAT0, 0x81)
+ Notify (BAT0, 0x80)
+}
+
+Method (_Q06, 0, NotSerialized) // Event: Backlight Brightness Down
+{
+ ^^^^HIDD.HPEM (20)
+}
+
+Method (_Q07, 0, NotSerialized) // Event: Backlight Brightness Up
+{
+ ^^^^HIDD.HPEM (19)
+}
+
+Method (_Q08, 0, NotSerialized) // Event: Function Lock
+{
+ FLKS = FLKA
+}
+//
+// TODO:
+// Below Q Events need to be added
+//
+// Method (_Q04, 0, NotSerialized) // Event: Trackpad Lock
+// {
+// TPLS = TPLA
+// }
+//
+// Method (_Q__, 0, NotSerialized) // Event: Keyboard Backlight Brightness
+// {
+// KLBC = KLBE
+// }
+//
+
+Method (_Q99, 0, NotSerialized) // Event: Airplane Mode
+{
+ ^^^^HIDD.HPEM (8)
+}
+
+Method (_QD5, 0, NotSerialized) // Event: 10 Second Power Button Pressed
+{
+ Notify (HIDD, 0xCE)
+}
+
+Method (_QD6, 0, NotSerialized) // Event: 10 Second Power Button Released
+{
+ Notify (HIDD, 0xCF)
+}
+
+Method (_Q22, 0, NotSerialized) // Event: CHARGER_T
+{
+ Store ("EC: CHARGER_T", Debug)
+}
+
+Method (_Q80, 0, NotSerialized) // Event: Volume Up
+{
+ Store ("EC: VOLUME_UP", Debug)
+}
+
+Method (_Q81, 0, NotSerialized) // Event: Volume Down
+{
+ Store ("EC: VOLUME_DOWN", Debug)
+}
+
+Method (_Q54, 0, NotSerialized) // Event: Power Button Press
+{
+ Store ("EC: PWRBTN", Debug)
+}
+
+Method (_QF0, 0, NotSerialized) // Event: Temperature Report
+{
+ Store ("EC: Temperature Report", Debug)
+}
+
+Method (_QF1, 0, NotSerialized) // Event: Temperature Trigger
+{
+ // Notify (SEN3, 0x90)
+}
diff --git a/src/ec/starlabs/merlin/variants/cml/ecdefs.h b/src/ec/starlabs/merlin/variants/cml/ecdefs.h
new file mode 100644
index 0000000000..42b4d44d52
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/cml/ecdefs.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * EC communication interface for ITE Embedded Controller
+ */
+
+#ifndef _EC_STARLABS_CML_EC_DEFS_H
+#define _EC_STARLABS_CML_EC_DEFS_H
+
+/* IT8987 chip ID byte values */
+#define ITE_CHIPID_VAL 0x8987
+
+/* EC RAM offsets */
+#define ECRAM_KBL_TIMEOUT 0x07
+#define ECRAM_FN_CTRL_REVERSE 0x08
+#define ECRAM_FAN_MODE 0x09
+#define ECRAM_MAX_CHARGE 0x10
+#define ECRAM_TRACKPAD_STATE 0x14
+#define ECRAM_KBL_STATE 0x18
+#define ECRAM_KBL_BRIGHTNESS 0x19
+#define ECRAM_FN_LOCK_STATE 0x2c
+
+#endif
diff --git a/src/ec/starlabs/merlin/variants/cml/emem.asl b/src/ec/starlabs/merlin/variants/cml/emem.asl
new file mode 100644
index 0000000000..1a4a48f60f
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/cml/emem.asl
@@ -0,0 +1,171 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+OperationRegion (ECF2, EmbeddedControl, 0x00, 0x100)
+Field (ECF2, ByteAcc, Lock, Preserve)
+{
+ Offset(0x00),
+ ECMV, 8, // Major Version Number
+ ECSV, 8, // Minor Version Number
+ KBVS, 8, // Keyboard Controller Version
+ ECTV, 8, // Test Version Number
+ FRMF, 8, // Force Mirror Flag
+ TXEL, 8, // TXE Lock
+ SSIT, 8, // Show Setup Items
+ KLTE, 8, // Keyboard Backlight Timeout
+ FCLA, 8, // Fn Ctrl Reverse
+ FANM, 8, // Fan Mode
+
+ Offset(0x0a),
+ P0MV, 8, // PD Port 0 Major Version
+ P0SV, 8, // PD Port 0 Minor Version
+ P1MV, 8, // PD Port 1 Major Version
+ P1SV, 8, // PD Port 1 Minor Version
+
+ Offset(0x10),
+ BFCP, 8, // Battery Full Charge Percentage
+ CDEV, 8, // Control Device
+ OSFG, 8, // OS Flag
+
+ Offset(0x14),
+ TPLA, 8, // Trackpad State
+ AFG3, 8, // After G3
+ CLTP, 8, // Close Trackpad
+ WKOL, 8, // Wake on Lid
+ KLSE, 8, // Keyboard Backlight State
+ KLBE, 8, // Keyboard Backlight Brightness
+
+ Offset(0x1a),
+ CWFU, 8, // CW2015 Full
+
+ Offset(0x1c),
+ WIFI, 8, // WiFi Enable
+
+ Offset(0x22),
+ ECT0, 8, // EC Build Time 0
+ ECT1, 8, // EC Build Time 1
+ ECT2, 8, // EC Build Time 2
+ ECT3, 8, // EC Build Time 3
+ ECT4, 8, // EC Build Time 4
+ ECT5, 8, // EC Build Time 5
+ ECT6, 8, // EC Build Time 6
+ ECT7, 8, // EC Build Time 7
+ ECT8, 8, // EC Build Time 8
+ ECT9, 8, // EC Build Time 9
+ FLKA, 8, // Function Lock State
+ MICF, 8, // Mic Flag
+ MUTF, 8, // Mute Flag
+ BC12, 8, // BC12 Flag
+
+ Offset(0x30),
+ STEF, 8, // Sensor T Error F
+ ECD0, 8, // EC Build Date 0
+ ECD1, 8, // EC Build Date 1
+ ECD2, 8, // EC Build Date 2
+ ECD3, 8, // EC Build Date 3
+ ECD4, 8, // EC Build Date 4
+ ECD5, 8, // EC Build Date 5
+ ECD6, 8, // EC Build Date 6
+ ECD7, 8, // EC Build Date 7
+ ECD8, 8, // EC Build Date 8
+ ECD9, 8, // EC Build Date 9
+
+ Offset(0x4c),
+ PJN0, 8, // Project Name 0
+ PJN1, 8, // Project Name 1
+ PJN2, 8, // Project Name 2
+ PJN3, 8, // Project Name 3
+
+ Offset(0x62),
+ TSE2, 8, // Sensor 2 Temperature
+ SENF, 8, // Sensor F
+ TSHT, 8, // Thermal Sensor High Trip Point
+ TSLT, 8, // Thermal Sensor Low Trip Point
+ THER, 8, // Thermal Source
+
+ Offset(0x70),
+ CPUT, 8, // PECI CPU Temperature
+ PMXT, 8, // PLMX Temperature
+ CHAR, 8, // Charger Temperature
+
+ Offset(0x7f),
+ LSTE, 1, // Lid Status
+ , 7, // Reserved
+
+ Offset(0x80),
+ ECPS, 8, // AC & Battery status
+ B1MN, 8, // Battery Model Number Code
+ B1SN, 16, // Battery Serial Number
+ B1DC, 16, // Battery Design Capacity
+ B1DV, 16, // Battery Design Voltage
+ B1FC, 16, // Battery Last Full Charge Capacity
+ B1TP, 16, // Battery Trip Point
+ B1ST, 8, // Battery State
+ B1PR, 16, // Battery Present Rate
+ B1RC, 16, // Battery Remaining Capacity
+ B1PV, 16, // Battery Present Voltage
+ BPRP, 8, // Battery Remaining percentage
+ BT1A, 8, // Bt1 ASOC
+ BT1T, 16, // Bt1 Temperature
+ BT1C, 8, // Bt1 Control
+
+ // Unicorn - doesn't actually exist
+ Offset(0x9d),
+ OPWE, 8, // OPM write to EC flag for UCSI
+ // Unicorn - doesn't actually exist
+
+ Offset(0xa0),
+ UCSV, 16, // UCSI DS Version
+ UCSD, 16, // UCSI DS Reserved
+ CCI0, 8, // UCSI DS CCI 0
+ CCI1, 8, // UCSI DS CCI 1
+ CCI2, 8, // UCSI DS CCI 2
+ CCI3, 8, // UCSI DS CCI 3
+ CTL0, 8, // UCSI DS Control 0
+ CTL1, 8, // UCSI DS Control 0
+ CTL2, 8, // UCSI DS Control 0
+ CTL3, 8, // UCSI DS Control 0
+ CTL4, 8, // UCSI DS Control 0
+ CTL5, 8, // UCSI DS Control 0
+ CTL6, 8, // UCSI DS Control 0
+ CTL7, 8, // UCSI DS Control 0
+
+ Offset(0xb0),
+ MGI0, 8, // UCSI DS MGI 0
+ MGI1, 8, // UCSI DS MGI 1
+ MGI2, 8, // UCSI DS MGI 2
+ MGI3, 8, // UCSI DS MGI 3
+ MGI4, 8, // UCSI DS MGI 4
+ MGI5, 8, // UCSI DS MGI 5
+ MGI6, 8, // UCSI DS MGI 6
+ MGI7, 8, // UCSI DS MGI 7
+ MGI8, 8, // UCSI DS MGI 8
+ MGI9, 8, // UCSI DS MGI 9
+ MGIA, 8, // UCSI DS MGI A
+ MGIB, 8, // UCSI DS MGI B
+ MGIC, 8, // UCSI DS MGI C
+ MGID, 8, // UCSI DS MGI D
+ MGIE, 8, // UCSI DS MGI E
+ MGIF, 8, // UCSI DS MGI F
+
+ Offset(0xc0),
+ MGO0, 8, // UCSI DS MGO 0
+ MGO1, 8, // UCSI DS MGO 1
+ MGO2, 8, // UCSI DS MGO 2
+ MGO3, 8, // UCSI DS MGO 3
+ MGO4, 8, // UCSI DS MGO 4
+ MGO5, 8, // UCSI DS MGO 5
+ MGO6, 8, // UCSI DS MGO 6
+ MGO7, 8, // UCSI DS MGO 7
+ MGO8, 8, // UCSI DS MGO 8
+ MGO9, 8, // UCSI DS MGO 9
+ MGOA, 8, // UCSI DS MGO A
+ MGOB, 8, // UCSI DS MGO B
+ MGOC, 8, // UCSI DS MGO C
+ MGOD, 8, // UCSI DS MGO D
+ MGOE, 8, // UCSI DS MGO E
+ MGOF, 8, // UCSI DS MGO F
+
+ Offset(0xe6),
+ ECWD, 16, // EC Wakeup Delay
+ ECWE, 8, // EC Wakeup Enable
+}
diff --git a/src/ec/starlabs/merlin/variants/cml/events.asl b/src/ec/starlabs/merlin/variants/cml/events.asl
new file mode 100644
index 0000000000..9333c9e3e4
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/cml/events.asl
@@ -0,0 +1,143 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Method (_Q0D, 0, NotSerialized) // Event: Lid Opened
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0C, 0, NotSerialized) // Event: Lid Closed
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_QA0, 0, NotSerialized) // Event: AC Power Connected
+{
+ Notify (BAT0, 0x81)
+ Notify (ADP1, 0x80)
+}
+
+Method (_Q0B, 0, NotSerialized) // Event: AC Power Disconnected
+{
+ Notify (BAT0, 0x81)
+ Notify (BAT0, 0x80)
+}
+
+Method (_Q06, 0, NotSerialized) // Event: Backlight Brightness Down
+{
+ ^^^^HIDD.HPEM (20)
+}
+
+Method (_Q07, 0, NotSerialized) // Event: Backlight Brightness Up
+{
+ ^^^^HIDD.HPEM (19)
+}
+
+Method (_Q08, 0, NotSerialized) // Event: Function Lock
+{
+ FLKS = FLKA
+}
+
+Method (_Q04, 0, NotSerialized) // Event: Trackpad Lock
+{
+ TPLS = TPLA
+}
+//
+// TODO:
+// Below Q Events need to be added
+//
+Method (_Q11) // Event: Keyboard Backlight Brightness
+{
+ KLBC = KLBE
+}
+
+Method (_Q99, 0, NotSerialized) // Event: Airplane Mode
+{
+ ^^^^HIDD.HPEM (8)
+}
+
+Method (_QD5, 0, NotSerialized) // Event: 10 Second Power Button Pressed
+{
+ Notify (HIDD, 0xCE)
+}
+
+Method (_QD6, 0, NotSerialized) // Event: 10 Second Power Button Released
+{
+ Notify (HIDD, 0xCF)
+}
+
+Method (_Q22, 0, NotSerialized) // Event: CHARGER_T
+{
+ Store ("EC: CHARGER_T", Debug)
+}
+
+Method (_Q40, 0, NotSerialized) // Event: AC and DC Power
+{
+ SMB2 = 0xC6
+}
+
+Method (_Q41, 0, NotSerialized) // Event: Battery Charge between 0% and 20%
+{
+ SMB2 = 0xC7
+}
+
+Method (_Q42, 0, NotSerialized) // Event: Battery Charge between 20% and 60%
+{
+ SMB2 = 0xC8
+}
+
+Method (_Q43, 0, NotSerialized) // Event: Battery Charge between 60% and 100%
+{
+ SMB2 = 0xC9
+}
+
+Method (_Q44, 0, NotSerialized) // Event: AC Power Only
+{
+ SMB2 = 0xCA
+}
+
+Method (_Q80, 0, NotSerialized) // Event: Volume Up
+{
+ Store ("EC: VOLUME_UP", Debug)
+}
+
+Method (_Q81, 0, NotSerialized) // Event: Volume Down
+{
+ Store ("EC: VOLUME_DOWN", Debug)
+}
+
+Method (_Q54, 0, NotSerialized) // Event: Power Button Press
+{
+ Store ("EC: PWRBTN", Debug)
+}
+
+Method (_QF0, 0, NotSerialized) // Event: Temperature Report
+{
+ Store ("EC: Temperature Report", Debug)
+}
+
+Method (_QF1, 0, NotSerialized) // Event: Temperature Trigger
+{
+ // Notify (SEN3, 0x90)
+}
+
+/*
+ * The below events are unique to this platform.
+ */
+
+
+Method (_Q02, 0, NotSerialized) // Event: APP
+{
+ Store ("EC: APP", Debug)
+}
+
+Method (_Q82, 0, NotSerialized) // Event: MIC
+{
+ Store ("EC: MIC", Debug)
+}
+
+Method (_Q83, 0, NotSerialized) // Event: MUTE
+{
+ Store ("EC: MUTE", Debug)
+}
diff --git a/src/ec/starlabs/merlin/variants/glk/ecdefs.h b/src/ec/starlabs/merlin/variants/glk/ecdefs.h
new file mode 100644
index 0000000000..5f43991aef
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/glk/ecdefs.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <assert.h>
+#include <stdint.h>
+
+/*
+ * EC communication interface for ITE Embedded Controller.
+ */
+
+#ifndef _EC_STARLABS_GLK_EC_DEFS_H
+#define _EC_STARLABS_GLK_EC_DEFS_H
+
+/* IT8987 chip ID byte values. */
+#define ITE_CHIPID_VAL 0x8987
+
+/* EC RAM offsets. */
+#define ECRAM_TRACKPAD_STATE 0x14
+#define ECRAM_KBL_STATE 0x18
+#define ECRAM_KBL_BRIGHTNESS 0x19
+#define ECRAM_KBL_TIMEOUT 0x1a
+#define ECRAM_FN_LOCK_STATE 0x2c
+#define ECRAM_FN_CTRL_REVERSE 0x2d
+#define ECRAM_MAX_CHARGE 0x46
+#define ECRAM_FAN_MODE dead_code_t(uint8_t)
+
+#endif
diff --git a/src/ec/starlabs/merlin/variants/glk/emem.asl b/src/ec/starlabs/merlin/variants/glk/emem.asl
new file mode 100644
index 0000000000..8341bf2bf2
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/glk/emem.asl
@@ -0,0 +1,173 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+OperationRegion (ECF2, EmbeddedControl, 0x00, 0x100)
+Field (ECF2, ByteAcc, Lock, Preserve)
+{
+ Offset(0x00),
+ ECMV, 8, // Major Version Number
+ ECSV, 8, // Minor Version Number
+ KBVS, 8, // Keyboard Controller Version
+ ECTV, 8, // Test Version Number
+ FRMF, 8, // Force Mirror Flag
+ TXEL, 8, // TXE Lock
+
+ Offset(0x10),
+ CPWR, 8, // Control Power
+ CDEV, 8, // Control Device
+ OSFG, 8, // OS Flag
+ CWFU, 8, // CW2015 Full
+ TPLA, 8, // Trackpad State
+ AFG3, 8, // After G3
+ CLTP, 8, // Close Trackpad
+ WKOL, 8, // Wake on Lid
+ KLSE, 8, // Keyboard Backlight State
+ KLBE, 8, // Keyboard Backlight Brightness
+
+ Offset(0x1a),
+ KLTE, 8, // Keyboard Backlight Timeout
+
+ Offset(0x22),
+ ECT0, 8, // EC Build Time 0
+ ECT1, 8, // EC Build Time 1
+ ECT2, 8, // EC Build Time 2
+ ECT3, 8, // EC Build Time 3
+ ECT4, 8, // EC Build Time 4
+ ECT5, 8, // EC Build Time 5
+ ECT6, 8, // EC Build Time 6
+ ECT7, 8, // EC Build Time 7
+ ECT8, 8, // EC Build Time 8
+ ECT9, 8, // EC Build Time 9
+
+ Offset(0x2c),
+ FLKA, 8, // Function Lock State
+
+ Offset(0x30),
+ STEF, 8, // Sensor T Error F
+ ECD0, 8, // EC Build Date 0
+ ECD1, 8, // EC Build Date 1
+ ECD2, 8, // EC Build Date 2
+ ECD3, 8, // EC Build Date 3
+ ECD4, 8, // EC Build Date 4
+ ECD5, 8, // EC Build Date 5
+ ECD6, 8, // EC Build Date 6
+ ECD7, 8, // EC Build Date 7
+ ECD8, 8, // EC Build Date 8
+ ECD9, 8, // EC Build Date 9
+
+ Offset(0x40),
+ SHIP, 8, // Shipping Mode Flag
+ LEDF, 8, // LED Control Flag
+ LIDF, 8, // Lid Flag
+ KBFL, 8, // Keyboard Flag
+ CYCC, 8, // Cycle Count
+
+ Offset(0x46),
+ BFCP, 8, // Battery Full Charge Percentage
+
+ Offset(0x62),
+ TSE2, 8, // Sensor 2 Temperature
+ SENF, 8, // Sensor F
+ TSHT, 8, // Thermal Sensor High Trip Point
+ TSLT, 8, // Thermal Sensor Low Trip Point
+ THER, 8, // Thermal Source
+
+ Offset(0x70),
+ CPUT, 8, // PECI CPU Temperature
+ PMXT, 8, // PLMX Temperature
+ CHAR, 8, // Charger Temperature
+
+ Offset(0x7e),
+ OCTF, 8, // OEM Control Flag
+ LSTE, 1, // Lid Status
+ , 7, // Reserved
+
+ Offset(0x80),
+ ECPS, 8, // AC & Battery status
+ B1MN, 8, // Battery Model Number Code
+ B1SN, 16, // Battery Serial Number
+ B1DC, 16, // Battery Design Capacity
+ B1DV, 16, // Battery Design Voltage
+ B1FC, 16, // Battery Last Full Charge Capacity
+ B1TP, 16, // Battery Trip Point
+ B1ST, 8, // Battery State
+ B1PR, 16, // Battery Present Rate
+ B1RC, 16, // Battery Remaining Capacity
+ B1PV, 16, // Battery Present Voltage
+ BPRP, 8, // Battery Remaining percentage
+ BT1A, 8, // Bt1 ASOC
+ BT1T, 16, // Bt1 Temperature
+ BT1C, 8, // Bt1 Control
+
+ // Unicorn - doesn't actually exist
+ Offset(0x9d),
+ OPWE, 8, // OPM write to EC flag for UCSI
+ // Unicorn - doesn't actually exist
+
+ Offset(0xbf),
+ EJ8A, 8, // EJ898A Firmware Version
+
+ Offset(0xc0),
+ MGI0, 8, // UCSI DS MGI 0
+ MGI1, 8, // UCSI DS MGI 1
+ MGI2, 8, // UCSI DS MGI 2
+ MGI3, 8, // UCSI DS MGI 3
+ MGI4, 8, // UCSI DS MGI 4
+ MGI5, 8, // UCSI DS MGI 5
+ MGI6, 8, // UCSI DS MGI 6
+ MGI7, 8, // UCSI DS MGI 7
+ MGI8, 8, // UCSI DS MGI 8
+ MGI9, 8, // UCSI DS MGI 9
+ MGIA, 8, // UCSI DS MGI A
+ MGIB, 8, // UCSI DS MGI B
+ MGIC, 8, // UCSI DS MGI C
+ MGID, 8, // UCSI DS MGI D
+ MGIE, 8, // UCSI DS MGI E
+ MGIF, 8, // UCSI DS MGI F
+
+ Offset(0xd0),
+ MGO0, 8, // UCSI DS MGO 0
+ MGO1, 8, // UCSI DS MGO 1
+ MGO2, 8, // UCSI DS MGO 2
+ MGO3, 8, // UCSI DS MGO 3
+ MGO4, 8, // UCSI DS MGO 4
+ MGO5, 8, // UCSI DS MGO 5
+ MGO6, 8, // UCSI DS MGO 6
+ MGO7, 8, // UCSI DS MGO 7
+ MGO8, 8, // UCSI DS MGO 8
+ MGO9, 8, // UCSI DS MGO 9
+ MGOA, 8, // UCSI DS MGO A
+ MGOB, 8, // UCSI DS MGO B
+ MGOC, 8, // UCSI DS MGO C
+ MGOD, 8, // UCSI DS MGO D
+ MGOE, 8, // UCSI DS MGO E
+ MGOF, 8, // UCSI DS MGO F
+
+ Offset(0xe0),
+ UCSV, 16, // UCSI DS Version
+ UCSD, 16, // UCSI DS Reserved
+ CCI0, 8, // UCSI DS CCI 0
+ CCI1, 8, // UCSI DS CCI 1
+ CCI2, 8, // UCSI DS CCI 2
+ CCI3, 8, // UCSI DS CCI 3
+ CTL0, 8, // UCSI DS Control 0
+ CTL1, 8, // UCSI DS Control 0
+ CTL2, 8, // UCSI DS Control 0
+ CTL3, 8, // UCSI DS Control 0
+ CTL4, 8, // UCSI DS Control 0
+ CTL5, 8, // UCSI DS Control 0
+ CTL6, 8, // UCSI DS Control 0
+ CTL7, 8, // UCSI DS Control 0
+
+ Offset(0xf0),
+ P0SD, 8, // PD Port Status DD
+ P0S4, 8, // PD Port Status 4
+ P0S5, 8, // PD Port Status 5
+ P0SE, 8, // PD Port Status E
+ P0SA, 8, // PD Port Status 10
+ P0SB, 8, // PD Port Status 11
+
+ Offset(0xfd),
+ STCD, 8, // Shutdown Code
+ EJ8R, 8, // EJ898A Need Reboot
+ EJ8E, 8, // EJ898A Error
+}
diff --git a/src/ec/starlabs/merlin/variants/glk/events.asl b/src/ec/starlabs/merlin/variants/glk/events.asl
new file mode 100644
index 0000000000..5271d8e930
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/glk/events.asl
@@ -0,0 +1,99 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Method (_Q0D, 0, NotSerialized) // Event: Lid Opened
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0C, 0, NotSerialized) // Event: Lid Closed
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0A, 0, NotSerialized) // Event: AC Power Connected
+{
+ Notify (BAT0, 0x81)
+ Notify (ADP1, 0x80)
+}
+
+Method (_Q0B, 0, NotSerialized) // Event: AC Power Disconnected
+{
+ Notify (BAT0, 0x81)
+ Notify (BAT0, 0x80)
+}
+
+Method (_Q06, 0, NotSerialized) // Event: Backlight Brightness Down
+{
+ ^^^^HIDD.HPEM (20)
+}
+
+Method (_Q07, 0, NotSerialized) // Event: Backlight Brightness Up
+{
+ ^^^^HIDD.HPEM (19)
+}
+
+Method (_Q08, 0, NotSerialized) // Event: Function Lock
+{
+ FLKS = FLKA
+}
+//
+// TODO:
+// Below Q Events need to be added
+//
+// Method (_Q04, 0, NotSerialized) // Event: Trackpad Lock
+// {
+// TPLS = TPLA
+// }
+//
+// Method (_Q__, 0, NotSerialized) // Event: Keyboard Backlight Brightness
+// {
+// KLBC = KLBE
+// }
+//
+
+Method (_Q99, 0, NotSerialized) // Event: Airplane Mode
+{
+ ^^^^HIDD.HPEM (8)
+}
+
+Method (_QD5, 0, NotSerialized) // Event: 10 Second Power Button Pressed
+{
+ Notify (HIDD, 0xCE)
+}
+
+Method (_QD6, 0, NotSerialized) // Event: 10 Second Power Button Released
+{
+ Notify (HIDD, 0xCF)
+}
+
+Method (_Q22, 0, NotSerialized) // Event: CHARGER_T
+{
+ Store ("EC: CHARGER_T", Debug)
+}
+
+Method (_Q80, 0, NotSerialized) // Event: Volume Up
+{
+ Store ("EC: VOLUME_UP", Debug)
+}
+
+Method (_Q81, 0, NotSerialized) // Event: Volume Down
+{
+ Store ("EC: VOLUME_DOWN", Debug)
+}
+
+Method (_Q54, 0, NotSerialized) // Event: Power Button Press
+{
+ Store ("EC: PWRBTN", Debug)
+}
+
+Method (_QF0, 0, NotSerialized) // Event: Temperature Report
+{
+ Store ("EC: Temperature Report", Debug)
+}
+
+Method (_QF1, 0, NotSerialized) // Event: Temperature Trigger
+{
+ // Notify (SEN3, 0x90)
+}
diff --git a/src/ec/starlabs/merlin/variants/kbl/ecdefs.h b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h
new file mode 100644
index 0000000000..36cd0207ab
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * EC communication interface for ITE Embedded Controller
+ */
+
+#ifndef _EC_STARLABS_KBL_EC_DEFS_H
+#define _EC_STARLABS_KBL_EC_DEFS_H
+
+/* IT8987 chip ID byte values */
+#define ITE_CHIPID_VAL 0x8987
+
+/* EC RAM offsets */
+#define ECRAM_TRACKPAD_STATE 0x14
+#define ECRAM_KBL_STATE 0x18
+#define ECRAM_KBL_BRIGHTNESS 0x19
+#define ECRAM_KBL_TIMEOUT 0x1a
+#define ECRAM_FN_LOCK_STATE 0x2c
+#define ECRAM_FAN_MODE 0x42
+#define ECRAM_FN_CTRL_REVERSE 0x43
+#define ECRAM_MAX_CHARGE 0xff /* TODO: Add */
+
+#endif
diff --git a/src/ec/starlabs/merlin/variants/kbl/emem.asl b/src/ec/starlabs/merlin/variants/kbl/emem.asl
new file mode 100644
index 0000000000..2959632f84
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/kbl/emem.asl
@@ -0,0 +1,160 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+OperationRegion (ECF2, EmbeddedControl, 0x00, 0x100)
+Field (ECF2, ByteAcc, Lock, Preserve)
+{
+ Offset(0x00),
+ ECMV, 8, // Major Version Number
+ ECSV, 8, // Minor Version Number
+ KBVS, 8, // Keyboard Controller Version
+ ECTV, 8, // Test Version Number
+ FRMF, 8, // Force Mirror Flag
+
+ Offset(0x0c),
+ ECBY, 8, // Build Year
+ ECBM, 8, // Build Month
+ ECBD, 8, // Build Day
+ ECBI, 8, // Build Index
+
+ Offset(0x10),
+ CPWR, 8, // Control Power
+ CDEV, 8, // Control Device
+ OSFG, 8, // OS Flag
+
+ Offset(0x14),
+ TPLA, 8, // Trackpad State
+
+ Offset(0x18),
+ KLSE, 8, // Keyboard Backlight State
+ KLBE, 8, // Keyboard Backlight Brightness
+ KLTE, 8, // Keyboard Backlight Timeout
+
+ Offset(0x20),
+ TCHC, 8, // Thermal Charge CMD
+ TCHF, 8, // Thermal Charge Flag
+
+ Offset(0x2c),
+ FLKA, 8, // Function Lock State
+
+ Offset(0x30),
+ STEF, 8, // Sensor T Error F
+
+ Offset(0x40),
+ SHIP, 8, // Shipping Mode Flag
+
+ Offset(0x42),
+ FANM, 8, // Fan Mode
+ KBFL, 8, // Keyboard Flag
+
+ Offset(0x50),
+ CHRA, 16, // Charge Rate
+ CHIC, 16, // Charge Input Current
+ CHVL, 16, // Charge Vlot
+ CHOP, 16, // Charge Option
+
+ Offset(0x62),
+ TSE2, 8, // Sensor 2 Temperature
+ SENF, 8, // Sensor F
+ TSHT, 8, // Thermal Sensor High Trip Point
+ TSLT, 8, // Thermal Sensor Low Trip Point
+ THER, 8, // Thermal Source
+
+
+ Offset(0x70),
+ CPUT, 8, // PECI CPU Temperature
+ PMXT, 8, // PLMX Temperature
+ CHAR, 8, // Charger Temperature
+
+ Offset(0x7e),
+ OCTF, 8, // OEM Control Flag
+ LSTE, 1, // Lid Status
+ , 7, // Reserved
+
+ Offset(0x80),
+ ECPS, 8, // AC & Battery status
+ B1MN, 8, // Battery Model Number Code
+ B1SN, 16, // Battery Serial Number
+ B1DC, 16, // Battery Design Capacity
+ B1DV, 16, // Battery Design Voltage
+ B1FC, 16, // Battery Last Full Charge Capacity
+ B1TP, 16, // Battery Trip Point
+ B1ST, 8, // Battery State
+ B1PR, 16, // Battery Present Rate
+ B1RC, 16, // Battery Remaining Capacity
+ B1PV, 16, // Battery Present Voltage
+ BPRP, 8, // Battery Remaining percentage
+ BT1A, 8, // Bt1 ASOC
+
+ // Unicorn - doesn't actually exist
+ Offset(0x9d),
+ OPWE, 8, // OPM write to EC flag for UCSI
+ // Unicorn - doesn't actually exist
+
+ Offset(0xbf),
+ EJ8A, 8, // EJ898A Firmware Version
+
+ Offset(0xc0),
+ MGI0, 8, // UCSI DS MGI 0
+ MGI1, 8, // UCSI DS MGI 1
+ MGI2, 8, // UCSI DS MGI 2
+ MGI3, 8, // UCSI DS MGI 3
+ MGI4, 8, // UCSI DS MGI 4
+ MGI5, 8, // UCSI DS MGI 5
+ MGI6, 8, // UCSI DS MGI 6
+ MGI7, 8, // UCSI DS MGI 7
+ MGI8, 8, // UCSI DS MGI 8
+ MGI9, 8, // UCSI DS MGI 9
+ MGIA, 8, // UCSI DS MGI A
+ MGIB, 8, // UCSI DS MGI B
+ MGIC, 8, // UCSI DS MGI C
+ MGID, 8, // UCSI DS MGI D
+ MGIE, 8, // UCSI DS MGI E
+ MGIF, 8, // UCSI DS MGI F
+
+ Offset(0xd0),
+ MGO0, 8, // UCSI DS MGO 0
+ MGO1, 8, // UCSI DS MGO 1
+ MGO2, 8, // UCSI DS MGO 2
+ MGO3, 8, // UCSI DS MGO 3
+ MGO4, 8, // UCSI DS MGO 4
+ MGO5, 8, // UCSI DS MGO 5
+ MGO6, 8, // UCSI DS MGO 6
+ MGO7, 8, // UCSI DS MGO 7
+ MGO8, 8, // UCSI DS MGO 8
+ MGO9, 8, // UCSI DS MGO 9
+ MGOA, 8, // UCSI DS MGO A
+ MGOB, 8, // UCSI DS MGO B
+ MGOC, 8, // UCSI DS MGO C
+ MGOD, 8, // UCSI DS MGO D
+ MGOE, 8, // UCSI DS MGO E
+ MGOF, 8, // UCSI DS MGO F
+
+ Offset(0xe0),
+ UCSV, 16, // UCSI DS Version
+ UCSD, 16, // UCSI DS Reserved
+ CCI0, 8, // UCSI DS CCI 0
+ CCI1, 8, // UCSI DS CCI 1
+ CCI2, 8, // UCSI DS CCI 2
+ CCI3, 8, // UCSI DS CCI 3
+ CTL0, 8, // UCSI DS Control 0
+ CTL1, 8, // UCSI DS Control 0
+ CTL2, 8, // UCSI DS Control 0
+ CTL3, 8, // UCSI DS Control 0
+ CTL4, 8, // UCSI DS Control 0
+ CTL5, 8, // UCSI DS Control 0
+ CTL6, 8, // UCSI DS Control 0
+ CTL7, 8, // UCSI DS Control 0
+
+ Offset(0xf0),
+ P0SD, 8, // PD Port Status DD
+ P0S4, 8, // PD Port Status 4
+ P0S5, 8, // PD Port Status 5
+ P0SE, 8, // PD Port Status E
+ P0SA, 8, // PD Port Status 10
+ P0SB, 8, // PD Port Status 11
+
+ Offset(0xfd),
+ STCD, 8, // Shutdown Code
+ EJ8R, 8, // EJ898A Need Reboot
+ EJ8E, 8, // EJ898A Error
+}
diff --git a/src/ec/starlabs/merlin/variants/kbl/events.asl b/src/ec/starlabs/merlin/variants/kbl/events.asl
new file mode 100644
index 0000000000..d5466327f8
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/kbl/events.asl
@@ -0,0 +1,275 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Method (_Q0D, 0, NotSerialized) // Event: Lid Opened
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0C, 0, NotSerialized) // Event: Lid Closed
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0A, 0, NotSerialized) // Event: AC Power Connected
+{
+ Notify (BAT0, 0x81)
+ Notify (ADP1, 0x80)
+}
+
+Method (_Q0B, 0, NotSerialized) // Event: AC Power Disconnected
+{
+ Notify (BAT0, 0x81)
+ Notify (BAT0, 0x80)
+}
+
+Method (_Q06, 0, NotSerialized) // Event: Backlight Brightness Down
+{
+ ^^^^HIDD.HPEM (20)
+}
+
+Method (_Q07, 0, NotSerialized) // Event: Backlight Brightness Up
+{
+ ^^^^HIDD.HPEM (19)
+}
+
+Method (_Q08, 0, NotSerialized) // Event: Function Lock
+{
+ FLKS = FLKA
+}
+//
+// TODO:
+// Below Q Events need to be added
+//
+// Method (_Q04, 0, NotSerialized) // Event: Trackpad Lock
+// {
+// TPLS = TPLA
+// }
+//
+// Method (_Q__, 0, NotSerialized) // Event: Keyboard Backlight Brightness
+// {
+// KLBC = KLBE
+// KLSC = KLSE
+// }
+//
+
+Method (_Q99, 0, NotSerialized) // Event: Airplane Mode
+{
+ ^^^^HIDD.HPEM (8)
+}
+
+Method (_QD5, 0, NotSerialized) // Event: 10 Second Power Button Pressed
+{
+ Notify (HIDD, 0xCE)
+}
+
+Method (_QD6, 0, NotSerialized) // Event: 10 Second Power Button Released
+{
+ Notify (HIDD, 0xCF)
+}
+
+Method (_Q22, 0, NotSerialized) // Event: CHARGER_T
+{
+ Store ("EC: CHARGER_T", Debug)
+}
+
+//
+// TODO:
+// Below Q Events need to be added
+//
+// Method (_Q40, 0, NotSerialized) // Event: AC and DC Power
+// {
+// SMB2 = 0xC6
+// }
+//
+// Method (_Q41, 0, NotSerialized) // Event: Battery Charge between 0% and 20%
+// {
+// SMB2 = 0xC7
+// }
+//
+// Method (_Q42, 0, NotSerialized) // Event: Battery Charge between 20% and 60%
+// {
+// SMB2 = 0xC8
+// }
+//
+// Method (_Q43, 0, NotSerialized) // Event: Battery Charge between 60% and 100%
+// {
+// SMB2 = 0xC9
+// }
+//
+// Method (_Q44, 0, NotSerialized) // Event: AC Power Only
+// {
+// SMB2 = 0xCA
+// }
+
+Method (_Q80, 0, NotSerialized) // Event: Volume Up
+{
+ Store ("EC: VOLUME_UP", Debug)
+}
+
+Method (_Q81, 0, NotSerialized) // Event: Volume Down
+{
+ Store ("EC: VOLUME_DOWN", Debug)
+}
+
+Method (_Q54, 0, NotSerialized) // Event: Power Button Press
+{
+ Store ("EC: PWRBTN", Debug)
+}
+
+Method (_QF0, 0, NotSerialized) // Event: Temperature Report
+{
+ Store ("EC: Temperature Report", Debug)
+}
+
+Method (_QF1, 0, NotSerialized) // Event: Temperature Trigger
+{
+ // Notify (SEN3, 0x90)
+}
+
+/*
+ * The below events are unique to this platform.
+ */
+
+
+Method (_Q85, 0, NotSerialized) // Event: HOME
+{
+ Store ("EC: HOME", Debug)
+}
+
+Method (_Q79, 0, NotSerialized) // Event: USB Type-C
+{
+ Store ("EC: USB Type-C", Debug)
+ UCEV()
+}
+
+Method (_Q0E, 0, NotSerialized) // Event: SLEEP
+{
+ Store ("EC: SLEEP", Debug)
+}
+
+Method (_Q13, 0, NotSerialized) // Event: BRIGHTNESS
+{
+ Store ("EC: BRIGHTNESS", Debug)
+}
+
+Method (_Q20, 0, NotSerialized) // Event: CPU_T
+{
+ Store ("EC: CPU_T", Debug)
+}
+
+Method (_Q21, 0, NotSerialized) // Event: SKIN_T
+{
+ Store ("EC: SKIN_T", Debug)
+}
+
+Method (_Q30, 0, NotSerialized) // Event: THROT_OFF
+{
+ Store ("EC: THROT_OFF", Debug)
+}
+
+Method (_Q31, 0, NotSerialized) // Event: THROT_LV1
+{
+ Store ("EC: THROT_LV1", Debug)
+}
+
+Method (_Q32, 0, NotSerialized) // Event: THROT_LV2
+{
+ Store ("EC: THROT_LV2", Debug)
+}
+
+Method (_Q33, 0, NotSerialized) // Event: THROT_LV3
+{
+ Store ("EC: THROT_LV3", Debug)
+}
+
+Method (_Q34, 0, NotSerialized) // Event: THROT_LV4
+{
+ Store ("EC: THROT_LV4", Debug)
+}
+
+Method (_Q35, 0, NotSerialized) // Event: THROT_LV5
+{
+ Store ("EC: THROT_LV5", Debug)
+}
+
+Method (_Q36, 0, NotSerialized) // Event: THROT_LV6
+{
+ Store ("EC: THROT_LV6", Debug)
+}
+
+Method (_Q37, 0, NotSerialized) // Event: THROT_LV7
+{
+ Store ("EC: THROT_LV7", Debug)
+}
+
+Method (_Q38, 0, NotSerialized) // Event: CPU_DN_SPEED
+{
+ Store ("EC: CPU_DN_SPEED", Debug)
+}
+
+Method (_Q3C, 0, NotSerialized) // Event: CPU_UP_SPEED
+{
+ Store ("EC: CPU_UP_SPEED", Debug)
+}
+
+Method (_Q3D, 0, NotSerialized) // Event: CPU_TURBO_OFF
+{
+ Store ("EC: CPU_TURBO_OFF", Debug)
+}
+
+Method (_Q3E, 0, NotSerialized) // Event: CPU_TURBO_ON
+{
+ Store ("EC: CPU_TURBO_ON", Debug)
+}
+
+Method (_Q3F, 0, NotSerialized) // Event: SHUTDOWN
+{
+ Store ("EC: SHUTDOWN", Debug)
+}
+
+Method (_Q01, 0, NotSerialized) // Event: F1 Hot Key
+{
+ Store ("EC: F1", Debug)
+}
+
+Method (_Q02, 0, NotSerialized) // Event: F2 Hot Key
+{
+ Store ("EC: F2", Debug)
+}
+
+Method (_Q03, 0, NotSerialized) // Event: F3 Hot Key
+{
+ Store ("EC: F3", Debug)
+}
+
+Method (_Q04, 0, NotSerialized) // Event: F4 Hot Key
+{
+ Store ("EC: F4", Debug)
+}
+
+Method (_Q05, 0, NotSerialized) // Event: F5 Hot Key
+{
+ Store ("EC: F5", Debug)
+}
+
+Method (_Q09, 0, NotSerialized) // Event: F9 Hot Key
+{
+ Store ("EC: F9", Debug)
+}
+
+Method (_Q10, 0, NotSerialized) // Event: F10 Hot Key
+{
+ Store ("EC: F10", Debug)
+}
+
+Method (_Q11, 0, NotSerialized) // Event: F11 Hot Key
+{
+ Store ("EC: F11", Debug)
+}
+
+Method (_Q12, 0, NotSerialized) // Event: F12 Hot Key
+{
+ Store ("EC: F6", Debug)
+}
diff --git a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h
new file mode 100644
index 0000000000..48357d964a
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * EC communication interface for ITE Embedded Controller
+ */
+
+#ifndef _EC_STARLABS_MERLIN_EC_DEFS_H
+#define _EC_STARLABS_MERLIN_EC_DEFS_H
+
+/* IT5570 chip ID byte values */
+#define ITE_CHIPID_VAL 0x5570
+
+/* EC RAM offsets */
+#define ECRAM_FN_CTRL_REVERSE 0x30
+#define ECRAM_FN_LOCK_STATE 0x31
+#define ECRAM_TRACKPAD_STATE 0x32
+#define ECRAM_KBL_BRIGHTNESS 0x33
+#define ECRAM_KBL_STATE 0x34
+#define ECRAM_KBL_TIMEOUT 0x35
+#define ECRAM_FAN_MODE 0x50
+#define ECRAM_MAX_CHARGE 0x51
+
+#endif
diff --git a/src/ec/starlabs/merlin/variants/merlin/emem.asl b/src/ec/starlabs/merlin/variants/merlin/emem.asl
new file mode 100644
index 0000000000..9af8464776
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/merlin/emem.asl
@@ -0,0 +1,161 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+OperationRegion (ECF2, EmbeddedControl, 0x00, 0x100)
+Field (ECF2, ByteAcc, Lock, Preserve)
+{
+ Offset(0x00), // Versions:
+ SKUI, 8, // SKU ID
+ BDID, 8, // Board ID
+ ECMV, 8, // Major Version Number
+ ECSV, 8, // Minor Version Number
+ KBVS, 8, // Keyboard Controller Version
+ ECTV, 8, // Test Version Number
+ OSFG, 8, // OS Flag
+
+ Offset(0x10), // Build Time:
+ ECT0, 8, // EC Build Time 0
+ ECT1, 8, // EC Build Time 1
+ ECT2, 8, // EC Build Time 2
+ ECT3, 8, // EC Build Time 3
+ ECT4, 8, // EC Build Time 4
+ ECT5, 8, // EC Build Time 5
+ ECT6, 8, // EC Build Time 6
+ ECT7, 8, // EC Build Time 7
+ ECT8, 8, // EC Build Time 8
+ ECT9, 8, // EC Build Time 9
+
+ Offset(0x20), // Build Date:
+ ECD0, 8, // EC Build Date 0
+ ECD1, 8, // EC Build Date 1
+ ECD2, 8, // EC Build Date 2
+ ECD3, 8, // EC Build Date 3
+ ECD4, 8, // EC Build Date 4
+ ECD5, 8, // EC Build Date 5
+ ECD6, 8, // EC Build Date 6
+ ECD7, 8, // EC Build Date 7
+ ECD8, 8, // EC Build Date 8
+ ECD9, 8, // EC Build Date 9
+
+ Offset(0x30), // Keyboard:
+ FCLA, 8, // Fn Ctrl Reverse
+ FLKA, 8, // Function Lock State
+ TPLA, 8, // Trackpad State
+ KLBE, 8, // Keyboard Backlight Brightness
+ KLSE, 8, // Keyboard Backlight State
+ KLTE, 8, // Keyboard Backlight Timeout
+
+ Offset(0x40), // Flags:
+ SHIP, 8, // Shipping Mode Flag
+ CSFG, 8, // Modern Standby Flag
+ KBCD, 8, // Rotate Flag
+ WIFI, 8, // WiFi Enable
+ AUDI, 8, // Control Audio
+
+ Offset(0x50), // Devices:
+ FANM, 8, // Fan Mode
+ BFCP, 8, // Battery Full Charge Percentage
+
+ Offset(0x60), // Recovery:
+ BSRC, 8, // BIOS Recover
+
+ Offset(0x70), // Temperatures:
+ TSE1, 8, // Sensor 1 Temperature
+ TSE2, 8, // Sensor 2 Temperature
+ TSE3, 8, // Sensor 3 Temperature
+ SENF, 8, // Sensor F
+ TSHT, 8, // Thermal Sensor High Trip Point
+ TSLT, 8, // Thermal Sensor Low Trip Point
+ THER, 8, // Thermal Source
+ SURF, 8, // Chassis Surface Temperature
+ CHAR, 8, // Charger Temperature
+ CPUT, 8, // PECI CPU Temperature
+ PMXT, 8, // PLMX Temperature
+
+ Offset(0x7f), // Lid:
+ LSTE, 1, // Lid Status
+ , 7, // Reserved
+
+ Offset(0x80), // Battery:
+ ECPS, 8, // AC & Battery status
+ B1MN, 8, // Battery Model Number Code
+ B1SN, 16, // Battery Serial Number
+ B1DC, 16, // Battery Design Capacity
+ B1DV, 16, // Battery Design Voltage
+ B1FC, 16, // Battery Last Full Charge Capacity
+ B1TP, 16, // Battery Trip Point
+ B1ST, 8, // Battery State
+ B1PR, 16, // Battery Present Rate
+ B1RC, 16, // Battery Remaining Capacity
+ B1PV, 16, // Battery Present Voltage
+ BPRP, 8, // Battery Remaining percentage
+ BATT, 16, // Battery Temperature
+ BATC, 8, // Battery Temperature Ces
+
+ // Unicorn - doesn't actually exist
+ Offset(0x9d), // OPM:
+ OPWE, 8, // OPM write to EC flag for UCSI
+ // Unicorn - doesn't actually exist
+
+ Offset(0xb0), // MGO;
+ MGO0, 8, // UCSI DS MGO 0
+ MGO1, 8, // UCSI DS MGO 1
+ MGO2, 8, // UCSI DS MGO 2
+ MGO3, 8, // UCSI DS MGO 3
+ MGO4, 8, // UCSI DS MGO 4
+ MGO5, 8, // UCSI DS MGO 5
+ MGO6, 8, // UCSI DS MGO 6
+ MGO7, 8, // UCSI DS MGO 7
+ MGO8, 8, // UCSI DS MGO 8
+ MGO9, 8, // UCSI DS MGO 9
+ MGOA, 8, // UCSI DS MGO A
+ MGOB, 8, // UCSI DS MGO B
+ MGOC, 8, // UCSI DS MGO C
+ MGOD, 8, // UCSI DS MGO D
+ MGOE, 8, // UCSI DS MGO E
+ MGOF, 8, // UCSI DS MGO F
+
+ Offset(0xc0), // CCI:
+ UCSV, 16, // UCSI DS Version
+ UCSD, 16, // UCSI DS Reserved
+ CCI0, 8, // UCSI DS CCI 0
+ CCI1, 8, // UCSI DS CCI 1
+ CCI2, 8, // UCSI DS CCI 2
+ CCI3, 8, // UCSI DS CCI 3
+ CTL0, 8, // UCSI DS Control 0
+ CTL1, 8, // UCSI DS Control 0
+ CTL2, 8, // UCSI DS Control 0
+ CTL3, 8, // UCSI DS Control 0
+ CTL4, 8, // UCSI DS Control 0
+ CTL5, 8, // UCSI DS Control 0
+ CTL6, 8, // UCSI DS Control 0
+ CTL7, 8, // UCSI DS Control 0
+
+ Offset(0xd0), // MGI:
+ MGI0, 8, // UCSI DS MGI 0
+ MGI1, 8, // UCSI DS MGI 1
+ MGI2, 8, // UCSI DS MGI 2
+ MGI3, 8, // UCSI DS MGI 3
+ MGI4, 8, // UCSI DS MGI 4
+ MGI5, 8, // UCSI DS MGI 5
+ MGI6, 8, // UCSI DS MGI 6
+ MGI7, 8, // UCSI DS MGI 7
+ MGI8, 8, // UCSI DS MGI 8
+ MGI9, 8, // UCSI DS MGI 9
+ MGIA, 8, // UCSI DS MGI A
+ MGIB, 8, // UCSI DS MGI B
+ MGIC, 8, // UCSI DS MGI C
+ MGID, 8, // UCSI DS MGI D
+ MGIE, 8, // UCSI DS MGI E
+ MGIF, 8, // UCSI DS MGI F
+
+ Offset(0xe6), // Delays:
+ ECWD, 16, // EC Wakeup Delay
+ ECWE, 8, // EC Wakeup Enable
+
+ Offset(0xf7), // Thunderbolt:
+ TBTC, 8, // Thunderbolt Command
+ TBTP, 8, // Thunderbolt Data Port
+ TBTD, 8, // Thunderbolt Data
+ TBTA, 8, // Thunderbolt Acknowledge
+ TBTG, 16, // Thunderbolt DBG Data
+}
diff --git a/src/ec/starlabs/merlin/variants/merlin/events.asl b/src/ec/starlabs/merlin/variants/merlin/events.asl
new file mode 100644
index 0000000000..bd1516e732
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/merlin/events.asl
@@ -0,0 +1,280 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Method (_Q0D) // Event: Lid Opened
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0C) // Event: Lid Closed
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0A) // Event: AC Power Connected
+{
+ Notify (BAT0, 0x81)
+ Notify (ADP1, 0x80)
+}
+
+Method (_Q0B, 0, NotSerialized) // Event: AC Power Disconnected
+{
+ Notify (BAT0, 0x81)
+ Notify (BAT0, 0x80)
+}
+
+Method (_Q05) // Event: Backlight Brightness Down
+{
+ ^^^^HIDD.HPEM (20)
+}
+
+Method (_Q06) // Event: Backlight Brightness Up
+{
+ ^^^^HIDD.HPEM (19)
+}
+
+Method (_Q87) // Event: Function Lock
+{
+ FLKS = FLKA
+}
+
+Method (_Q88) // Event: Trackpad Lock
+{
+ TPLS = TPLA
+}
+Method (_Q11) // Event: Keyboard Backlight Brightness
+{
+ KLBC = KLBE
+ KLSC = KLSE
+}
+
+Method (_Q99) // Event: Airplane Mode
+{
+ ^^^^HIDD.HPEM (8)
+}
+
+Method (_QD5) // Event: 10 Second Power Button Pressed
+{
+ Store ("EC: 10 Second Power Button Pressed", Debug)
+}
+
+Method (_QD6) // Event: 10 Second Power Button Released
+{
+ Store ("EC: 10 Second Power Button Release", Debug)
+}
+
+Method (_Q22, 0, NotSerialized) // Event: CHARGER_T
+{
+ Store ("EC: CHARGER_T", Debug)
+}
+
+Method (_Q40) // Event: AC_DC
+{
+ SMB2 = 0xC6
+}
+
+Method (_Q41) // Event: DC_20_0
+{
+ SMB2 = 0xC7
+}
+
+Method (_Q42) // Event: DC_60_20
+{
+ SMB2 = 0xC9
+}
+
+Method (_Q43) // Event: DC_100_60
+{
+ SMB2 = 0xC9
+}
+
+Method (_Q44) // Event: AC_ONLY
+{
+ SMB2 = 0xCA
+}
+
+Method (_Q80, 0, NotSerialized) // Event: VOLUME_UP
+{
+ Store ("EC: VOLUME_UP", Debug)
+}
+
+Method (_Q81, 0, NotSerialized) // Event: VOLUME_DOWN
+{
+ Store ("EC: VOLUME_DOWN", Debug)
+}
+
+Method (_Q54, 0, NotSerialized) // Event: PWRBTN
+{
+ Store ("EC: PWRBTN", Debug)
+}
+
+Method (_QF0) // Event: Temperature Report
+{
+ Store ("EC: Temperature Report", Debug)
+}
+
+Method (_QF1) // Event: Temperature Trigger
+{
+ // Notify (SEN3, 0x90)
+}
+
+/*
+ * The below events are unique to this platform.
+ */
+
+Method (_Q79, 0, NotSerialized) // Event: USB Type-C
+{
+ Store ("EC: USB Type-C", Debug)
+ UCEV()
+}
+
+Method (_Q85, 0, NotSerialized) // Event: HOME
+{
+ Store ("EC: HOME", Debug)
+}
+
+Method (_Q01) // Event: F1 Hot Key
+{
+ Store ("EC: F1", Debug)
+}
+
+Method (_Q02) // Event: F2 Hot Key
+{
+ Store ("EC: F2", Debug)
+}
+
+Method (_Q03) // Event: F3 Hot Key
+{
+ Store ("EC: F3", Debug)
+}
+
+Method (_Q04) // Event: F4 Hot Key
+{
+ Store ("EC: F4", Debug)
+}
+
+Method (_Q08) // Event: F5 Hot Key
+{
+ Store ("EC: F5", Debug)
+}
+
+Method (_Q09) // Event: F6 Hot Key
+{
+ Store ("EC: F6", Debug)
+}
+
+Method (_Q07) // Event: F7 Hot Key
+{
+ Store ("EC: F7", Debug)
+}
+
+Method (_Q10) // Event: F10 Hot Key
+{
+ Store ("EC: F10", Debug)
+}
+
+Method (_Q12) // Event: F12 Hot Key
+{
+ Store ("EC: F6", Debug)
+}
+
+Method (_Q0E, 0, NotSerialized) // Event: SLEEP
+{
+ Store ("EC: SLEEP", Debug)
+}
+
+Method (_Q13, 0, NotSerialized) // Event: BRIGHTNESS
+{
+ Store ("EC: BRIGHTNESS", Debug)
+}
+
+Method (_Q20, 0, NotSerialized) // Event: CPU_T
+{
+ Store ("EC: CPU_T", Debug)
+}
+
+Method (_Q21, 0, NotSerialized) // Event: SKIN_T
+{
+ Store ("EC: SKIN_T", Debug)
+}
+
+Method (_Q30, 0, NotSerialized) // Event: THROT_OFF
+{
+ Store ("EC: THROT_OFF", Debug)
+}
+
+Method (_Q31, 0, NotSerialized) // Event: THROT_LV1
+{
+ Store ("EC: THROT_LV1", Debug)
+}
+
+Method (_Q32, 0, NotSerialized) // Event: THROT_LV2
+{
+ Store ("EC: THROT_LV2", Debug)
+}
+
+Method (_Q33, 0, NotSerialized) // Event: THROT_LV3
+{
+ Store ("EC: THROT_LV3", Debug)
+}
+
+Method (_Q34, 0, NotSerialized) // Event: THROT_LV4
+{
+ Store ("EC: THROT_LV4", Debug)
+}
+
+Method (_Q35, 0, NotSerialized) // Event: THROT_LV5
+{
+ Store ("EC: THROT_LV5", Debug)
+}
+
+Method (_Q36, 0, NotSerialized) // Event: THROT_LV6
+{
+ Store ("EC: THROT_LV6", Debug)
+}
+
+Method (_Q37, 0, NotSerialized) // Event: THROT_LV7
+{
+ Store ("EC: THROT_LV7", Debug)
+}
+
+Method (_Q38, 0, NotSerialized) // Event: CPU_DN_SPEED
+{
+ Store ("EC: CPU_DN_SPEED", Debug)
+}
+
+Method (_Q3C, 0, NotSerialized) // Event: CPU_UP_SPEED
+{
+ Store ("EC: CPU_UP_SPEED", Debug)
+}
+
+Method (_Q3D, 0, NotSerialized) // Event: CPU_TURBO_OFF
+{
+ Store ("EC: CPU_TURBO_OFF", Debug)
+}
+
+Method (_Q3E, 0, NotSerialized) // Event: CPU_TURBO_ON
+{
+ Store ("EC: CPU_TURBO_ON", Debug)
+}
+
+Method (_Q3F, 0, NotSerialized) // Event: SHUTDOWN
+{
+ Store ("EC: SHUTDOWN", Debug)
+}
+
+Method (_Q45) // Event: SENSOR_T76
+{
+ SMB2 = 0xCB
+}
+
+Method (_Q48, 0, NotSerialized) // Event: Fan Turbo On
+{
+ Store ("EC: Fan Turbo On", Debug)
+}
+
+Method (_Q49, 0, NotSerialized) // Event: Fan Turbo Off
+{
+ Store ("EC: Fan Turbo Off", Debug)
+}
diff --git a/src/ec/starlabs/merlin/variants/tgl/ecdefs.h b/src/ec/starlabs/merlin/variants/tgl/ecdefs.h
new file mode 100644
index 0000000000..3441bc073f
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/tgl/ecdefs.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * EC communication interface for ITE Embedded Controller
+ */
+
+#ifndef _EC_STARLABS_TGL_EC_DEFS_H
+#define _EC_STARLABS_TGL_EC_DEFS_H
+
+/* IT5570 chip ID byte values */
+#define ITE_CHIPID_VAL 0x5570
+
+/* EC RAM offsets */
+#define ECRAM_KBL_BRIGHTNESS 0x09
+#define ECRAM_KBL_TIMEOUT 0x10
+#define ECRAM_KBL_STATE 0x0a
+#define ECRAM_TRACKPAD_STATE 0x0c
+#define ECRAM_FN_LOCK_STATE 0x0f
+#define ECRAM_FN_CTRL_REVERSE 0x17
+#define ECRAM_MAX_CHARGE 0x1a
+#define ECRAM_FAN_MODE 0x1b
+
+#endif
diff --git a/src/ec/starlabs/merlin/variants/tgl/emem.asl b/src/ec/starlabs/merlin/variants/tgl/emem.asl
new file mode 100644
index 0000000000..f5eb1d0380
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/tgl/emem.asl
@@ -0,0 +1,168 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+OperationRegion (ECF2, EmbeddedControl, 0x00, 0x100)
+Field (ECF2, ByteAcc, Lock, Preserve)
+{
+ Offset(0x00),
+ ECMV, 8, // Major Version Number
+ ECSV, 8, // Minor Version Number
+ KBVS, 8, // Keyboard Controller Version
+ ECTV, 8, // Test Version Number
+ OSFG, 8, // OS Flag
+ FRMF, 8, // Force Mirror Flag
+
+ Offset(0x07),
+ SKUI, 8, // SKU ID
+ CSFG, 8, // Modern Standby Flag
+ KLBE, 8, // Keyboard Backlight Brightness
+ KLSE, 8, // Keyboard Backlight State
+ BDID, 8, // Board ID
+ TPLA, 8, // Trackpad State
+ KBCD, 8, // Rotate Flag
+ WIFI, 8, // WiFi Enable
+ FLKA, 8, // Function Lock State
+ KLTE, 8, // Keyboard Backlight Timeout
+
+ Offset(0x13),
+ AUDI, 8, // Control Audio
+
+ Offset(0x15),
+ SURF, 8, // Chassis Surface Temperature
+ CHAR, 8, // Charger Temperature
+ FCLA, 8, // Fn Ctrl Reverse
+
+ Offset(0x1a),
+ BFCP, 8, // Battery Full Charge Percentage
+ FANM, 8, // Fan Mode
+
+ Offset(0x1d),
+ BSRC, 8, // BIOS Recover
+
+ Offset(0x40),
+ SHIP, 8, // Shipping Mode Flag
+ ECT0, 8, // EC Build Time 0
+ ECT1, 8, // EC Build Time 1
+ ECT2, 8, // EC Build Time 2
+ ECT3, 8, // EC Build Time 3
+ ECT4, 8, // EC Build Time 4
+ ECT5, 8, // EC Build Time 5
+ ECT6, 8, // EC Build Time 6
+ ECT7, 8, // EC Build Time 7
+ ECT8, 8, // EC Build Time 8
+ ECT9, 8, // EC Build Time 9
+
+ Offset(0x4B),
+ ECD0, 8, // EC Build Date 0
+ ECD1, 8, // EC Build Date 1
+ ECD2, 8, // EC Build Date 2
+ ECD3, 8, // EC Build Date 3
+ ECD4, 8, // EC Build Date 4
+ ECD5, 8, // EC Build Date 5
+ ECD6, 8, // EC Build Date 6
+ ECD7, 8, // EC Build Date 7
+ ECD8, 8, // EC Build Date 8
+ ECD9, 8, // EC Build Date 9
+
+ Offset(0x62),
+ TSE2, 8, // Sensor 2 Temperature
+ SENF, 8, // Sensor F
+ TSHT, 8, // Thermal Sensor High Trip Point
+ TSLT, 8, // Thermal Sensor Low Trip Point
+ THER, 8, // Thermal Source
+
+ Offset(0x68),
+ BATT, 16, // Battery Temperature
+ BATC, 8, // Battery Temperature Ces
+
+ Offset(0x70),
+ CPUT, 8, // PECI CPU Temperature
+ PMXT, 8, // PLMX Temperature
+ TSE1, 8, // Sensor 1 Temperature
+ TSE3, 8, // Sensor 3 Temperature
+
+ Offset(0x7f),
+ LSTE, 1, // Lid Status
+ , 7, // Reserved
+
+ Offset(0x80),
+ ECPS, 8, // AC & Battery status
+ B1MN, 8, // Battery Model Number Code
+ B1SN, 16, // Battery Serial Number
+ B1DC, 16, // Battery Design Capacity
+ B1DV, 16, // Battery Design Voltage
+ B1FC, 16, // Battery Last Full Charge Capacity
+ B1TP, 16, // Battery Trip Point
+ B1ST, 8, // Battery State
+ B1PR, 16, // Battery Present Rate
+ B1RC, 16, // Battery Remaining Capacity
+ B1PV, 16, // Battery Present Voltage
+ BPRP, 8, // Battery Remaining percentage
+
+ // Unicorn - doesn't actually exist
+ Offset(0x9d),
+ OPWE, 8, // OPM write to EC flag for UCSI
+ // Unicorn - doesn't actually exist
+
+ Offset(0xb0),
+ MGO0, 8, // UCSI DS MGO 0
+ MGO1, 8, // UCSI DS MGO 1
+ MGO2, 8, // UCSI DS MGO 2
+ MGO3, 8, // UCSI DS MGO 3
+ MGO4, 8, // UCSI DS MGO 4
+ MGO5, 8, // UCSI DS MGO 5
+ MGO6, 8, // UCSI DS MGO 6
+ MGO7, 8, // UCSI DS MGO 7
+ MGO8, 8, // UCSI DS MGO 8
+ MGO9, 8, // UCSI DS MGO 9
+ MGOA, 8, // UCSI DS MGO A
+ MGOB, 8, // UCSI DS MGO B
+ MGOC, 8, // UCSI DS MGO C
+ MGOD, 8, // UCSI DS MGO D
+ MGOE, 8, // UCSI DS MGO E
+ MGOF, 8, // UCSI DS MGO F
+
+ Offset(0xc0),
+ UCSV, 16, // UCSI DS Version
+ UCSD, 16, // UCSI DS Reserved
+ CCI0, 8, // UCSI DS CCI 0
+ CCI1, 8, // UCSI DS CCI 1
+ CCI2, 8, // UCSI DS CCI 2
+ CCI3, 8, // UCSI DS CCI 3
+ CTL0, 8, // UCSI DS Control 0
+ CTL1, 8, // UCSI DS Control 0
+ CTL2, 8, // UCSI DS Control 0
+ CTL3, 8, // UCSI DS Control 0
+ CTL4, 8, // UCSI DS Control 0
+ CTL5, 8, // UCSI DS Control 0
+ CTL6, 8, // UCSI DS Control 0
+ CTL7, 8, // UCSI DS Control 0
+
+ Offset(0xd0),
+ MGI0, 8, // UCSI DS MGI 0
+ MGI1, 8, // UCSI DS MGI 1
+ MGI2, 8, // UCSI DS MGI 2
+ MGI3, 8, // UCSI DS MGI 3
+ MGI4, 8, // UCSI DS MGI 4
+ MGI5, 8, // UCSI DS MGI 5
+ MGI6, 8, // UCSI DS MGI 6
+ MGI7, 8, // UCSI DS MGI 7
+ MGI8, 8, // UCSI DS MGI 8
+ MGI9, 8, // UCSI DS MGI 9
+ MGIA, 8, // UCSI DS MGI A
+ MGIB, 8, // UCSI DS MGI B
+ MGIC, 8, // UCSI DS MGI C
+ MGID, 8, // UCSI DS MGI D
+ MGIE, 8, // UCSI DS MGI E
+ MGIF, 8, // UCSI DS MGI F
+
+ Offset(0xe6),
+ ECWD, 16, // EC Wakeup Delay
+ ECWE, 8, // EC Wakeup Enable
+
+ Offset(0xf7),
+ TBTC, 8, // Thunderbolt Command
+ TBTP, 8, // Thunderbolt Data Port
+ TBTD, 8, // Thunderbolt Data
+ TBTA, 8, // Thunderbolt Acknowledge
+ TBTG, 16, // Thunderbolt DBG Data
+}
diff --git a/src/ec/starlabs/merlin/variants/tgl/events.asl b/src/ec/starlabs/merlin/variants/tgl/events.asl
new file mode 100644
index 0000000000..ba09c8a3f4
--- /dev/null
+++ b/src/ec/starlabs/merlin/variants/tgl/events.asl
@@ -0,0 +1,279 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+Method (_Q0D, 0, NotSerialized) // Event: Lid Opened
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0C, 0, NotSerialized) // Event: Lid Closed
+{
+ \LIDS = LSTE
+ Notify (LID0, 0x80)
+}
+
+Method (_Q0A, 0, NotSerialized) // Event: AC Power Connected
+{
+ Notify (BAT0, 0x81)
+ Notify (ADP1, 0x80)
+}
+
+Method (_Q0B, 0, NotSerialized) // Event: AC Power Disconnected
+{
+ Notify (BAT0, 0x81)
+ Notify (BAT0, 0x80)
+}
+
+Method (_Q05, 0, NotSerialized) // Event: Backlight Brightness Down
+{
+ ^^^^HIDD.HPEM (20)
+}
+
+Method (_Q06, 0, NotSerialized) // Event: Backlight Brightness Up
+{
+ ^^^^HIDD.HPEM (19)
+}
+
+Method (_Q87, 0, NotSerialized) // Event: Function Lock
+{
+ FLKS = FLKA
+}
+
+Method (_Q88, 0, NotSerialized) // Event: Trackpad Lock
+{
+ TPLS = TPLA
+}
+Method (_Q11) // Event: Keyboard Backlight Brightness
+{
+ KLBC = KLBE
+}
+
+Method (_Q99, 0, NotSerialized) // Event: Airplane Mode
+{
+ ^^^^HIDD.HPEM (8)
+}
+
+Method (_QD5, 0, NotSerialized) // Event: 10 Second Power Button Pressed
+{
+ Notify (HIDD, 0xCE)
+}
+
+Method (_QD6, 0, NotSerialized) // Event: 10 Second Power Button Released
+{
+ Notify (HIDD, 0xCF)
+}
+
+Method (_Q22, 0, NotSerialized) // Event: CHARGER_T
+{
+ Store ("EC: CHARGER_T", Debug)
+}
+
+Method (_Q40, 0, NotSerialized) // Event: AC and DC Power
+{
+ SMB2 = 0xC6
+}
+
+Method (_Q41, 0, NotSerialized) // Event: Battery Charge between 0% and 20%
+{
+ SMB2 = 0xC7
+}
+
+Method (_Q42, 0, NotSerialized) // Event: Battery Charge between 20% and 60%
+{
+ SMB2 = 0xC8
+}
+
+Method (_Q43, 0, NotSerialized) // Event: Battery Charge between 60% and 100%
+{
+ SMB2 = 0xC9
+}
+
+Method (_Q44, 0, NotSerialized) // Event: AC Power Only
+{
+ SMB2 = 0xCA
+}
+
+Method (_Q80, 0, NotSerialized) // Event: Volume Up
+{
+ Store ("EC: VOLUME_UP", Debug)
+}
+
+Method (_Q81, 0, NotSerialized) // Event: Volume Down
+{
+ Store ("EC: VOLUME_DOWN", Debug)
+}
+
+Method (_Q54, 0, NotSerialized) // Event: Power Button Press
+{
+ Store ("EC: PWRBTN", Debug)
+}
+
+Method (_QF0, 0, NotSerialized) // Event: Temperature Report
+{
+ Store ("EC: Temperature Report", Debug)
+}
+
+Method (_QF1, 0, NotSerialized) // Event: Temperature Trigger
+{
+ // Notify (SEN3, 0x90)
+}
+
+/*
+ * The below events are unique to this platform.
+ */
+
+Method (_Q79, 0, NotSerialized) // Event: USB Type-C
+{
+ Store ("EC: USB Type-C", Debug)
+ UCEV()
+}
+
+Method (_Q85, 0, NotSerialized) // Event: HOME
+{
+ Store ("EC: HOME", Debug)
+}
+
+Method (_Q01, 0, NotSerialized) // Event: F1 Hot Key
+{
+ Store ("EC: F1", Debug)
+}
+
+Method (_Q02, 0, NotSerialized) // Event: F2 Hot Key
+{
+ Store ("EC: F2", Debug)
+}
+
+Method (_Q03, 0, NotSerialized) // Event: F3 Hot Key
+{
+ Store ("EC: F3", Debug)
+}
+
+Method (_Q04, 0, NotSerialized) // Event: F4 Hot Key
+{
+ Store ("EC: F4", Debug)
+}
+
+Method (_Q08, 0, NotSerialized) // Event: F5 Hot Key
+{
+ Store ("EC: F5", Debug)
+}
+
+Method (_Q09, 0, NotSerialized) // Event: F6 Hot Key
+{
+ Store ("EC: F6", Debug)
+}
+
+Method (_Q07, 0, NotSerialized) // Event: F7 Hot Key
+{
+ Store ("EC: F7", Debug)
+}
+
+Method (_Q10, 0, NotSerialized) // Event: F10 Hot Key
+{
+ Store ("EC: F10", Debug)
+}
+
+Method (_Q12, 0, NotSerialized) // Event: F12 Hot Key
+{
+ Store ("EC: F6", Debug)
+}
+
+Method (_Q0E, 0, NotSerialized) // Event: SLEEP
+{
+ Store ("EC: SLEEP", Debug)
+}
+
+Method (_Q13, 0, NotSerialized) // Event: BRIGHTNESS
+{
+ Store ("EC: BRIGHTNESS", Debug)
+}
+
+Method (_Q20, 0, NotSerialized) // Event: CPU_T
+{
+ Store ("EC: CPU_T", Debug)
+}
+
+Method (_Q21, 0, NotSerialized) // Event: SKIN_T
+{
+ Store ("EC: SKIN_T", Debug)
+}
+
+Method (_Q30, 0, NotSerialized) // Event: THROT_OFF
+{
+ Store ("EC: THROT_OFF", Debug)
+}
+
+Method (_Q31, 0, NotSerialized) // Event: THROT_LV1
+{
+ Store ("EC: THROT_LV1", Debug)
+}
+
+Method (_Q32, 0, NotSerialized) // Event: THROT_LV2
+{
+ Store ("EC: THROT_LV2", Debug)
+}
+
+Method (_Q33, 0, NotSerialized) // Event: THROT_LV3
+{
+ Store ("EC: THROT_LV3", Debug)
+}
+
+Method (_Q34, 0, NotSerialized) // Event: THROT_LV4
+{
+ Store ("EC: THROT_LV4", Debug)
+}
+
+Method (_Q35, 0, NotSerialized) // Event: THROT_LV5
+{
+ Store ("EC: THROT_LV5", Debug)
+}
+
+Method (_Q36, 0, NotSerialized) // Event: THROT_LV6
+{
+ Store ("EC: THROT_LV6", Debug)
+}
+
+Method (_Q37, 0, NotSerialized) // Event: THROT_LV7
+{
+ Store ("EC: THROT_LV7", Debug)
+}
+
+Method (_Q38, 0, NotSerialized) // Event: CPU_DN_SPEED
+{
+ Store ("EC: CPU_DN_SPEED", Debug)
+}
+
+Method (_Q3C, 0, NotSerialized) // Event: CPU_UP_SPEED
+{
+ Store ("EC: CPU_UP_SPEED", Debug)
+}
+
+Method (_Q3D, 0, NotSerialized) // Event: CPU_TURBO_OFF
+{
+ Store ("EC: CPU_TURBO_OFF", Debug)
+}
+
+Method (_Q3E, 0, NotSerialized) // Event: CPU_TURBO_ON
+{
+ Store ("EC: CPU_TURBO_ON", Debug)
+}
+
+Method (_Q3F, 0, NotSerialized) // Event: SHUTDOWN
+{
+ Store ("EC: SHUTDOWN", Debug)
+}
+
+Method (_Q45, 0, NotSerialized) // Event: SENSOR_T76
+{
+ SMB2 = 0xCB
+}
+
+Method (_Q48, 0, NotSerialized) // Event: Fan Turbo On
+{
+ Store ("EC: Fan Turbo On", Debug)
+}
+
+Method (_Q49, 0, NotSerialized) // Event: Fan Turbo Off
+{
+ Store ("EC: Fan Turbo Off", Debug)
+}