diff --git a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h index 08f80cb1f8..832f9c7836 100644 --- a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h +++ b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h @@ -1,5 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include +#include + /* * EC communication interface for ITE Embedded Controller */ @@ -11,15 +14,15 @@ #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 -#define ECRAM_FAST_CHARGE 0x52 +#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 +#define ECRAM_FAST_CHARGE dead_code_t(uint8_t) #define ECRAM_MIRROR_FLAG 0x05 #endif diff --git a/src/ec/starlabs/merlin/variants/merlin/emem.asl b/src/ec/starlabs/merlin/variants/merlin/emem.asl index 45958fe553..9539e09a54 100644 --- a/src/ec/starlabs/merlin/variants/merlin/emem.asl +++ b/src/ec/starlabs/merlin/variants/merlin/emem.asl @@ -3,79 +3,40 @@ OperationRegion (ECF2, EmbeddedControl, 0x00, 0x100) Field (ECF2, ByteAcc, Lock, Preserve) { - Offset(0x00), // Versions: - SKUI, 8, // SKU ID - BDID, 8, // Board ID + Offset (0x00), ECMV, 8, // Major Version Number ECSV, 8, // Minor Version Number - KBVS, 8, // Keyboard Controller Version - ECTV, 8, // Test Version Number + + Offset (0x04), OSFG, 8, // OS Flag + FRMF, 8, // Mirror 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 - FLKE, 8, // Function Lock State - TPLE, 8, // Trackpad State + Offset(0x09), KLBE, 8, // Keyboard Backlight Brightness KLSE, 8, // Keyboard Backlight State + + Offset (0x0c), + TPLE, 8, // Trackpad State + + Offset (0x0f), + FLKE, 8, // Function Lock 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(0x17), + FCLA, 8, // Fn Ctrl Reverse - Offset(0x50), // Devices: + Offset(0x1a), + BFCP, 8, // Maximum Charge Level FANM, 8, // Fan Mode - BFCP, 8, // Battery Full Charge Percentage - Offset(0x60), // Recovery: - BSRC, 8, // BIOS Recover + Offset(0x40), + SHIP, 8, // Shipping Mode Flag - 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: + Offset(0x7f), LSTE, 1, // Lid Status , 7, // Reserved - Offset(0x80), // Battery: + Offset(0x80), ECPS, 8, // AC & Battery status B1MN, 8, // Battery Model Number Code B1SN, 16, // Battery Serial Number @@ -88,72 +49,7 @@ Field (ECF2, ByteAcc, Lock, Preserve) B1RC, 16, // Battery Remaining Capacity B1PV, 16, // Battery Present Voltage BPRP, 8, // Battery Remaining percentage - BATT, 16, // Battery Temperature - BATC, 8, // Battery Temperature Ces - Offset(0x9d), // OPM: + Offset(0x9d), OPWE, 8, // OPM write to EC flag for UCSI - - 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 index 9835ef13ba..acfb6befbe 100644 --- a/src/ec/starlabs/merlin/variants/merlin/events.asl +++ b/src/ec/starlabs/merlin/variants/merlin/events.asl @@ -1,18 +1,16 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -Method (_Q0D) // Event: Lid Opened +Method (_Q05, 0, NotSerialized) // Event: Backlight Brightness Down { - \LIDS = LSTE - Notify (LID0, 0x80) + ^^^^HIDD.HPEM (20) } -Method (_Q0C) // Event: Lid Closed +Method (_Q06, 0, NotSerialized) // Event: Backlight Brightness Up { - \LIDS = LSTE - Notify (LID0, 0x80) + ^^^^HIDD.HPEM (19) } -Method (_Q0A) // Event: AC Power Connected +Method (_Q0A, 0, NotSerialized) // Event: AC Power Connected { Notify (BAT0, 0x81) Notify (ADP1, 0x80) @@ -24,256 +22,8 @@ Method (_Q0B, 0, NotSerialized) // Event: AC Power Disconnected Notify (BAT0, 0x80) } -Method (_Q05) // Event: Backlight Brightness Down +Method (_Q0C, 0, NotSerialized) // Event: Lid Opened or Closed { - ^^^^HIDD.HPEM (20) -} - -Method (_Q06) // Event: Backlight Brightness Up -{ - ^^^^HIDD.HPEM (19) -} - -Method (_Q87) // Event: Function Lock -{ - Printf ("EC: Function Lock") -} - -Method (_Q88) // Event: Trackpad Lock -{ - Printf ("EC: Trackpad Lock") -} -Method (_Q11) // Event: Keyboard Backlight Brightness -{ - Printf ("EC: Keyboard Brightness") -} - -Method (_Q99) // Event: Airplane Mode -{ - ^^^^HIDD.HPEM (8) -} - -Method (_QD5) // Event: 10 Second Power Button Pressed -{ - Printf ("EC: 10 Second Power Button Pressed") -} - -Method (_QD6) // Event: 10 Second Power Button Released -{ - Printf ("EC: 10 Second Power Button Release") -} - -Method (_Q22, 0, NotSerialized) // Event: CHARGER_T -{ - Printf ("EC: CHARGER_T") -} - -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 -{ - Printf ("EC: VOLUME_UP") -} - -Method (_Q81, 0, NotSerialized) // Event: VOLUME_DOWN -{ - Printf ("EC: VOLUME_DOWN") -} - -Method (_Q54, 0, NotSerialized) // Event: PWRBTN -{ - Printf ("EC: PWRBTN") -} - -Method (_QF0) // Event: Temperature Report -{ - Printf ("EC: Temperature Report") -} - -Method (_QF1) // Event: Temperature Trigger -{ - // Notify (SEN3, 0x90) -} - -/* - * The below events are unique to this platform. - */ - -Method (_Q79, 0, NotSerialized) // Event: USB Type-C -{ - Printf ("EC: USB Type-C") - UCEV() -} - -Method (_Q85, 0, NotSerialized) // Event: HOME -{ - Printf ("EC: HOME") -} - -Method (_Q01) // Event: F1 Hot Key -{ - Printf ("EC: F1") -} - -Method (_Q02) // Event: F2 Hot Key -{ - Printf ("EC: F2") -} - -Method (_Q03) // Event: F3 Hot Key -{ - Printf ("EC: F3") -} - -Method (_Q04) // Event: F4 Hot Key -{ - Printf ("EC: F4") -} - -Method (_Q08) // Event: F5 Hot Key -{ - Printf ("EC: F5") -} - -Method (_Q09) // Event: F6 Hot Key -{ - Printf ("EC: F6") -} - -Method (_Q07) // Event: F7 Hot Key -{ - Printf ("EC: F7") -} - -Method (_Q10) // Event: F10 Hot Key -{ - Printf ("EC: F10") -} - -Method (_Q12) // Event: F12 Hot Key -{ - Printf ("EC: F6") -} - -Method (_Q0E, 0, NotSerialized) // Event: SLEEP -{ - Printf ("EC: SLEEP") -} - -Method (_Q13, 0, NotSerialized) // Event: BRIGHTNESS -{ - Printf ("EC: BRIGHTNESS") -} - -Method (_Q20, 0, NotSerialized) // Event: CPU_T -{ - Printf ("EC: CPU_T") -} - -Method (_Q21, 0, NotSerialized) // Event: SKIN_T -{ - Printf ("EC: SKIN_T") -} - -Method (_Q30, 0, NotSerialized) // Event: THROT_OFF -{ - Printf ("EC: THROT_OFF") -} - -Method (_Q31, 0, NotSerialized) // Event: THROT_LV1 -{ - Printf ("EC: THROT_LV1") -} - -Method (_Q32, 0, NotSerialized) // Event: THROT_LV2 -{ - Printf ("EC: THROT_LV2") -} - -Method (_Q33, 0, NotSerialized) // Event: THROT_LV3 -{ - Printf ("EC: THROT_LV3") -} - -Method (_Q34, 0, NotSerialized) // Event: THROT_LV4 -{ - Printf ("EC: THROT_LV4") -} - -Method (_Q35, 0, NotSerialized) // Event: THROT_LV5 -{ - Printf ("EC: THROT_LV5") -} - -Method (_Q36, 0, NotSerialized) // Event: THROT_LV6 -{ - Printf ("EC: THROT_LV6") -} - -Method (_Q37, 0, NotSerialized) // Event: THROT_LV7 -{ - Printf ("EC: THROT_LV7") -} - -Method (_Q38, 0, NotSerialized) // Event: CPU_DN_SPEED -{ - Printf ("EC: CPU_DN_SPEED") -} - -Method (_Q3C, 0, NotSerialized) // Event: CPU_UP_SPEED -{ - Printf ("EC: CPU_UP_SPEED") -} - -Method (_Q3D, 0, NotSerialized) // Event: CPU_TURBO_OFF -{ - Printf ("EC: CPU_TURBO_OFF") -} - -Method (_Q3E, 0, NotSerialized) // Event: CPU_TURBO_ON -{ - Printf ("EC: CPU_TURBO_ON") -} - -Method (_Q3F, 0, NotSerialized) // Event: SHUTDOWN -{ - Printf ("EC: SHUTDOWN") -} - -Method (_Q45) // Event: SENSOR_T76 -{ - SMB2 = 0xCB -} - -Method (_Q48, 0, NotSerialized) // Event: Fan Turbo On -{ - Printf ("EC: Fan Turbo On") -} - -Method (_Q49, 0, NotSerialized) // Event: Fan Turbo Off -{ - Printf ("EC: Fan Turbo Off") + \LIDS = LSTE + Notify (LID0, 0x80) }