Star Labs has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52323 )
Change subject: Added LabTop series of laptops ......................................................................
Added LabTop series of laptops
Change-Id: Ic645d3026711e9f2e9099f22c89cd64765ac2a6f --- M src/ec/starlabs/it8987/acpi/cmos.asl M src/ec/starlabs/it8987/acpi/ec.asl M src/ec/starlabs/it8987/acpi/hid.asl M src/ec/starlabs/it8987/acpi/keyboard.asl M src/ec/starlabs/it8987/acpi/lid.asl M src/ec/starlabs/it8987/ec.c 6 files changed, 77 insertions(+), 72 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/23/52323/1
diff --git a/src/ec/starlabs/it8987/acpi/cmos.asl b/src/ec/starlabs/it8987/acpi/cmos.asl index 3368473..052094c 100644 --- a/src/ec/starlabs/it8987/acpi/cmos.asl +++ b/src/ec/starlabs/it8987/acpi/cmos.asl @@ -3,7 +3,7 @@ OperationRegion (CMOS, SystemIO, 0x70, 0x02) Field (CMOS, ByteAcc, NoLock, Preserve) { - NVRI, 8, + NVRI, 8, NVRD, 8 }
diff --git a/src/ec/starlabs/it8987/acpi/ec.asl b/src/ec/starlabs/it8987/acpi/ec.asl index 4c7859c..c7d7ec9 100644 --- a/src/ec/starlabs/it8987/acpi/ec.asl +++ b/src/ec/starlabs/it8987/acpi/ec.asl @@ -30,7 +30,7 @@ // Include the definitions for accessing CMOS. #include "cmos.asl"
- // Our embedded controller device. + // Our embedded controller device. Device (H_EC) { Name (_HID, EISAID ("PNP0C09")) // ACPI Embedded Controller @@ -43,13 +43,13 @@ Name(ECFG, 0) Name(WIBT, 0) Name(APST, 0) - + Name(ECON, 1) // AC debug Name(BNUM, 0) // Number Of Batteries Present - Name(PVOL, ASL_PVOL_DEFOF_NUM) + Name(PVOL, ASL_PVOL_DEFOF_NUM) Name(B1CC, 0) Name(B2CC, 0) - + Name(B2ST, 0) Name(CFAN, 0) Name(CMDR, 0) @@ -79,7 +79,7 @@ Name(PB10, 0) Name(IWCW, 0) Name(IWCR, 0) - Name(BTEN, 0) + Name(BTEN, 0) Mutex(ECMT, 0)
Method (_CRS, 0, Serialized) @@ -108,19 +108,19 @@ If ((Arg0 == 0x03) && (Arg1 == 0x01)) { ECAV = 1 - + // Unconditionally fix up the Battery and Power State. - + // Initialize the Number of Present Batteries. // 1 = Real Battery 1 is present // 2 = Real Battery 2 is present // 3 = Real Battery 1 and 2 are present BNUM = 0 BNUM |= ((ECRD (RefOf (ECWR)) & 0x02) >> 1) - + // Save the current Power State for later. //Store (PWRS, Local0) - + // Initialize the Power State. // BNUM = 0 = Virtual Power State // BNUM > 0 = Real Power State @@ -131,7 +131,7 @@ Else { \PWRS = (ECRD (RefOf (ECWR)) & 0x01) - } + } PNOT()
/* Initialize LID switch state */ @@ -154,39 +154,39 @@ XXX1, 8, // EC Firmware sub- version number. XXX2, 8, // EC Firmware test- version number.
- Offset(0x06), - SKID, 8, // SKU ID + Offset(0x06), + SKID, 8, // SKU ID
Offset(0x11), KBCD, 8, // Key / Touch Pad disable/enable bit - ECOS, 8, // Enter OS flag + ECOS, 8, // Enter OS flag HDAO, 8, - ECHK, 8, // Hot keys flag + ECHK, 8, // Hot keys flag
Offset(0x18), KLBS, 8, // Keyboard backlight begin. KLBE, 8, // Keyboard backlight status. - + Offset(0x1A), KBLT, 8, // Keyboard Backlight Timeout PWPF, 8, // Power Profile
- Offset(0x1E), - BTHP, 8, // Health Battery Percentage + Offset(0x1E), + BTHP, 8, // Health Battery Percentage
Offset(0x20), RCMD, 8, // Same function as IO 66 port to send EC command RCST, 8, // Report status for the result of command execution
- Offset(0x2C), - FNST, 8, // FN LOCK key status. + Offset(0x2C), + FNST, 8, // FN LOCK key status.
- Offset(0x3F), - SFAN, 8, // Set Fan Speed. - BTMP, 16, // Battery Temperature. - BCNT, 16, // Battery Cycle Count. - FRMP, 16, // Fan Current Speed. - + Offset(0x3F), + SFAN, 8, // Set Fan Speed. + BTMP, 16, // Battery Temperature. + BCNT, 16, // Battery Cycle Count. + FRMP, 16, // Fan Current Speed. + Offset(0x60), TSR1, 8, // Thermal Sensor Register 1 [CPU VR (IMVP) Temp on RVP] TSR2, 8, // Thermal Sensor Register 2 [Heat exchanger fan temp on RVP] @@ -214,16 +214,16 @@ CHGR, 16, // Charge Rate
Offset(0x70), - CPTM, 8, // CPU Temperature + CPTM, 8, // CPU Temperature
- Offset(0x72), - TER2, 8, // Charger Temperature, Charger thermistor support + Offset(0x72), + TER2, 8, // Charger Temperature, Charger thermistor support
Offset(0x7F), LSTE, 1, // Lid feature // BIT0 LID GPI , 7, // Reserved - + Offset(0x80), ECWR, 8, // AC & Battery status XX10, 8, // Battery#1 Model Number Code @@ -233,11 +233,11 @@ B1FC, 16, // Battery#1 Last Full Charge Capacity XX15, 16, // Battery#1 Trip Point B1ST, 8, // Battery#1 State - B1CR, 16, // Battery#1 Present Rate + B1CR, 16, // Battery#1 Present Rate B1RC, 16, // Battery#1 Remaining Capacity B1VT, 16, // Battery#1 Present Voltage BPCN, 8, // Battery#1 Remaining percentage - + // USB Type C Mailbox Interface // PPM->OPM Message In Offset(0xc0), MGI0, 8, @@ -252,13 +252,13 @@ MGI9, 8, MGIA, 8, MGIB, 8, - MGIC, 8, + MGIC, 8, MGID, 8, MGIE, 8, MGIF, 8,
// USB Type C Mailbox Interface // OPM->PPM Message Out - MGO0, 8, + MGO0, 8, MGO1, 8, MGO2, 8, MGO3, 8, @@ -273,7 +273,7 @@ MGOC, 8, MGOD, 8, MGOE, 8, - MGOF, 8, + MGOF, 8,
// USB Type C UCSI DATA Structure. VER1, 8, @@ -281,7 +281,7 @@ RSV1, 8, RSV2, 8,
- // PPM->OPM CCI indicator + // PPM->OPM CCI indicator CCI0, 8, CCI1, 8, CCI2, 8, @@ -296,13 +296,13 @@ CTL5, 8, CTL6, 8, CTL7, 8, - + Offset(0xF0), , 3, // BIT0 .. BIT2 Reserved TPCC, 1, // BIT3 TypeC connection bit , 2, // BIT4 .. BIT5 Reserved DRMD, 1, // Bit6 Dual Role Mode. 0->DFP: Host mode; 1->UFP: Device Mode. - , 1, // BIT7 Reserved + , 1, // BIT7 Reserved }
Method (ECMD, 0, Serialized) @@ -350,32 +350,32 @@ #include "lid.asl"
/* Random unknown events that are supported by the stock BIOS. */ - Method(_Q40) + Method(_Q40) { SMB2 = 0xC6 } - - Method(_Q41) + + Method(_Q41) { SMB2 = 0xC7 } - - Method(_Q42) + + Method(_Q42) { SMB2 = 0xC8 } - - Method(_Q43) + + Method(_Q43) { SMB2 = 0xC9 }
- Method(_Q44) + Method(_Q44) { SMB2 = 0xCA - } + }
- Method(_Q45) + Method(_Q45) { SMB2 = 0xC1 } diff --git a/src/ec/starlabs/it8987/acpi/hid.asl b/src/ec/starlabs/it8987/acpi/hid.asl index 93485ca..cc6bce6 100644 --- a/src/ec/starlabs/it8987/acpi/hid.asl +++ b/src/ec/starlabs/it8987/acpi/hid.asl @@ -29,9 +29,9 @@ Store ("-----> HDDM", Debug) Name (DPKG, Package (0x04) { - 0x11111111, - 0x22222222, - 0x33333333, + 0x11111111, + 0x22222222, + 0x33333333, 0x44444444 }) Return (DPKG) @@ -249,4 +249,4 @@ Method (PWRR, 0, Serialized) { Notify (HIDD, 0xCF) -} \ No newline at end of file +} diff --git a/src/ec/starlabs/it8987/acpi/keyboard.asl b/src/ec/starlabs/it8987/acpi/keyboard.asl index c5145e1..f5b1d52 100644 --- a/src/ec/starlabs/it8987/acpi/keyboard.asl +++ b/src/ec/starlabs/it8987/acpi/keyboard.asl @@ -7,31 +7,31 @@ Notify (_SB.HIDD, 0xC5) Store ("<----- _Q80", Debug) } - + Method(_Q81) // Volume down { Store ("-----> _Q81", Debug) Notify (_SB.HIDD, 0xC6) Notify (_SB.HIDD, 0xC7) Store ("<----- _Q81", Debug) -} - +} + Method(_Q99) // Wireless mode { Store ("-----> _Q99", Debug) - _SB.HIDD.HPEM(8) + _SB.HIDD.HPEM(8) Store ("<----- _Q80", Debug) } - + Method(_Q06) // Brightness decrease { _SB.PCI0.GFX0.DECB() -} - +} + Method(_Q07) // Brightness increase { _SB.PCI0.GFX0.INCB() -} +}
Method(_Q08) // FN lock QEvent { @@ -47,14 +47,14 @@ } Store ("<----- _Q54", Debug) } - + Method(_QD5) // 10 second power button press { Store ("-----> _QD5", Debug) _SB.PWPR() Store ("<----- _QD5", Debug) } - + Method(_QD6) // 10 second power button de-press { Store ("-----> _QD6", Debug) diff --git a/src/ec/starlabs/it8987/acpi/lid.asl b/src/ec/starlabs/it8987/acpi/lid.asl index 58c2f52..22e8eeb 100644 --- a/src/ec/starlabs/it8987/acpi/lid.asl +++ b/src/ec/starlabs/it8987/acpi/lid.asl @@ -32,7 +32,7 @@
Method (_Q0C, 0, NotSerialized) // Lid close event { - DEBUG = "---> IT8987 LID: Q0C (close event)" + DEBUG = "---> IT8987 LID: Q0C (close event)" LIDS = 0 \LIDS = LIDS Notify (LID0, 0x80) diff --git a/src/ec/starlabs/it8987/ec.c b/src/ec/starlabs/it8987/ec.c index 4012208..cdfc5bd 100644 --- a/src/ec/starlabs/it8987/ec.c +++ b/src/ec/starlabs/it8987/ec.c @@ -11,25 +11,30 @@ #include "ec.h" #include "chip.h"
-void it8987_write_data(u8 addr, u8 data) { +void it8987_write_data(u8 addr, u8 data) +{ outb(addr, IT8987E_ADDR); outb(data, IT8987E_DATA); }
-u8 it8987_read_data(u8 addr) { +u8 it8987_read_data(u8 addr) +{ outb(addr, IT8987E_ADDR); - return(inb(IT8987E_DATA)); + return inb(IT8987E_DATA); }
-u16 it8987_read_chipid(void) { +u16 it8987_read_chipid(void) +{ return((it8987_read_data(0x20) << 8) | it8987_read_data(0x21)); }
-u16 it8987_get_version(void) { +u16 it8987_get_version(void) +{ return (ec_read(0x00) << 8) | ec_read(0x01); }
-static void it8987_init(struct device *dev) { +static void it8987_init(struct device *dev) +{ u8 val;
if (!dev->enabled) @@ -52,17 +57,17 @@ val = 0; ec_write(ECRAM_KBL_TIMEOUT, val);
- /* + /* * Set the correct state for the Ctrl Fn Reverse option. This * swaps the Ctrl and Fn keys to make it like an Apple keyboard. */ if (get_option(&val, "fn_ctrl_swap") != CB_SUCCESS) val = 0; ec_write(ECRAM_FN_CTRL_REVERSE, val); - + /* * Copy the stored state of the fn_lock_state CMOS variable to the - * corresponding location within the EC RAM. + * corresponding location within the EC RAM. */ if (get_option(&val, "fn_lock_state") != CB_SUCCESS) val = 0;