diff --git a/src/console/Kconfig b/src/console/Kconfig index 8facfabdb3..bad6c564fc 100644 --- a/src/console/Kconfig +++ b/src/console/Kconfig @@ -304,8 +304,8 @@ config SPI_CONSOLE config CONSOLE_SYSTEM76_EC bool "System76 EC console output" - default y - depends on DRIVERS_SYSTEM76_EC + default n + depends on EC_SYSTEM76_EC help Send coreboot debug output to a System76 embedded controller. diff --git a/src/drivers/system76_ec/Kconfig b/src/drivers/system76_ec/Kconfig deleted file mode 100644 index 622f736127..0000000000 --- a/src/drivers/system76_ec/Kconfig +++ /dev/null @@ -1,2 +0,0 @@ -config DRIVERS_SYSTEM76_EC - bool diff --git a/src/ec/system76/ec/Kconfig b/src/ec/system76/ec/Kconfig new file mode 100644 index 0000000000..448771eb07 --- /dev/null +++ b/src/ec/system76/ec/Kconfig @@ -0,0 +1,4 @@ +config EC_SYSTEM76_EC + bool + help + System76 EC diff --git a/src/drivers/system76_ec/Makefile.inc b/src/ec/system76/ec/Makefile.inc similarity index 82% rename from src/drivers/system76_ec/Makefile.inc rename to src/ec/system76/ec/Makefile.inc index 58af38a363..d6daa7cbdb 100644 --- a/src/drivers/system76_ec/Makefile.inc +++ b/src/ec/system76/ec/Makefile.inc @@ -1,4 +1,4 @@ -ifeq ($(CONFIG_DRIVERS_SYSTEM76_EC),y) +ifeq ($(CONFIG_EC_SYSTEM76_EC),y) bootblock-y += system76_ec.c verstage-y += system76_ec.c diff --git a/src/mainboard/system76/addw2/acpi/ac.asl b/src/ec/system76/ec/acpi/ac.asl similarity index 100% rename from src/mainboard/system76/addw2/acpi/ac.asl rename to src/ec/system76/ec/acpi/ac.asl diff --git a/src/mainboard/system76/addw2/acpi/battery.asl b/src/ec/system76/ec/acpi/battery.asl similarity index 100% rename from src/mainboard/system76/addw2/acpi/battery.asl rename to src/ec/system76/ec/acpi/battery.asl diff --git a/src/mainboard/system76/gaze15/acpi/buttons.asl b/src/ec/system76/ec/acpi/buttons.asl similarity index 59% rename from src/mainboard/system76/gaze15/acpi/buttons.asl rename to src/ec/system76/ec/acpi/buttons.asl index 9ad4f03d65..ae85c67ccc 100644 --- a/src/mainboard/system76/gaze15/acpi/buttons.asl +++ b/src/ec/system76/ec/acpi/buttons.asl @@ -3,11 +3,11 @@ Device (PWRB) { Name (_HID, EisaId ("PNP0C0C")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) + Name (_PRW, Package () { EC_GPE_SWI, 3 }) } Device (SLPB) { Name (_HID, EisaId ("PNP0C0E")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) + Name (_PRW, Package () { EC_GPE_SWI, 3 }) } diff --git a/src/mainboard/system76/cml-u/acpi/ec.asl b/src/ec/system76/ec/acpi/ec.asl similarity index 94% rename from src/mainboard/system76/cml-u/acpi/ec.asl rename to src/ec/system76/ec/acpi/ec.asl index f8002b089a..5989f6d285 100644 --- a/src/mainboard/system76/cml-u/acpi/ec.asl +++ b/src/ec/system76/ec/acpi/ec.asl @@ -1,9 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -Device (EC0) +Scope (\_SB) { + #include "ac.asl" + #include "battery.asl" + #include "buttons.asl" + #include "hid.asl" + #include "lid.asl" + #include "s76.asl" +} + +Device (\_SB.PCI0.LPCB.EC0) { Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */) // _HID: Hardware ID - Name (_GPE, 0x50 /* GPP_E16 */) // _GPE: General Purpose Events + Name (_GPE, EC_GPE_SCI) // _GPE: General Purpose Events Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { IO (Decode16, @@ -20,7 +29,7 @@ Device (EC0) ) }) - #include "acpi/ec_ram.asl" + #include "ec_ram.asl" Name (ECOK, Zero) Method (_REG, 2, Serialized) // _REG: Region Availability @@ -75,8 +84,6 @@ Device (EC0) Notify(^^^^AC, Zero) Notify(^^^^BAT0, Zero) - Sleep (1000) - // Reset System76 Device ^^^^S76D.RSET() } @@ -158,13 +165,10 @@ Device (EC0) Debug = "EC: AC Detect" ^^^^AC.ACFG = ADP Notify (AC, 0x80) // Status Change - Sleep (0x01F4) If (BAT0) { Notify (^^^^BAT0, 0x81) // Information Change - Sleep (0x32) Notify (^^^^BAT0, 0x80) // Status Change - Sleep (0x32) } } diff --git a/src/mainboard/system76/addw2/acpi/ec_ram.asl b/src/ec/system76/ec/acpi/ec_ram.asl similarity index 100% rename from src/mainboard/system76/addw2/acpi/ec_ram.asl rename to src/ec/system76/ec/acpi/ec_ram.asl diff --git a/src/mainboard/system76/addw2/acpi/hid.asl b/src/ec/system76/ec/acpi/hid.asl similarity index 100% rename from src/mainboard/system76/addw2/acpi/hid.asl rename to src/ec/system76/ec/acpi/hid.asl diff --git a/src/mainboard/system76/addw2/acpi/lid.asl b/src/ec/system76/ec/acpi/lid.asl similarity index 89% rename from src/mainboard/system76/addw2/acpi/lid.asl rename to src/ec/system76/ec/acpi/lid.asl index 2d974c8e7d..45e646acbb 100644 --- a/src/mainboard/system76/addw2/acpi/lid.asl +++ b/src/ec/system76/ec/acpi/lid.asl @@ -3,7 +3,7 @@ Device (LID0) { Name (_HID, EisaId ("PNP0C0D")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) + Name (_PRW, Package () { EC_GPE_SWI, 3 }) Method (_LID, 0, NotSerialized) { DEBUG = "LID: _LID" diff --git a/src/mainboard/system76/whl-u/acpi/s76.asl b/src/ec/system76/ec/acpi/s76.asl similarity index 97% rename from src/mainboard/system76/whl-u/acpi/s76.asl rename to src/ec/system76/ec/acpi/s76.asl index 70417f9590..b65f3edcd3 100644 --- a/src/mainboard/system76/whl-u/acpi/s76.asl +++ b/src/ec/system76/ec/acpi/s76.asl @@ -14,7 +14,7 @@ Device (S76D) { Debug = "S76D: RSET" SAPL(0) SKBL(0) - #if COLOR_KEYBOARD + #if EC_COLOR_KEYBOARD SKBC(0xFFFFFF) #endif } @@ -64,7 +64,7 @@ Device (S76D) { } } -#if COLOR_KEYBOARD +#if EC_COLOR_KEYBOARD // Set KB LED Brightness Method (SKBL, 1, Serialized) { If (^^PCI0.LPCB.EC0.ECOK) { diff --git a/src/drivers/system76_ec/system76_ec.c b/src/ec/system76/ec/system76_ec.c similarity index 100% rename from src/drivers/system76_ec/system76_ec.c rename to src/ec/system76/ec/system76_ec.c diff --git a/src/mainboard/system76/addw2/Kconfig b/src/mainboard/system76/addw2/Kconfig index 070bf75436..24114c1afa 100644 --- a/src/mainboard/system76/addw2/Kconfig +++ b/src/mainboard/system76/addw2/Kconfig @@ -5,8 +5,7 @@ config BOARD_SPECIFIC_OPTIONS select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_HID select DRIVERS_I2C_TAS5825M - select DRIVERS_SYSTEM76_EC - select EC_ACPI + select EC_SYSTEM76_EC select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_SMI_HANDLER diff --git a/src/mainboard/system76/addw2/acpi/buttons.asl b/src/mainboard/system76/addw2/acpi/buttons.asl deleted file mode 100644 index 9ad4f03d65..0000000000 --- a/src/mainboard/system76/addw2/acpi/buttons.asl +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (PWRB) -{ - Name (_HID, EisaId ("PNP0C0C")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) -} - -Device (SLPB) -{ - Name (_HID, EisaId ("PNP0C0E")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) -} diff --git a/src/mainboard/system76/addw2/acpi/ec.asl b/src/mainboard/system76/addw2/acpi/ec.asl deleted file mode 100644 index 8c7a15ddcc..0000000000 --- a/src/mainboard/system76/addw2/acpi/ec.asl +++ /dev/null @@ -1,217 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (EC0) -{ - Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */) // _HID: Hardware ID - Name (_GPE, 0x03 /* GPP_K3 */) // _GPE: General Purpose Events - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings - { - IO (Decode16, - 0x0062, // Range Minimum - 0x0062, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - IO (Decode16, - 0x0066, // Range Minimum - 0x0066, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - }) - - #include "acpi/ec_ram.asl" - - Name (ECOK, Zero) - Method (_REG, 2, Serialized) // _REG: Region Availability - { - Debug = Concatenate("EC: _REG", Concatenate(ToHexString(Arg0), Concatenate(" ", ToHexString(Arg1)))) - If (((Arg0 == 0x03) && (Arg1 == One))) { - // Enable hardware touchpad lock, airplane mode, and keyboard backlight keys - ECOS = 1 - - // Enable software display brightness keys - WINF = 1 - - // Set current AC state - ^^^^AC.ACFG = ADP - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - PNOT () - - // EC is now available - ECOK = Arg1 - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (PTS, 1, Serialized) { - Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) - If (ECOK) { - // Clear wake cause - WFNO = Zero - } - } - - Method (WAK, 1, Serialized) { - Debug = Concatenate("EC: WAK: ", ToHexString(Arg0)) - If (ECOK) { - // Set current AC state - ^^^^AC.ACFG = ADP - - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (_Q0A, 0, NotSerialized) // Touchpad Toggle - { - Debug = "EC: Touchpad Toggle" - } - - Method (_Q0B, 0, NotSerialized) // Screen Toggle - { - Debug = "EC: Screen Toggle" - } - - Method (_Q0C, 0, NotSerialized) // Mute - { - Debug = "EC: Mute" - } - - Method (_Q0D, 0, NotSerialized) // Keyboard Backlight - { - Debug = "EC: Keyboard Backlight" - } - - Method (_Q0E, 0, NotSerialized) // Volume Down - { - Debug = "EC: Volume Down" - } - - Method (_Q0F, 0, NotSerialized) // Volume Up - { - Debug = "EC: Volume Up" - } - - Method (_Q10, 0, NotSerialized) // Switch Video Mode - { - Debug = "EC: Switch Video Mode" - } - - Method (_Q11, 0, NotSerialized) // Brightness Down - { - Debug = "EC: Brightness Down" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (20) - } - } - - Method (_Q12, 0, NotSerialized) // Brightness Up - { - Debug = "EC: Brightness Up" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (19) - } - } - - Method (_Q13, 0, NotSerialized) // Camera Toggle - { - Debug = "EC: Camera Toggle" - } - - Method (_Q14, 0, NotSerialized) // Airplane Mode - { - Debug = "EC: Airplane Mode" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (8) - } - // TODO: hardware airplane mode - } - - Method (_Q15, 0, NotSerialized) // Suspend Button - { - Debug = "EC: Suspend Button" - Notify (SLPB, 0x80) - } - - Method (_Q16, 0, NotSerialized) // AC Detect - { - Debug = "EC: AC Detect" - ^^^^AC.ACFG = ADP - Notify (AC, 0x80) // Status Change - If (BAT0) - { - Notify (^^^^BAT0, 0x81) // Information Change - Notify (^^^^BAT0, 0x80) // Status Change - } - } - - Method (_Q17, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (17)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q19, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (19)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q1B, 0, NotSerialized) // Lid Close - { - Debug = "EC: Lid Close" - Notify (LID0, 0x80) - } - - Method (_Q1C, 0, NotSerialized) // Thermal Trip - { - Debug = "EC: Thermal Trip" - /* TODO - Notify (\_TZ.TZ0, 0x81) // Thermal Trip Point Change - Notify (\_TZ.TZ0, 0x80) // Thermal Status Change - */ - } - - Method (_Q1D, 0, NotSerialized) // Power Button - { - Debug = "EC: Power Button" - Notify (PWRB, 0x80) - } - - Method (_Q50, 0, NotSerialized) // Other Events - { - Local0 = OEM4 - If (Local0 == 0x8A) { - Debug = "EC: White Keyboard Backlight" - Notify (^^^^S76D, 0x80) - } ElseIf (Local0 == 0x9F) { - Debug = "EC: Color Keyboard Toggle" - Notify (^^^^S76D, 0x81) - } ElseIf (Local0 == 0x81) { - Debug = "EC: Color Keyboard Down" - Notify (^^^^S76D, 0x82) - } ElseIf (Local0 == 0x82) { - Debug = "EC: Color Keyboard Up" - Notify (^^^^S76D, 0x83) - } ElseIf (Local0 == 0x80) { - Debug = "EC: Color Keyboard Color Change" - Notify (^^^^S76D, 0x84) - } Else { - Debug = Concatenate("EC: Other: ", ToHexString(Local0)) - } - } -} diff --git a/src/mainboard/system76/addw2/acpi/mainboard.asl b/src/mainboard/system76/addw2/acpi/mainboard.asl index 11735e8e01..e4bcac3209 100644 --- a/src/mainboard/system76/addw2/acpi/mainboard.asl +++ b/src/mainboard/system76/addw2/acpi/mainboard.asl @@ -1,15 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#define EC_GPE_SCI 0x03 /* GPP_K3 */ +#define EC_GPE_SWI 0x06 /* GPP_K6 */ +#define EC_COLOR_KEYBOARD 1 +#include + Scope (\_SB) { - #include "ac.asl" - #include "battery.asl" - #include "buttons.asl" - #include "hid.asl" - #include "lid.asl" - #include "s76.asl" #include "sleep.asl" + Scope (PCI0) { + #include "pegp.asl" + #include "dgpu.asl" + } } -Scope (_GPE) { +Scope (\_GPE) { #include "gpe.asl" } diff --git a/src/mainboard/system76/addw2/acpi/s76.asl b/src/mainboard/system76/addw2/acpi/s76.asl deleted file mode 100644 index 8deb293ea8..0000000000 --- a/src/mainboard/system76/addw2/acpi/s76.asl +++ /dev/null @@ -1,89 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -// Notifications: -// 0x80 - hardware backlight toggle -// 0x81 - backlight toggle -// 0x82 - backlight down -// 0x83 - backlight up -// 0x84 - backlight color change -Device (S76D) { - Name (_HID, "17761776") - Name (_UID, 0) - - Method (RSET, 0, Serialized) { - Debug = "S76D: RSET" - SAPL(0) - SKBL(0) - SKBC(0xFFFFFF) - } - - Method (INIT, 0, Serialized) { - Debug = "S76D: INIT" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use software control - ^^PCI0.LPCB.EC0.ECOS = 2 - Return (0) - } Else { - Return (1) - } - } - - Method (FINI, 0, Serialized) { - Debug = "S76D: FINI" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use hardware control - ^^PCI0.LPCB.EC0.ECOS = 1 - Return (0) - } Else { - Return (1) - } - } - - // Get Airplane LED - Method (GAPL, 0, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (^^PCI0.LPCB.EC0.AIRP & 0x40) { - Return (1) - } - } - Return (0) - } - - // Set Airplane LED - Method (SAPL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (Arg0) { - ^^PCI0.LPCB.EC0.AIRP |= 0x40 - } Else { - ^^PCI0.LPCB.EC0.AIRP &= 0xBF - } - } - } - - // Set KB LED Brightness - Method (SKBL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 6 - ^^PCI0.LPCB.EC0.FBUF = Arg0 - ^^PCI0.LPCB.EC0.FBF1 = 0 - ^^PCI0.LPCB.EC0.FBF2 = Arg0 - ^^PCI0.LPCB.EC0.FCMD = 0xCA - } - } - - // Set Keyboard Color - Method (SKBC, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 0x3 - ^^PCI0.LPCB.EC0.FBUF = (Arg0 & 0xFF) - ^^PCI0.LPCB.EC0.FBF1 = ((Arg0 >> 16) & 0xFF) - ^^PCI0.LPCB.EC0.FBF2 = ((Arg0 >> 8) & 0xFF) - ^^PCI0.LPCB.EC0.FCMD = 0xCA - Return (Arg0) - } Else { - Return (0) - } - } -} diff --git a/src/mainboard/system76/addw2/dsdt.asl b/src/mainboard/system76/addw2/dsdt.asl index 99765fd872..eac27b56f1 100644 --- a/src/mainboard/system76/addw2/dsdt.asl +++ b/src/mainboard/system76/addw2/dsdt.asl @@ -18,8 +18,6 @@ DefinitionBlock( { #include #include - #include "acpi/pegp.asl" - #include "acpi/dgpu.asl" } #include @@ -27,7 +25,6 @@ DefinitionBlock( Scope (\_SB.PCI0.LPCB) { #include - #include "acpi/ec.asl" } #include "acpi/mainboard.asl" diff --git a/src/mainboard/system76/addw2/gpio.h b/src/mainboard/system76/addw2/gpio.h index c4f5b6d987..fd2a7d733a 100644 --- a/src/mainboard/system76/addw2/gpio.h +++ b/src/mainboard/system76/addw2/gpio.h @@ -13,10 +13,8 @@ /* Pad configuration in romstage. */ static const struct pad_config early_gpio_table[] = { - PAD_CFG_GPI(GPP_C20, NONE, DEEP), - PAD_CFG_GPI(GPP_C21, NONE, DEEP), - PAD_CFG_TERM_GPO(DGPU_RST_N, 0, NONE, DEEP), - PAD_CFG_TERM_GPO(DGPU_PWR_EN, 0, NONE, DEEP), + PAD_CFG_TERM_GPO(GPP_F22, 0, NONE, DEEP), // DGPU_RST_N + PAD_CFG_TERM_GPO(GPP_F23, 0, NONE, DEEP), // DGPU_PWR_EN }; /* Pad configuration in ramstage. */ @@ -174,14 +172,14 @@ static const struct pad_config gpio_table[] = { PAD_CFG_GPI(GPP_G5, NONE, DEEP), PAD_CFG_GPI(GPP_G6, NONE, DEEP), PAD_CFG_GPI(GPP_G7, NONE, DEEP), - PAD_CFG_NF(GPP_H0, NONE, DEEP, NF1), - PAD_CFG_NF(GPP_H1, NONE, DEEP, NF1), - PAD_CFG_NF(GPP_H2, NONE, DEEP, NF1), - PAD_CFG_NF(GPP_H3, NONE, DEEP, NF1), - PAD_CFG_GPI(GPP_H4, NONE, DEEP), + PAD_CFG_NF(GPP_H0, NONE, DEEP, NF1), // WLAN_CLKREQ# + PAD_CFG_NF(GPP_H1, NONE, DEEP, NF1), // CR_CLKREQ# + PAD_CFG_NF(GPP_H2, NONE, DEEP, NF1), // PEG_CLKREQ# + PAD_CFG_NF(GPP_H3, NONE, DEEP, NF1), // SSD1_CLKREQ# + PAD_CFG_NF(GPP_H4, NONE, DEEP, NF1), // SSD2_CLKREQ# PAD_CFG_GPI(GPP_H5, NONE, DEEP), - PAD_CFG_TERM_GPO(GPP_H6, 1, NONE, DEEP), - PAD_CFG_TERM_GPO(GPP_H7, 1, NONE, DEEP), + PAD_CFG_TERM_GPO(GPP_H6, 1, NONE, DEEP), // PCIE_SSD1_RST# + PAD_CFG_TERM_GPO(GPP_H7, 1, NONE, DEEP), // PCIE_SSD2_RST# PAD_CFG_GPI(GPP_H8, NONE, DEEP), _PAD_CFG_STRUCT(GPP_H9, 0x40880100, 0x0000), PAD_CFG_GPI(GPP_H10, NONE, DEEP), @@ -206,8 +204,8 @@ static const struct pad_config gpio_table[] = { PAD_CFG_TERM_GPO(GPP_I5, 1, UP_20K, PLTRST), // TBT_GPIO_RST# PAD_CFG_GPI(GPP_I6, NONE, DEEP), PAD_CFG_GPI(GPP_I7, NONE, DEEP), - PAD_CFG_TERM_GPO(GPP_I8, 1, NONE, DEEP), - PAD_CFG_TERM_GPO(GPP_I9, 1, NONE, DEEP), + PAD_CFG_TERM_GPO(GPP_I8, 1, NONE, DEEP), // SSD1_PWR_EN + PAD_CFG_TERM_GPO(GPP_I9, 1, NONE, DEEP), // SSD2_PWR_EN PAD_CFG_GPI(GPP_I10, NONE, DEEP), PAD_CFG_GPI(GPP_I11, NONE, DEEP), PAD_CFG_TERM_GPO(GPP_I12, 1, NONE, DEEP), diff --git a/src/mainboard/system76/cfl-h/acpi/ac.asl b/src/mainboard/system76/cfl-h/acpi/ac.asl deleted file mode 100644 index 7a55e45ca3..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/ac.asl +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -Device (AC) -{ - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - - Name (ACFG, One) - - Method (_PSR, 0, NotSerialized) // _PSR: Power Source - { - Return (ACFG) - } - - Method (_STA, 0, NotSerialized) // _STA: Status - { - Return (0x0F) - } -} diff --git a/src/mainboard/system76/cfl-h/acpi/battery.asl b/src/mainboard/system76/cfl-h/acpi/battery.asl deleted file mode 100644 index bfda8a00cd..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/battery.asl +++ /dev/null @@ -1,183 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -Device (BAT0) -{ - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, Zero) // _UID: Unique ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - Name (BFCC, Zero) - Method (_STA, 0, NotSerialized) // _STA: Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Return (0x1F) - } - Else - { - Return (0x0F) - } - } - Else - { - Return (0x0F) - } - } - - Name (PBIF, Package (0x0D) - { - One, - 0xFFFFFFFF, - 0xFFFFFFFF, - One, - 0x39D0, - Zero, - Zero, - 0x40, - 0x40, - "BAT", - "0001", - "LION", - "Notebook" - }) - Method (IVBI, 0, NotSerialized) - { - PBIF [One] = 0xFFFFFFFF - PBIF [0x02] = 0xFFFFFFFF - PBIF [0x04] = 0xFFFFFFFF - PBIF [0x09] = " " - PBIF [0x0A] = " " - PBIF [0x0B] = " " - PBIF [0x0C] = " " - BFCC = Zero - } - - Method (UPBI, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF) - PBIF [One] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF) - PBIF [0x02] = Local0 - BFCC = Local0 - Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF) - PBIF [0x04] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF) - PBIF [0x05] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF) - PBIF [0x06] = Local0 - PBIF [0x09] = "BAT" - PBIF [0x0A] = "0001" - PBIF [0x0B] = "LION" - PBIF [0x0C] = "Notebook" - } - Else - { - IVBI () - } - } - - Method (_BIF, 0, NotSerialized) // _BIF: Battery Information - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBI () - } - Else - { - IVBI () - } - - Return (PBIF) /* \_SB_.BAT0.PBIF */ - } - - Name (PBST, Package (0x04) - { - Zero, - 0xFFFFFFFF, - 0xFFFFFFFF, - 0x3D90 - }) - Method (IVBS, 0, NotSerialized) - { - PBST [Zero] = Zero - PBST [One] = 0xFFFFFFFF - PBST [0x02] = 0xFFFFFFFF - PBST [0x03] = 0x2710 - } - - Method (UPBS, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = Zero - Local1 = Zero - If (^^AC.ACFG) - { - If (((^^PCI0.LPCB.EC0.BST0 & 0x02) == 0x02)) - { - Local0 |= 0x02 - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - } - Else - { - Local0 |= One - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - - Local7 = (Local1 & 0x8000) - If ((Local7 == 0x8000)) - { - Local1 ^= 0xFFFF - } - - Local2 = (^^PCI0.LPCB.EC0.BRC0 & 0xFFFF) - Local3 = (^^PCI0.LPCB.EC0.BPV0 & 0xFFFF) - PBST [Zero] = Local0 - PBST [One] = Local1 - PBST [0x02] = Local2 - PBST [0x03] = Local3 - If ((BFCC != ^^PCI0.LPCB.EC0.BFC0)) - { - Notify (BAT0, 0x81) // Information Change - } - } - Else - { - IVBS () - } - } - - Method (_BST, 0, NotSerialized) // _BST: Battery Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBS () - } - Else - { - IVBS () - } - - Return (PBST) /* \_SB_.BAT0.PBST */ - } -} diff --git a/src/mainboard/system76/cfl-h/acpi/buttons.asl b/src/mainboard/system76/cfl-h/acpi/buttons.asl deleted file mode 100644 index 5afc8aa0b8..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/buttons.asl +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -Device (PWRB) -{ - Name (_HID, EisaId ("PNP0C0C")) - Name (_PRW, Package () { 6 /* GPP_K6 */, 3 }) -} - -Device (SLPB) -{ - Name (_HID, EisaId ("PNP0C0E")) - Name (_PRW, Package () { 6 /* GPP_K6 */, 3 }) -} diff --git a/src/mainboard/system76/cfl-h/acpi/ec.asl b/src/mainboard/system76/cfl-h/acpi/ec.asl deleted file mode 100644 index 96e0a608cd..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/ec.asl +++ /dev/null @@ -1,231 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -Device (EC0) -{ - Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */) // _HID: Hardware ID - Name (_GPE, 3 /* GPP_K3 */) // _GPE: General Purpose Events - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings - { - IO (Decode16, - 0x0062, // Range Minimum - 0x0062, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - IO (Decode16, - 0x0066, // Range Minimum - 0x0066, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - }) - - #include "acpi/ec_ram.asl" - - Name (ECOK, Zero) - Method (_REG, 2, Serialized) // _REG: Region Availability - { - Debug = Concatenate("EC: _REG", Concatenate(ToHexString(Arg0), Concatenate(" ", ToHexString(Arg1)))) - If (((Arg0 == 0x03) && (Arg1 == One))) { - // Enable hardware touchpad lock, airplane mode, and keyboard backlight keys - ECOS = 1 - - // Enable software display brightness keys - WINF = 1 - - // Set current AC state - ^^^^AC.ACFG = ADP - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - PNOT () - - // EC is now available - ECOK = Arg1 - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (PTS, 1, Serialized) { - Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) - If (ECOK) { - // Clear wake cause - WFNO = Zero - } - } - - Method (WAK, 1, Serialized) { - Debug = Concatenate("EC: WAK: ", ToHexString(Arg0)) - If (ECOK) { - // Set current AC state - ^^^^AC.ACFG = ADP - - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - Sleep (1000) - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (_Q0A, 0, NotSerialized) // Touchpad Toggle - { - Debug = "EC: Touchpad Toggle" - } - - Method (_Q0B, 0, NotSerialized) // Screen Toggle - { - Debug = "EC: Screen Toggle" - } - - Method (_Q0C, 0, NotSerialized) // Mute - { - Debug = "EC: Mute" - } - - Method (_Q0D, 0, NotSerialized) // Keyboard Backlight - { - Debug = "EC: Keyboard Backlight" - } - - Method (_Q0E, 0, NotSerialized) // Volume Down - { - Debug = "EC: Volume Down" - } - - Method (_Q0F, 0, NotSerialized) // Volume Up - { - Debug = "EC: Volume Up" - } - - Method (_Q10, 0, NotSerialized) // Switch Video Mode - { - Debug = "EC: Switch Video Mode" - } - - Method (_Q11, 0, NotSerialized) // Brightness Down - { - Debug = "EC: Brightness Down" - ^^^^HIDD.HPEM (20) - } - - Method (_Q12, 0, NotSerialized) // Brightness Up - { - Debug = "EC: Brightness Up" - ^^^^HIDD.HPEM (19) - } - - Method (_Q13, 0, NotSerialized) // Camera Toggle - { - Debug = "EC: Camera Toggle" - } - - Method (_Q14, 0, NotSerialized) // Airplane Mode - { - Debug = "EC: Airplane Mode" - // Only send HIDD message when hardware airplane mode not in use - If (ECOS == 2) { - ^^^^HIDD.HPEM (8) - } - } - - Method (_Q15, 0, NotSerialized) // Suspend Button - { - Debug = "EC: Suspend Button" - Notify (SLPB, 0x80) - } - - Method (_Q16, 0, NotSerialized) // AC Detect - { - Debug = "EC: AC Detect" - ^^^^AC.ACFG = ADP - Notify (AC, 0x80) // Status Change - Sleep (0x01F4) - If (BAT0) - { - Notify (^^^^BAT0, 0x81) // Information Change - Sleep (0x32) - Notify (^^^^BAT0, 0x80) // Status Change - Sleep (0x32) - } - } - - Method (_Q17, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (17)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q19, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (19)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q1B, 0, NotSerialized) // Lid Close - { - Debug = "EC: Lid Close" - Notify (LID0, 0x80) - } - - Method (_Q1C, 0, NotSerialized) // Thermal Trip - { - Debug = "EC: Thermal Trip" - /* TODO - Notify (\_TZ.TZ0, 0x81) // Thermal Trip Point Change - Notify (\_TZ.TZ0, 0x80) // Thermal Status Change - */ - } - - Method (_Q1D, 0, NotSerialized) // Power Button - { - Debug = "EC: Power Button" - Notify (PWRB, 0x80) - } - - Method (_Q50, 0, NotSerialized) // Other Events - { - Local0 = OEM4 - If (Local0 == 0x8A) { - Debug = "EC: White Keyboard Backlight" - Notify (^^^^S76D, 0x80) - } ElseIf (Local0 == 0x9F) { - Debug = "EC: Color Keyboard Toggle" - Notify (^^^^S76D, 0x81) - } ElseIf (Local0 == 0x81) { - Debug = "EC: Color Keyboard Down" - Notify (^^^^S76D, 0x82) - } ElseIf (Local0 == 0x82) { - Debug = "EC: Color Keyboard Up" - Notify (^^^^S76D, 0x83) - } ElseIf (Local0 == 0x80) { - Debug = "EC: Color Keyboard Color Change" - Notify (^^^^S76D, 0x84) - } Else { - Debug = Concatenate("EC: Other: ", ToHexString(Local0)) - } - } -} diff --git a/src/mainboard/system76/cfl-h/acpi/ec_ram.asl b/src/mainboard/system76/cfl-h/acpi/ec_ram.asl deleted file mode 100644 index 167bb3c3db..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/ec_ram.asl +++ /dev/null @@ -1,192 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF) -Field (ERAM, ByteAcc, Lock, Preserve) -{ - NMSG, 8, - SLED, 4, - Offset (0x02), - MODE, 1, - FAN0, 1, - TME0, 1, - TME1, 1, - FAN1, 1, - , 2, - Offset (0x03), - LSTE, 1, - LSW0, 1, - LWKE, 1, - WAKF, 1, - , 2, - PWKE, 1, - MWKE, 1, - AC0, 8, - PSV, 8, - CRT, 8, - TMP, 8, - AC1, 8, - BBST, 8, - Offset (0x0B), - Offset (0x0C), - Offset (0x0D), - Offset (0x0E), - SLPT, 8, - SWEJ, 1, - SWCH, 1, - Offset (0x10), - ADP, 1, - AFLT, 1, - BAT0, 1, - BAT1, 1, - , 3, - PWOF, 1, - WFNO, 8, - BPU0, 32, - BDC0, 32, - BFC0, 32, - BTC0, 32, - BDV0, 32, - BST0, 32, - BPR0, 32, - BRC0, 32, - BPV0, 32, - BTP0, 16, - BRS0, 16, - BCW0, 32, - BCL0, 32, - BCG0, 32, - BG20, 32, - BMO0, 64, - BIF0, 64, - BSN0, 32, - BTY0, 64, - Offset (0x67), - Offset (0x68), - ECOS, 8, - LNXD, 8, - ECPS, 8, - Offset (0x6C), - BTMP, 16, - EVTN, 8, - Offset (0x72), - PRCL, 8, - PRC0, 8, - PRC1, 8, - PRCM, 8, - PRIN, 8, - PSTE, 8, - PCAD, 8, - PEWL, 8, - PWRL, 8, - PECD, 8, - PEHI, 8, - PECI, 8, - PEPL, 8, - PEPM, 8, - PWFC, 8, - PECC, 8, - PDT0, 8, - PDT1, 8, - PDT2, 8, - PDT3, 8, - PRFC, 8, - PRS0, 8, - PRS1, 8, - PRS2, 8, - PRS3, 8, - PRS4, 8, - PRCS, 8, - PEC0, 8, - PEC1, 8, - PEC2, 8, - PEC3, 8, - CMDR, 8, - CVRT, 8, - GTVR, 8, - FANT, 8, - SKNT, 8, - AMBT, 8, - MCRT, 8, - DIM0, 8, - DIM1, 8, - PMAX, 8, - PPDT, 8, - PECH, 8, - PMDT, 8, - TSD0, 8, - TSD1, 8, - TSD2, 8, - TSD3, 8, - CPUP, 16, - MCHP, 16, - SYSP, 16, - CPAP, 16, - MCAP, 16, - SYAP, 16, - CFSP, 16, - CPUE, 16, - Offset (0xC6), - Offset (0xC7), - VGAT, 8, - OEM1, 8, - OEM2, 8, - OEM3, 16, - OEM4, 8, - OEM5, 8, - DUT1, 8, - DUT2, 8, - RPM1, 16, - RPM2, 16, - RPM4, 16, - Offset (0xD7), - DTHL, 8, - DTBP, 8, - AIRP, 8, - WINF, 8, - RINF, 8, - Offset (0xDD), - INF2, 8, - MUTE, 1, - Offset (0xE0), - RPM3, 16, - ECKS, 8, - Offset (0xE4), - , 4, - XTUF, 1, - EP12, 1, - FN_G, 1, - Offset (0xE5), - INF3, 8, - DFAL, 1, - DFAE, 1, - Offset (0xE7), - XFAN, 8, - , 2, - MAXQ, 1, - Offset (0xE9), - EKBS, 1, - Offset (0xF0), - PL1T, 16, - PL2T, 16, - TAUT, 8, - Offset (0xF8), - FCMD, 8, - FDAT, 8, - FBUF, 8, - FBF1, 8, - FBF2, 8, - FBF3, 8 -} diff --git a/src/mainboard/system76/cfl-h/acpi/gpe.asl b/src/mainboard/system76/cfl-h/acpi/gpe.asl deleted file mode 100644 index 080eb59974..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/gpe.asl +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -// GPP_K6 SWI -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 == One) { - Notify(\_SB.LID0, 0x80) - } - } -} diff --git a/src/mainboard/system76/cfl-h/acpi/hid.asl b/src/mainboard/system76/cfl-h/acpi/hid.asl deleted file mode 100644 index c75fefa6a0..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/hid.asl +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -Device (HIDD) -{ - Name (_HID, "INT33D5") - Name (HBSY, Zero) - Name (HIDX, Zero) - Name (HRDY, Zero) - - Method (HDEM, 0, Serialized) - { - HBSY = Zero - Return (HIDX) - } - - Method (HDMM, 0, Serialized) - { - Return (Zero) - } - - Method (HDSM, 1, Serialized) - { - HRDY = Arg0 - } - - Method (HPEM, 1, Serialized) - { - HBSY = One - HIDX = Arg0 - - Notify (HIDD, 0xC0) - Local0 = Zero - While (((Local0 < 0xFA) && HBSY)) - { - Sleep (0x04) - Local0++ - } - - If ((HBSY == One)) - { - HBSY = Zero - HIDX = Zero - Return (One) - } - Else - { - Return (Zero) - } - } -} diff --git a/src/mainboard/system76/cfl-h/acpi/lid.asl b/src/mainboard/system76/cfl-h/acpi/lid.asl deleted file mode 100644 index 694da7ffa1..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/lid.asl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -Device (LID0) -{ - Name (_HID, EisaId ("PNP0C0D")) - Name (_PRW, Package () { 6 /* GPP_K6 */, 3 }) - - Method (_LID, 0, NotSerialized) { - DEBUG = "LID: _LID" - If (^^PCI0.LPCB.EC0.ECOK) { - Return (^^PCI0.LPCB.EC0.LSTE) - } Else { - Return (One) - } - } - - Method (_PSW, 1, NotSerialized) { - DEBUG = Concatenate("LID: _PSW: ", ToHexString(Arg0)) - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.LWKE = Arg0 - } - } -} diff --git a/src/mainboard/system76/cfl-h/acpi/mainboard.asl b/src/mainboard/system76/cfl-h/acpi/mainboard.asl deleted file mode 100644 index 0b12ac2d19..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/mainboard.asl +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -Scope (\_SB) { - #include "ac.asl" - #include "battery.asl" - #include "buttons.asl" - #include "hid.asl" - #include "lid.asl" - #include "s76.asl" - #include "sleep.asl" -} - -Scope (_GPE) { - #include "gpe.asl" -} diff --git a/src/mainboard/system76/cfl-h/acpi/s76.asl b/src/mainboard/system76/cfl-h/acpi/s76.asl deleted file mode 100644 index d94fa8c09e..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/s76.asl +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -// Notifications: -// 0x80 - hardware backlight toggle -// 0x81 - backlight toggle -// 0x82 - backlight down -// 0x83 - backlight up -// 0x84 - backlight color change -Device (S76D) { - Name (_HID, "17761776") - Name (_UID, 0) - - Method (RSET, 0, Serialized) { - Debug = "S76D: RSET" - SAPL(0) - SKBL(0) - #if COLOR_KEYBOARD - SKBC(0xFFFFFF) - #endif - } - - Method (INIT, 0, Serialized) { - Debug = "S76D: INIT" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use software control - ^^PCI0.LPCB.EC0.ECOS = 2 - Return (0) - } Else { - Return (1) - } - } - - Method (FINI, 0, Serialized) { - Debug = "S76D: FINI" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use hardware control - ^^PCI0.LPCB.EC0.ECOS = 1 - Return (0) - } Else { - Return (1) - } - } - - // Get Airplane LED - Method (GAPL, 0, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (^^PCI0.LPCB.EC0.AIRP & 0x40) { - Return (1) - } - } - Return (0) - } - - // Set Airplane LED - Method (SAPL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (Arg0) { - ^^PCI0.LPCB.EC0.AIRP |= 0x40 - } Else { - ^^PCI0.LPCB.EC0.AIRP &= 0xBF - } - } - } - - // Set KB LED Brightness - Method (SKBL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 6 - ^^PCI0.LPCB.EC0.FBUF = Arg0 - ^^PCI0.LPCB.EC0.FBF1 = 0 - ^^PCI0.LPCB.EC0.FBF2 = Arg0 - ^^PCI0.LPCB.EC0.FCMD = 0xCA - } - } - - // Set Keyboard Color - Method (SKBC, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 0x3 - ^^PCI0.LPCB.EC0.FBUF = (Arg0 & 0xFF) - ^^PCI0.LPCB.EC0.FBF1 = ((Arg0 >> 16) & 0xFF) - ^^PCI0.LPCB.EC0.FBF2 = ((Arg0 >> 8) & 0xFF) - ^^PCI0.LPCB.EC0.FCMD = 0xCA - Return (Arg0) - } Else { - Return (0) - } - } -} diff --git a/src/mainboard/system76/cfl-h/acpi/sleep.asl b/src/mainboard/system76/cfl-h/acpi/sleep.asl deleted file mode 100644 index 9a3ecaa373..0000000000 --- a/src/mainboard/system76/cfl-h/acpi/sleep.asl +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -/* 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) -} diff --git a/src/mainboard/system76/cfl-h/acpi_tables.c b/src/mainboard/system76/cfl-h/acpi_tables.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/mainboard/system76/cfl-h/bootblock.c b/src/mainboard/system76/cfl-h/bootblock.c deleted file mode 100644 index 7cf57e2835..0000000000 --- a/src/mainboard/system76/cfl-h/bootblock.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -#include -#include -#include -#include - -void bootblock_mainboard_init(void) { - gpio_configure_pads(early_gpio_table, ARRAY_SIZE(early_gpio_table)); -} diff --git a/src/mainboard/system76/cfl-h/dsdt.asl b/src/mainboard/system76/cfl-h/dsdt.asl deleted file mode 100644 index 05ec87c4ad..0000000000 --- a/src/mainboard/system76/cfl-h/dsdt.asl +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2007-2009 coresystems GmbH - * Copyright (C) 2015 Google Inc. - * Copyright (C) 2015 Intel Corporation - * - * 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. - */ - -#include -DefinitionBlock( - "dsdt.aml", - "DSDT", - 0x02, // DSDT revision: ACPI v2.0 and up - OEM_ID, - ACPI_TABLE_CREATOR, - 0x20110725 // OEM revision -) -{ - // Some generic macros - #include - - // global NVS and variables - #include - - // CPU - #include - - Scope (\_SB) { - Device (PCI0) - { - #include - #include - } - } - - // Chipset specific sleep states - #include - - Scope (\_SB.PCI0.LPCB) { - // PS/2 bus - #include - - // Embedded controller - #include "acpi/ec.asl" - } - - // Mainboard specific - #include "acpi/mainboard.asl" -} diff --git a/src/mainboard/system76/cfl-h/ramstage.c b/src/mainboard/system76/cfl-h/ramstage.c deleted file mode 100644 index 5261374d1b..0000000000 --- a/src/mainboard/system76/cfl-h/ramstage.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef GPU_RESET - -#define DGPU_RSTN GPP_F22 -#define DGPU_PWR_EN GPP_F23 -#define DGPU_PWRGD GPP_K22 - -static void gpu_reset(void) { - // Set DGPU_PWR_EN and Wait for DGPU_PWRGD - printk(BIOS_INFO, "system76: DGPU reset start\n"); - gpio_set(DGPU_RSTN, 0); - - printk(BIOS_INFO, "system76: DGPU disable power\n"); - gpio_set(DGPU_PWR_EN, 0); - while (gpio_get(DGPU_PWRGD)) { - printk(BIOS_INFO, "system76: DGPU wait for disabled power\n"); - mdelay(4); - } - - printk(BIOS_INFO, "system76: DGPU enable power\n"); - gpio_set(DGPU_PWR_EN, 1); - while (! gpio_get(DGPU_PWRGD)) { - printk(BIOS_INFO, "system76: DGPU wait for enabled power\n"); - mdelay(4); - } - - printk(BIOS_INFO, "system76: DGPU reset finished\n"); - gpio_set(DGPU_RSTN, 1); -} - -#endif - -void mainboard_silicon_init_params(FSP_S_CONFIG *params) { - /* Configure pads prior to SiliconInit() in case there's any - * dependencies during hardware initialization. */ - cnl_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); -} - -static void mainboard_init(struct device *dev) { - printk(BIOS_INFO, "system76: keyboard init\n"); - pc_keyboard_init(NO_AUX_DEVICE); -} - -static void mainboard_enable(struct device *dev) { -#ifdef GPU_RESET - gpu_reset(); -#endif - - dev->ops->init = mainboard_init; -} - -struct chip_operations mainboard_ops = { - .enable_dev = mainboard_enable, -}; diff --git a/src/mainboard/system76/cml-u/Kconfig b/src/mainboard/system76/cml-u/Kconfig index f63bfc579f..5993e99a71 100644 --- a/src/mainboard/system76/cml-u/Kconfig +++ b/src/mainboard/system76/cml-u/Kconfig @@ -4,7 +4,7 @@ config BOARD_SPECIFIC_OPTIONS def_bool y select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_HID - select EC_ACPI + select EC_SYSTEM76_EC select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_CMOS_DEFAULT diff --git a/src/mainboard/system76/cml-u/acpi/ac.asl b/src/mainboard/system76/cml-u/acpi/ac.asl deleted file mode 100644 index 7326676198..0000000000 --- a/src/mainboard/system76/cml-u/acpi/ac.asl +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (AC) -{ - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - - Name (ACFG, One) - - Method (_PSR, 0, NotSerialized) // _PSR: Power Source - { - Return (ACFG) - } - - Method (_STA, 0, NotSerialized) // _STA: Status - { - Return (0x0F) - } -} diff --git a/src/mainboard/system76/cml-u/acpi/battery.asl b/src/mainboard/system76/cml-u/acpi/battery.asl deleted file mode 100644 index bc239dd9c0..0000000000 --- a/src/mainboard/system76/cml-u/acpi/battery.asl +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (BAT0) -{ - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, Zero) // _UID: Unique ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - Name (BFCC, Zero) - Method (_STA, 0, NotSerialized) // _STA: Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Return (0x1F) - } - Else - { - Return (0x0F) - } - } - Else - { - Return (0x0F) - } - } - - Name (PBIF, Package (0x0D) - { - One, - 0xFFFFFFFF, - 0xFFFFFFFF, - One, - 0x39D0, - Zero, - Zero, - 0x40, - 0x40, - "BAT", - "0001", - "LION", - "Notebook" - }) - Method (IVBI, 0, NotSerialized) - { - PBIF [One] = 0xFFFFFFFF - PBIF [0x02] = 0xFFFFFFFF - PBIF [0x04] = 0xFFFFFFFF - PBIF [0x09] = " " - PBIF [0x0A] = " " - PBIF [0x0B] = " " - PBIF [0x0C] = " " - BFCC = Zero - } - - Method (UPBI, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF) - PBIF [One] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF) - PBIF [0x02] = Local0 - BFCC = Local0 - Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF) - PBIF [0x04] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF) - PBIF [0x05] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF) - PBIF [0x06] = Local0 - PBIF [0x09] = "BAT" - PBIF [0x0A] = "0001" - PBIF [0x0B] = "LION" - PBIF [0x0C] = "Notebook" - } - Else - { - IVBI () - } - } - - Method (_BIF, 0, NotSerialized) // _BIF: Battery Information - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBI () - } - Else - { - IVBI () - } - - Return (PBIF) /* \_SB_.BAT0.PBIF */ - } - - Name (PBST, Package (0x04) - { - Zero, - 0xFFFFFFFF, - 0xFFFFFFFF, - 0x3D90 - }) - Method (IVBS, 0, NotSerialized) - { - PBST [Zero] = Zero - PBST [One] = 0xFFFFFFFF - PBST [0x02] = 0xFFFFFFFF - PBST [0x03] = 0x2710 - } - - Method (UPBS, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = Zero - Local1 = Zero - If (^^AC.ACFG) - { - If (((^^PCI0.LPCB.EC0.BST0 & 0x02) == 0x02)) - { - Local0 |= 0x02 - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - } - Else - { - Local0 |= One - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - - Local7 = (Local1 & 0x8000) - If ((Local7 == 0x8000)) - { - Local1 ^= 0xFFFF - } - - Local2 = (^^PCI0.LPCB.EC0.BRC0 & 0xFFFF) - Local3 = (^^PCI0.LPCB.EC0.BPV0 & 0xFFFF) - PBST [Zero] = Local0 - PBST [One] = Local1 - PBST [0x02] = Local2 - PBST [0x03] = Local3 - If ((BFCC != ^^PCI0.LPCB.EC0.BFC0)) - { - Notify (BAT0, 0x81) // Information Change - } - } - Else - { - IVBS () - } - } - - Method (_BST, 0, NotSerialized) // _BST: Battery Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBS () - } - Else - { - IVBS () - } - - Return (PBST) /* \_SB_.BAT0.PBST */ - } -} diff --git a/src/mainboard/system76/cml-u/acpi/buttons.asl b/src/mainboard/system76/cml-u/acpi/buttons.asl deleted file mode 100644 index 81e61242bf..0000000000 --- a/src/mainboard/system76/cml-u/acpi/buttons.asl +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (PWRB) -{ - Name (_HID, EisaId ("PNP0C0C")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) -} - -Device (SLPB) -{ - Name (_HID, EisaId ("PNP0C0E")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) -} diff --git a/src/mainboard/system76/cml-u/acpi/ec_ram.asl b/src/mainboard/system76/cml-u/acpi/ec_ram.asl deleted file mode 100644 index d5f97edbd7..0000000000 --- a/src/mainboard/system76/cml-u/acpi/ec_ram.asl +++ /dev/null @@ -1,175 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF) -Field (ERAM, ByteAcc, Lock, Preserve) -{ - NMSG, 8, - SLED, 4, - Offset (0x02), - MODE, 1, - FAN0, 1, - TME0, 1, - TME1, 1, - FAN1, 1, - , 2, - Offset (0x03), - LSTE, 1, - LSW0, 1, - LWKE, 1, - WAKF, 1, - , 2, - PWKE, 1, - MWKE, 1, - AC0, 8, - PSV, 8, - CRT, 8, - TMP, 8, - AC1, 8, - BBST, 8, - Offset (0x0B), - Offset (0x0C), - Offset (0x0D), - Offset (0x0E), - SLPT, 8, - SWEJ, 1, - SWCH, 1, - Offset (0x10), - ADP, 1, - AFLT, 1, - BAT0, 1, - BAT1, 1, - , 3, - PWOF, 1, - WFNO, 8, - BPU0, 32, - BDC0, 32, - BFC0, 32, - BTC0, 32, - BDV0, 32, - BST0, 32, - BPR0, 32, - BRC0, 32, - BPV0, 32, - BTP0, 16, - BRS0, 16, - BCW0, 32, - BCL0, 32, - BCG0, 32, - BG20, 32, - BMO0, 64, - BIF0, 64, - BSN0, 32, - BTY0, 64, - Offset (0x67), - Offset (0x68), - ECOS, 8, - LNXD, 8, - ECPS, 8, - Offset (0x6C), - BTMP, 16, - EVTN, 8, - Offset (0x72), - PRCL, 8, - PRC0, 8, - PRC1, 8, - PRCM, 8, - PRIN, 8, - PSTE, 8, - PCAD, 8, - PEWL, 8, - PWRL, 8, - PECD, 8, - PEHI, 8, - PECI, 8, - PEPL, 8, - PEPM, 8, - PWFC, 8, - PECC, 8, - PDT0, 8, - PDT1, 8, - PDT2, 8, - PDT3, 8, - PRFC, 8, - PRS0, 8, - PRS1, 8, - PRS2, 8, - PRS3, 8, - PRS4, 8, - PRCS, 8, - PEC0, 8, - PEC1, 8, - PEC2, 8, - PEC3, 8, - CMDR, 8, - CVRT, 8, - GTVR, 8, - FANT, 8, - SKNT, 8, - AMBT, 8, - MCRT, 8, - DIM0, 8, - DIM1, 8, - PMAX, 8, - PPDT, 8, - PECH, 8, - PMDT, 8, - TSD0, 8, - TSD1, 8, - TSD2, 8, - TSD3, 8, - CPUP, 16, - MCHP, 16, - SYSP, 16, - CPAP, 16, - MCAP, 16, - SYAP, 16, - CFSP, 16, - CPUE, 16, - Offset (0xC6), - Offset (0xC7), - VGAT, 8, - OEM1, 8, - OEM2, 8, - OEM3, 16, - OEM4, 8, - Offset (0xCE), - DUT1, 8, - DUT2, 8, - RPM1, 16, - RPM2, 16, - RPM4, 16, - Offset (0xD7), - DTHL, 8, - DTBP, 8, - AIRP, 8, - WINF, 8, - RINF, 8, - Offset (0xDD), - INF2, 8, - MUTE, 1, - Offset (0xE0), - RPM3, 16, - ECKS, 8, - Offset (0xE4), - , 4, - XTUF, 1, - EP12, 1, - Offset (0xE5), - INF3, 8, - Offset (0xE7), - GFOF, 8, - Offset (0xE9), - KPCR, 1, - Offset (0xEA), - Offset (0xF0), - PL1T, 16, - PL2T, 16, - TAUT, 8, - Offset (0xF8), - FCMD, 8, - FDAT, 8, - FBUF, 8, - FBF1, 8, - FBF2, 8, - FBF3, 8 -} diff --git a/src/mainboard/system76/cml-u/acpi/hid.asl b/src/mainboard/system76/cml-u/acpi/hid.asl deleted file mode 100644 index ce8fd3f28b..0000000000 --- a/src/mainboard/system76/cml-u/acpi/hid.asl +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (HIDD) -{ - Name (_HID, "INT33D5") - Name (HBSY, Zero) - Name (HIDX, Zero) - Name (HRDY, Zero) - - Method (HDEM, 0, Serialized) - { - HBSY = Zero - Return (HIDX) - } - - Method (HDMM, 0, Serialized) - { - Return (Zero) - } - - Method (HDSM, 1, Serialized) - { - HRDY = Arg0 - } - - Method (HPEM, 1, Serialized) - { - HBSY = One - HIDX = Arg0 - - Notify (HIDD, 0xC0) - Local0 = Zero - While (((Local0 < 0xFA) && HBSY)) - { - Sleep (0x04) - Local0++ - } - - If ((HBSY == One)) - { - HBSY = Zero - HIDX = Zero - Return (One) - } - Else - { - Return (Zero) - } - } -} diff --git a/src/mainboard/system76/cml-u/acpi/lid.asl b/src/mainboard/system76/cml-u/acpi/lid.asl deleted file mode 100644 index ea382eb045..0000000000 --- a/src/mainboard/system76/cml-u/acpi/lid.asl +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (LID0) -{ - Name (_HID, EisaId ("PNP0C0D")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) - - Method (_LID, 0, NotSerialized) { - DEBUG = "LID: _LID" - If (^^PCI0.LPCB.EC0.ECOK) { - Return (^^PCI0.LPCB.EC0.LSTE) - } Else { - Return (One) - } - } - - Method (_PSW, 1, NotSerialized) { - DEBUG = Concatenate("LID: _PSW: ", ToHexString(Arg0)) - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.LWKE = Arg0 - } - } -} diff --git a/src/mainboard/system76/cml-u/acpi/mainboard.asl b/src/mainboard/system76/cml-u/acpi/mainboard.asl index 6f3d01cd8a..f4d316984a 100644 --- a/src/mainboard/system76/cml-u/acpi/mainboard.asl +++ b/src/mainboard/system76/cml-u/acpi/mainboard.asl @@ -1,25 +1,26 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#define EC_GPE_SCI 0x50 /* GPP_E16 */ +#define EC_GPE_SWI 0x29 /* GPP_D9 */ + #if defined(CONFIG_BOARD_SYSTEM76_DARP6) - #define COLOR_KEYBOARD 1 + #define EC_COLOR_KEYBOARD 1 #elif defined(CONFIG_BOARD_SYSTEM76_GALP4) - #define COLOR_KEYBOARD 0 + #define EC_COLOR_KEYBOARD 0 #else #error Unknown Mainboard #endif +#include Scope (\_SB) { - #include "ac.asl" - #include "battery.asl" - #include "buttons.asl" - #include "hid.asl" - #include "lid.asl" - #include "s76.asl" #include "sleep.asl" + Scope (PCI0) { + #include "backlight.asl" + } +} + +Scope (\_GPE) { + #include "gpe.asl" } #include "tbt.asl" - -Scope (_GPE) { - #include "gpe.asl" -} diff --git a/src/mainboard/system76/cml-u/acpi/s76.asl b/src/mainboard/system76/cml-u/acpi/s76.asl deleted file mode 100644 index 70417f9590..0000000000 --- a/src/mainboard/system76/cml-u/acpi/s76.asl +++ /dev/null @@ -1,114 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -// Notifications: -// 0x80 - hardware backlight toggle -// 0x81 - backlight toggle -// 0x82 - backlight down -// 0x83 - backlight up -// 0x84 - backlight color change -Device (S76D) { - Name (_HID, "17761776") - Name (_UID, 0) - - Method (RSET, 0, Serialized) { - Debug = "S76D: RSET" - SAPL(0) - SKBL(0) - #if COLOR_KEYBOARD - SKBC(0xFFFFFF) - #endif - } - - Method (INIT, 0, Serialized) { - Debug = "S76D: INIT" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use software control - ^^PCI0.LPCB.EC0.ECOS = 2 - Return (0) - } Else { - Return (1) - } - } - - Method (FINI, 0, Serialized) { - Debug = "S76D: FINI" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use hardware control - ^^PCI0.LPCB.EC0.ECOS = 1 - Return (0) - } Else { - Return (1) - } - } - - // Get Airplane LED - Method (GAPL, 0, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (^^PCI0.LPCB.EC0.AIRP & 0x40) { - Return (1) - } - } - Return (0) - } - - // Set Airplane LED - Method (SAPL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (Arg0) { - ^^PCI0.LPCB.EC0.AIRP |= 0x40 - } Else { - ^^PCI0.LPCB.EC0.AIRP &= 0xBF - } - } - } - -#if COLOR_KEYBOARD - // Set KB LED Brightness - Method (SKBL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 6 - ^^PCI0.LPCB.EC0.FBUF = Arg0 - ^^PCI0.LPCB.EC0.FBF1 = 0 - ^^PCI0.LPCB.EC0.FBF2 = Arg0 - ^^PCI0.LPCB.EC0.FCMD = 0xCA - } - } - - // Set Keyboard Color - Method (SKBC, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 0x3 - ^^PCI0.LPCB.EC0.FBUF = (Arg0 & 0xFF) - ^^PCI0.LPCB.EC0.FBF1 = ((Arg0 >> 16) & 0xFF) - ^^PCI0.LPCB.EC0.FBF2 = ((Arg0 >> 8) & 0xFF) - ^^PCI0.LPCB.EC0.FCMD = 0xCA - Return (Arg0) - } Else { - Return (0) - } - } -#else - // Get KB LED - Method (GKBL, 0, Serialized) { - Local0 = 0 - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = One - ^^PCI0.LPCB.EC0.FCMD = 0xCA - Local0 = ^^PCI0.LPCB.EC0.FBUF - ^^PCI0.LPCB.EC0.FCMD = Zero - } - Return (Local0) - } - - // Set KB Led - Method (SKBL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = Zero - ^^PCI0.LPCB.EC0.FBUF = Arg0 - ^^PCI0.LPCB.EC0.FCMD = 0xCA - } - } -#endif -} diff --git a/src/mainboard/system76/cml-u/dsdt.asl b/src/mainboard/system76/cml-u/dsdt.asl index 31cba2df39..eac27b56f1 100644 --- a/src/mainboard/system76/cml-u/dsdt.asl +++ b/src/mainboard/system76/cml-u/dsdt.asl @@ -18,7 +18,6 @@ DefinitionBlock( { #include #include - #include "acpi/backlight.asl" } #include @@ -26,7 +25,6 @@ DefinitionBlock( Scope (\_SB.PCI0.LPCB) { #include - #include "acpi/ec.asl" } #include "acpi/mainboard.asl" diff --git a/src/mainboard/system76/cfl-h/Kconfig b/src/mainboard/system76/gaze14/Kconfig similarity index 81% rename from src/mainboard/system76/cfl-h/Kconfig rename to src/mainboard/system76/gaze14/Kconfig index 058deb7c88..cf69c796cf 100644 --- a/src/mainboard/system76/cfl-h/Kconfig +++ b/src/mainboard/system76/gaze14/Kconfig @@ -2,32 +2,28 @@ if BOARD_SYSTEM76_GAZE14_1650_15 || BOARD_SYSTEM76_GAZE14_1650_17 || BOARD_SYSTE config BOARD_SPECIFIC_OPTIONS def_bool y - select ADD_FSP_BINARIES select BOARD_ROMSIZE_KB_16384 - select EC_ACPI - select EXCLUDE_EMMC_INTERFACE - select FSP_USE_REPO + select DRIVERS_I2C_HID + select EC_SYSTEM76_EC select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_SMI_HANDLER select INTEL_GMA_HAVE_VBT select INTEL_LPSS_UART_FOR_CONSOLE -# select MAINBOARD_HAS_SPI_TPM_CR50 -# select MAINBOARD_HAS_TPM2 + select MAINBOARD_HAS_LPC_TPM + select MAINBOARD_HAS_TPM2 select NO_UART_ON_SUPERIO select SOC_INTEL_CANNONLAKE_PCH_H select SOC_INTEL_COFFEELAKE - select SOC_INTEL_COMMON_ACPI_EC_PTS_WAK select SOC_INTEL_COMMON_BLOCK_HDA select SOC_INTEL_COMMON_BLOCK_HDA_VERB select SPD_READ_BY_WORD select SYSTEM_TYPE_LAPTOP - select USE_BLOBS select USE_LEGACY_8254_TIMER # Fix failure to boot GRUB config MAINBOARD_DIR string - default system76/cfl-h + default system76/gaze14 config VARIANT_DIR string @@ -36,7 +32,11 @@ config VARIANT_DIR default "gaze14_1660ti_15" if BOARD_SYSTEM76_GAZE14_1660TI_15 default "gaze14_1660ti_17" if BOARD_SYSTEM76_GAZE14_1660TI_17 -config MAINBOARD_PART_NUMBER +config MAINBOARD_SMBIOS_PRODUCT_NAME + string + default "Gazelle" + +config MAINBOARD_VERSION string default "gaze14" @@ -87,10 +87,6 @@ config DIMM_SPD_SIZE # string # default "8086,3ea0" -config PXE_ROM_ID - string - default "10ec,8168" - config FSP_M_XIP bool default y @@ -99,12 +95,4 @@ config POST_DEVICE bool default n -#config DRIVER_TPM_SPI_BUS -# hex -# default 0x0 - -#config DRIVER_TPM_SPI_CHIP -# int -# default 2 - endif diff --git a/src/mainboard/system76/cfl-h/Kconfig.name b/src/mainboard/system76/gaze14/Kconfig.name similarity index 100% rename from src/mainboard/system76/cfl-h/Kconfig.name rename to src/mainboard/system76/gaze14/Kconfig.name diff --git a/src/mainboard/system76/cfl-h/Makefile.inc b/src/mainboard/system76/gaze14/Makefile.inc similarity index 60% rename from src/mainboard/system76/cfl-h/Makefile.inc rename to src/mainboard/system76/gaze14/Makefile.inc index ea0ab15cb5..ec456228bf 100644 --- a/src/mainboard/system76/cfl-h/Makefile.inc +++ b/src/mainboard/system76/gaze14/Makefile.inc @@ -1,3 +1,4 @@ bootblock-y += bootblock.c -ramstage-y += ramstage.c variants/$(VARIANT_DIR)/hda_verb.c +ramstage-y += ramstage.c +ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include diff --git a/src/mainboard/system76/gaze14/acpi/backlight.asl b/src/mainboard/system76/gaze14/acpi/backlight.asl new file mode 100644 index 0000000000..952c9c7772 --- /dev/null +++ b/src/mainboard/system76/gaze14/acpi/backlight.asl @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include + +Scope (GFX0) +{ + Name (BRIG, Package (22) + { + 40, /* default AC */ + 40, /* default Battery */ + 5, + 10, + 15, + 20, + 25, + 30, + 35, + 40, + 45, + 50, + 55, + 60, + 65, + 70, + 75, + 80, + 85, + 90, + 95, + 100 + }) +} diff --git a/src/mainboard/system76/gaze14/acpi/dgpu.asl b/src/mainboard/system76/gaze14/acpi/dgpu.asl new file mode 100644 index 0000000000..bbf2c28e4d --- /dev/null +++ b/src/mainboard/system76/gaze14/acpi/dgpu.asl @@ -0,0 +1,203 @@ +// From https://review.coreboot.org/c/coreboot/+/28380 +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2017-2018 Patrick Rudolph + * + * 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. + * + * Nvidia Optimus support methods. + * + * Methods defined here are known to work on Lenovo's Sandy Bridge + * and Ivy Bridge series, which have GPIO21 pulled low on installed dGPU and + * GPIO17 to detect dGPU "PowerGood". They use the same PMH7 functions to + * enable dGPU power and handle dGPU reset. + */ + +#define DGPU_RST_N GPP_F22 +#define DGPU_PWR_EN GPP_F23 +#define DGPU_GC6 GPP_K21 + +Device (\_SB.PCI0.PEGP.DEV0) +{ + Name(_ADR, 0x00000000) + Name (_STA, 0xF) + Name (LTRE, 0) + + // Memory mapped PCI express registers + // Not sure what this stuff is, but it is used to get into GC6 + OperationRegion (RPCX, SystemMemory, 0xE0008000, 0x1000) + Field (RPCX, ByteAcc, NoLock, Preserve) + { + PVID, 16, + PDID, 16, + CMDR, 8, + Offset (0x19), + PRBN, 8, + Offset (0x84), + D0ST, 2, + Offset (0xAA), + CEDR, 1, + Offset (0xAC), + , 4, + CMLW, 6, + Offset (0xB0), + ASPM, 2, + , 2, + P0LD, 1, + RTLK, 1, + Offset (0xC9), + , 2, + LREN, 1, + Offset (0x11A), + , 1, + VCNP, 1, + Offset (0x214), + Offset (0x216), + P0LS, 4, + Offset (0x248), + , 7, + Q0L2, 1, + Q0L0, 1, + Offset (0x504), + Offset (0x506), + PCFG, 2, + Offset (0x508), + TREN, 1, + Offset (0xC20), + , 4, + P0AP, 2, + Offset (0xC38), + , 3, + P0RM, 1, + Offset (0xC74), + P0LT, 4, + Offset (0xD0C), + , 20, + LREV, 1 + } + + Method (_ON) + { + Debug = "PEGP.DEV0._ON" + + If (_STA != 0xF) { + Debug = " If DGPU_PWR_EN low" + If (! GTXS (DGPU_PWR_EN)) { + Debug = " DGPU_PWR_EN high" + STXS (DGPU_PWR_EN) + + Debug = " Sleep 16" + Sleep (16) + } + + Debug = " DGPU_RST_N high" + STXS(DGPU_RST_N) + + Debug = " Sleep 10" + Sleep (10) + + Debug = " Q0L0 = 1" + Q0L0 = 1 + + Debug = " Sleep 16" + Sleep (16) + + Debug = " While Q0L0" + Local0 = 0 + While (Q0L0) { + If ((Local0 > 4)) { + Debug = " While Q0L0 timeout" + Break + } + + Sleep (16) + Local0++ + } + + Debug = " P0RM = 0" + P0RM = 0 + + Debug = " P0AP = 0" + P0AP = 0 + + Debug = Concatenate(" LREN = ", ToHexString(LTRE)) + LREN = LTRE + + Debug = " CEDR = 1" + CEDR = 1 + + Debug = " CMDR |= 7" + CMDR |= 7 + + Debug = " _STA = 0xF" + _STA = 0xF + } + } + + Method (_OFF) + { + Debug = "PEGP.DEV0._OFF" + + If (_STA != 0x5) { + Debug = Concatenate(" LTRE = ", ToHexString(LREN)) + LTRE = LREN + + Debug = " Q0L2 = 1" + Q0L2 = 1 + + Debug = " Sleep 16" + Sleep (16) + + Debug = " While Q0L2" + Local0 = Zero + While (Q0L2) { + If ((Local0 > 4)) { + Debug = " While Q0L2 timeout" + Break + } + + Sleep (16) + Local0++ + } + + Debug = " P0RM = 1" + P0RM = 1 + + Debug = " P0AP = 3" + P0AP = 3 + + Debug = " Sleep 10" + Sleep (10) + + Debug = " DGPU_RST_N low" + CTXS(DGPU_RST_N) + + Debug = " While DGPU_GC6 low" + Local0 = Zero + While (! GRXS(DGPU_GC6)) { + If ((Local0 > 4)) { + Debug = " While DGPU_GC6 low timeout" + + Debug = " DGPU_PWR_EN low" + CTXS (DGPU_PWR_EN) + Break + } + + Sleep (16) + Local0++ + } + + Debug = " _STA = 0x5" + _STA = 0x5 + } + } +} diff --git a/src/mainboard/system76/gaze14/acpi/gpe.asl b/src/mainboard/system76/gaze14/acpi/gpe.asl new file mode 100644 index 0000000000..bc19e05169 --- /dev/null +++ b/src/mainboard/system76/gaze14/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 == One) { + Notify(\_SB.LID0, 0x80) + } + } +} diff --git a/src/mainboard/system76/gaze14/acpi/mainboard.asl b/src/mainboard/system76/gaze14/acpi/mainboard.asl new file mode 100644 index 0000000000..2fef852ae5 --- /dev/null +++ b/src/mainboard/system76/gaze14/acpi/mainboard.asl @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#define EC_GPE_SCI 0x03 /* GPP_K3 */ +#define EC_GPE_SWI 0x06 /* GPP_K6 */ +#define EC_COLOR_KEYBOARD 1 +#include + +Scope (\_SB) { + #include "sleep.asl" + Scope (PCI0) { + #include "backlight.asl" + #include "pegp.asl" + #include "dgpu.asl" + } +} + +Scope (\_GPE) { + #include "gpe.asl" +} diff --git a/src/mainboard/system76/gaze14/acpi/pegp.asl b/src/mainboard/system76/gaze14/acpi/pegp.asl new file mode 100644 index 0000000000..44dd605200 --- /dev/null +++ b/src/mainboard/system76/gaze14/acpi/pegp.asl @@ -0,0 +1,34 @@ +// From https://review.coreboot.org/c/coreboot/+/40625 +/* SPDX-License-Identifier: GPL-2.0-only */ + +Device (PEGP) +{ + Name (_ADR, 0x00010000) + + PowerResource (PWRR, 0, 0) + { + Name (_STA, 1) + + Method (_ON) + { + Debug = "PEGP.PWRR._ON" + If (_STA != 1) { + \_SB.PCI0.PEGP.DEV0._ON () + _STA = 1 + } + } + + Method (_OFF) + { + Debug = "PEGP.PWRR._OFF" + If (_STA != 0) { + \_SB.PCI0.PEGP.DEV0._OFF () + _STA = 0 + } + } + } + + Name (_PR0, Package () { \_SB.PCI0.PEGP.PWRR }) + Name (_PR2, Package () { \_SB.PCI0.PEGP.PWRR }) + Name (_PR3, Package () { \_SB.PCI0.PEGP.PWRR }) +} diff --git a/src/mainboard/system76/gaze14/acpi/sleep.asl b/src/mainboard/system76/gaze14/acpi/sleep.asl new file mode 100644 index 0000000000..cd8ffefa38 --- /dev/null +++ b/src/mainboard/system76/gaze14/acpi/sleep.asl @@ -0,0 +1,14 @@ +/* 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) + + // Turn DGPU on before sleeping + \_SB.PCI0.PEGP.DEV0._ON() +} + +/* Method called from _WAK prior to wakeup */ +Method (MWAK, 1) { + \_SB.PCI0.LPCB.EC0.WAK (Arg0) +} diff --git a/src/mainboard/system76/cfl-h/board_info.txt b/src/mainboard/system76/gaze14/board_info.txt similarity index 87% rename from src/mainboard/system76/cfl-h/board_info.txt rename to src/mainboard/system76/gaze14/board_info.txt index 10d8489157..0710a0be67 100644 --- a/src/mainboard/system76/cfl-h/board_info.txt +++ b/src/mainboard/system76/gaze14/board_info.txt @@ -1,5 +1,5 @@ Vendor name: System76 -Board name: cfl-h +Board name: gaze14 Category: laptop Release year: 2019 ROM package: SOIC-8 diff --git a/src/mainboard/system76/gaze14/bootblock.c b/src/mainboard/system76/gaze14/bootblock.c new file mode 100644 index 0000000000..847b147867 --- /dev/null +++ b/src/mainboard/system76/gaze14/bootblock.c @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include "gpio.h" + +static void dgpu_power_enable(int onoff) { + printk(BIOS_DEBUG, "system76: DGPU power %d\n", onoff); + if (onoff) { + gpio_set(DGPU_RST_N, 0); + mdelay(4); + gpio_set(DGPU_PWR_EN, 1); + mdelay(4); + gpio_set(DGPU_RST_N, 1); + } else { + gpio_set(DGPU_RST_N, 0); + mdelay(4); + gpio_set(DGPU_PWR_EN, 0); + } + mdelay(50); +} + +void bootblock_mainboard_init(void) +{ + gpio_configure_pads(early_gpio_table, ARRAY_SIZE(early_gpio_table)); + dgpu_power_enable(1); +} diff --git a/src/mainboard/system76/cfl-h/devicetree.cb b/src/mainboard/system76/gaze14/devicetree.cb similarity index 54% rename from src/mainboard/system76/cfl-h/devicetree.cb rename to src/mainboard/system76/gaze14/devicetree.cb index 3f169e086e..c50577707e 100644 --- a/src/mainboard/system76/cfl-h/devicetree.cb +++ b/src/mainboard/system76/gaze14/devicetree.cb @@ -2,6 +2,12 @@ chip soc/intel/cannonlake # Lock Down register "common_soc_config" = "{ .chipset_lockdown = CHIPSET_LOCKDOWN_COREBOOT, + // Touchpad I2C bus + .i2c[0] = { + .speed = I2C_SPEED_FAST, + .rise_time_ns = 80, + .fall_time_ns = 110, + }, }" # Send an extra VR mailbox command for the PS4 exit issue @@ -19,8 +25,12 @@ chip soc/intel/cannonlake # CPU (soc/intel/cannonlake/cpu.c) # Power limit - #TODO register "tdp_pl1_override" = "15" - #TODO register "tdp_pl2_override" = "25" + register "power_limits_config" = "{ + // /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw + .tdp_pl1_override = 45, + // /sys/class/powercap/intel-rapl:0/constraint_1_power_limit_uw + .tdp_pl2_override = 90, + }" # Enable "Intel Speed Shift Technology" register "speed_shift_enable" = "1" @@ -30,18 +40,34 @@ chip soc/intel/cannonlake # FSP Memory (soc/intel/cannonlake/romstage/fsp_params.c) register "SaGv" = "SaGv_Enabled" - #register "enable_c6dram" = "1" + register "enable_c6dram" = "1" # FSP Silicon (soc/intel/cannonlake/fsp_params.c) + # Serial I/O + register "SerialIoDevMode" = "{ + [PchSerialIoIndexI2C0] = PchSerialIoPci, // Touchpad I2C bus + [PchSerialIoIndexI2C1] = PchSerialIoPci, // USB-C + [PchSerialIoIndexI2C2] = PchSerialIoDisabled, + [PchSerialIoIndexI2C3] = PchSerialIoDisabled, + [PchSerialIoIndexI2C4] = PchSerialIoDisabled, + [PchSerialIoIndexI2C5] = PchSerialIoDisabled, + [PchSerialIoIndexSPI0] = PchSerialIoDisabled, + [PchSerialIoIndexSPI1] = PchSerialIoDisabled, + [PchSerialIoIndexSPI2] = PchSerialIoDisabled, + [PchSerialIoIndexUART0] = PchSerialIoDisabled, + [PchSerialIoIndexUART1] = PchSerialIoDisabled, + [PchSerialIoIndexUART2] = PchSerialIoPci, // Debug console + }" + # SATA register "SataMode" = "Sata_AHCI" register "SataSalpSupport" = "0" register "SataPortsEnable[0]" = "0" - register "SataPortsEnable[1]" = "1" + register "SataPortsEnable[1]" = "1" # SSD (SATA1A) register "SataPortsEnable[2]" = "0" register "SataPortsEnable[3]" = "0" - register "SataPortsEnable[4]" = "1" + register "SataPortsEnable[4]" = "1" # HDD (SATA4) register "SataPortsEnable[5]" = "0" register "SataPortsEnable[6]" = "0" register "SataPortsEnable[7]" = "0" @@ -72,92 +98,118 @@ chip soc/intel/cannonlake register "SsicPortEnable" = "0" # USB2 - register "usb2_ports[0]" = "USB2_PORT_MID(OC_SKIP)" # Charger, Port 1 - register "usb2_ports[1]" = "USB2_PORT_MID(OC_SKIP)" # Audio board - register "usb2_ports[2]" = "USB2_PORT_TYPE_C(OC_SKIP)" # Type-C - register "usb2_ports[3]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[4]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[5]" = "USB2_PORT_MID(OC_SKIP)" # Audio board - register "usb2_ports[6]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[7]" = "USB2_PORT_MID(OC_SKIP)" # CCD - register "usb2_ports[8]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[9]" = "USB2_PORT_MID(OC_SKIP)" # Fingerprint - register "usb2_ports[10]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[11]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[12]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[13]" = "USB2_PORT_MID(OC_SKIP)" # Bluetooth - register "usb2_ports[14]" = "USB2_PORT_EMPTY" # NC - register "usb2_ports[15]" = "USB2_PORT_EMPTY" # NC + register "usb2_ports[0]" = "USB2_PORT_MID(OC_SKIP)" # USB 3 Right + register "usb2_ports[1]" = "USB2_PORT_EMPTY" + register "usb2_ports[2]" = "USB2_PORT_TYPE_C(OC_SKIP)" # Type-C + register "usb2_ports[3]" = "USB2_PORT_EMPTY" + register "usb2_ports[4]" = "USB2_PORT_MID(OC_SKIP)" # USB 3 Left + register "usb2_ports[5]" = "USB2_PORT_MID(OC_SKIP)" # USB 2 Left + register "usb2_ports[6]" = "USB2_PORT_MID(OC_SKIP)" # 3G/LTE + register "usb2_ports[7]" = "USB2_PORT_MID(OC_SKIP)" # Camera + register "usb2_ports[8]" = "USB2_PORT_EMPTY" + register "usb2_ports[9]" = "USB2_PORT_EMPTY" + register "usb2_ports[10]" = "USB2_PORT_EMPTY" + register "usb2_ports[11]" = "USB2_PORT_EMPTY" + register "usb2_ports[12]" = "USB2_PORT_EMPTY" + register "usb2_ports[13]" = "USB2_PORT_MID(OC_SKIP)" # Bluetooth + register "usb2_ports[14]" = "USB2_PORT_EMPTY" + register "usb2_ports[15]" = "USB2_PORT_EMPTY" # USB3 - register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Charger, Port 1 - register "usb3_ports[1]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Audio board - register "usb3_ports[2]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Type-C - register "usb3_ports[3]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Type-C - register "usb3_ports[4]" = "USB3_PORT_EMPTY" # NC - register "usb3_ports[5]" = "USB3_PORT_EMPTY" # NC - register "usb3_ports[6]" = "USB3_PORT_EMPTY" # NC - register "usb3_ports[7]" = "USB3_PORT_EMPTY" # NC - register "usb3_ports[8]" = "USB3_PORT_EMPTY" # NC - register "usb3_ports[9]" = "USB3_PORT_EMPTY" # NC + register "usb3_ports[0]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB 3 Right + register "usb3_ports[1]" = "USB3_PORT_EMPTY" + register "usb3_ports[2]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Type-C + register "usb3_ports[3]" = "USB3_PORT_DEFAULT(OC_SKIP)" # Type-C + register "usb3_ports[4]" = "USB3_PORT_DEFAULT(OC_SKIP)" # USB 3 Left + register "usb3_ports[5]" = "USB3_PORT_EMPTY" + register "usb3_ports[6]" = "USB3_PORT_DEFAULT(OC_SKIP)" # 3G/LTE + register "usb3_ports[7]" = "USB3_PORT_EMPTY" + register "usb3_ports[8]" = "USB3_PORT_EMPTY" + register "usb3_ports[9]" = "USB3_PORT_EMPTY" - # PCI Express Root port #9 x4, Clock 10 (SSD) + # PCI Express Graphics #0 x16, Clock 8 (NVIDIA GPU) + register "PcieClkSrcUsage[8]" = "0x40" + + # PCI Express root port #9 x4, Clock 10 (SSD) register "PcieRpEnable[8]" = "1" register "PcieRpLtrEnable[8]" = "1" register "PcieClkSrcUsage[10]" = "8" - register "PcieClkSrcClkReq[10]" = "10" - # PCI Express Root port #14 x1, Clock 6 (WLAN) + # PCI Express root port #14 x1, Clock 6 (WLAN) register "PcieRpEnable[13]" = "1" register "PcieRpLtrEnable[13]" = "1" register "PcieClkSrcUsage[6]" = "13" - register "PcieClkSrcClkReq[6]" = "6" - # PCI Express Root port #15 x1, Clock 5 (LAN) + # PCI Express root port #15 x1, Clock 5 (LAN) register "PcieRpEnable[14]" = "1" register "PcieRpLtrEnable[14]" = "1" register "PcieClkSrcUsage[5]" = "14" - register "PcieClkSrcClkReq[5]" = "5" - # PCI Express Root port #21 x4, Clock 11 (SSD2) + # PCI Express root port #21 x4, Clock 11 (SSD2) register "PcieRpEnable[20]" = "1" register "PcieRpLtrEnable[20]" = "1" register "PcieClkSrcUsage[11]" = "20" - register "PcieClkSrcClkReq[11]" = "11" - # PCI Express on CPU x8, Clock 8 (GPU) - register "PcieClkSrcUsage[8]" = "0x40" + # Set all clocks sources to the same clock request + register "PcieClkSrcClkReq[0]" = "0" + register "PcieClkSrcClkReq[1]" = "1" + register "PcieClkSrcClkReq[2]" = "2" + register "PcieClkSrcClkReq[3]" = "3" + register "PcieClkSrcClkReq[4]" = "4" + register "PcieClkSrcClkReq[5]" = "5" + register "PcieClkSrcClkReq[6]" = "6" + register "PcieClkSrcClkReq[7]" = "7" register "PcieClkSrcClkReq[8]" = "8" + register "PcieClkSrcClkReq[9]" = "9" + register "PcieClkSrcClkReq[10]" = "10" + register "PcieClkSrcClkReq[11]" = "11" + register "PcieClkSrcClkReq[12]" = "12" + register "PcieClkSrcClkReq[13]" = "13" + register "PcieClkSrcClkReq[14]" = "14" + register "PcieClkSrcClkReq[15]" = "15" # Misc - register "Device4Enable" = "0" - register "HeciEnabled" = "1" - #register "AcousticNoiseMitigation" = "1" + register "Device4Enable" = "1" + register "HeciEnabled" = "0" + register "Heci3Enabled" = "0" + register "AcousticNoiseMitigation" = "1" #register "dmipwroptimize" = "1" #register "satapwroptimize" = "1" # Power - register "PchPmSlpS3MinAssert" = "3" # 50ms - register "PchPmSlpS4MinAssert" = "1" # 1s - register "PchPmSlpSusMinAssert" = "2" # 500ms - register "PchPmSlpAMinAssert" = "4" # 2s + # sudo devmem2 0xfe001020 (pmc_bar + GEN_PMCON_A), bits 11:10 + # WARNING: must then be mapped from FSP value to PCH value + register "PchPmSlpS3MinAssert" = "3" # 50ms + # sudo devmem2 0xfe001020 (pmc_bar + GEN_PMCON_A), bits 5:4 + # WARNING: must then be mapped from FSP value to PCH value + register "PchPmSlpS4MinAssert" = "1" # 1s + # sudo devmem2 0xfe001818 (pmc_bar + PM_CFG), bits 19:18 + # WARNING: must then be mapped from FSP value to PCH value + register "PchPmSlpSusMinAssert" = "4" # 4s + # sudo devmem2 0xfe001818 (pmc_bar + PM_CFG), bits 17:16 + # WARNING: must then be mapped from FSP value to PCH value + register "PchPmSlpAMinAssert" = "4" # 2s # Thermal - register "tcc_offset" = "2" + # rdmsr --bitfield 31:24 --decimal 0x1A2 + register "tcc_offset" = "8" # Serial IRQ Continuous register "serirq_mode" = "SERIRQ_CONTINUOUS" +# Graphics (soc/intel/cannonlake/graphics.c) + register "gfx" = "GMA_STATIC_DISPLAYS(0)" + # LPC (soc/intel/cannonlake/lpc.c) # LPC configuration from lspci -s 1f.0 -xxx - # Address 0x84: Decode 0x1640 - 0x164F - register "gen1_dec" = "0x000c1641" - # Address 0x88: Decode 0x680 - 0x68F - register "gen2_dec" = "0x000c0681" - # Address 0x8C: Decode 0x80 - 0x8F - register "gen3_dec" = "0x000c0081" - # Address 0x90: Decode 0x68 - 0x6F - register "gen4_dec" = "0x00040069" + # Address 0x84: Decode 0x80 - 0x8F (Port 80) + register "gen1_dec" = "0x000c0081" + # Address 0x88: Decode 0x68 - 0x6F (PMC) + register "gen2_dec" = "0x00040069" + # Address 0x8C: Decode 0xE00 - 0xEFF (AP/EC command) + register "gen3_dec" = "0x00fc0E01" + # Address 0x90: Decode 0xF00 - 0xFFF (AP/EC debug) + register "gen4_dec" = "0x00fc0F01" # PMC (soc/intel/cannonlake/pmc.c) # Enable deep Sx states @@ -186,7 +238,7 @@ chip soc/intel/cannonlake device pci 00.0 on end # Host Bridge device pci 01.0 on end # GPU Port device pci 02.0 on end # Integrated Graphics Device - device pci 04.0 off end # SA Thermal device + device pci 04.0 on end # SA Thermal device device pci 12.0 on end # Thermal Subsystem device pci 12.5 off end # UFS SCS device pci 12.6 off end # GSPI #2 @@ -199,11 +251,20 @@ chip soc/intel/cannonlake device pci 14.3 on end # CNVi wifi #end device pci 14.5 off end # SDCard - device pci 15.0 on end # I2C #0 + device pci 15.0 on + chip drivers/i2c/hid + register "generic.hid" = ""PNP0C50"" + register "generic.desc" = ""Synaptics Touchpad"" + register "generic.irq" = "ACPI_IRQ_EDGE_LOW(GPP_E7_IRQ)" + register "generic.probed" = "1" + register "hid_desc_reg_offset" = "0x20" + device i2c 2c on end + end + end # I2C #0 device pci 15.1 on end # I2C #1 device pci 15.2 off end # I2C #2 device pci 15.3 off end # I2C #3 - device pci 16.0 on end # Management Engine Interface 1 + device pci 16.0 off end # Management Engine Interface 1 device pci 16.1 off end # Management Engine Interface 2 device pci 16.2 off end # Management Engine IDE-R device pci 16.3 off end # Management Engine KT Redirection @@ -226,7 +287,7 @@ chip soc/intel/cannonlake device pci 1c.1 off end # PCI Express Port 2 device pci 1c.2 off end # PCI Express Port 3 device pci 1c.3 off end # PCI Express Port 4 - device pci 1c.4 on end # PCI Express Port 5 + device pci 1c.4 off end # PCI Express Port 5 device pci 1c.5 off end # PCI Express Port 6 device pci 1c.6 off end # PCI Express Port 7 device pci 1c.7 off end # PCI Express Port 8 @@ -242,7 +303,11 @@ chip soc/intel/cannonlake device pci 1e.1 off end # UART #1 device pci 1e.2 off end # GSPI #0 device pci 1e.3 off end # GSPI #1 - device pci 1f.0 on end # LPC Interface + device pci 1f.0 on # LPC Interface + chip drivers/pc80/tpm + device pnp 0c31.0 on end + end + end device pci 1f.1 off end # P2SB device pci 1f.2 off end # Power Management Controller device pci 1f.3 on end # Intel HDA diff --git a/src/mainboard/system76/gaze14/dsdt.asl b/src/mainboard/system76/gaze14/dsdt.asl new file mode 100644 index 0000000000..eac27b56f1 --- /dev/null +++ b/src/mainboard/system76/gaze14/dsdt.asl @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +DefinitionBlock( + "dsdt.aml", + "DSDT", + 0x02, // DSDT revision: ACPI v2.0 and up + OEM_ID, + ACPI_TABLE_CREATOR, + 0x20110725 // OEM revision +) +{ + #include + #include + #include + + Device (\_SB.PCI0) + { + #include + #include + } + + #include + + Scope (\_SB.PCI0.LPCB) + { + #include + } + + #include "acpi/mainboard.asl" +} diff --git a/src/mainboard/system76/gaze14/gpio.h b/src/mainboard/system76/gaze14/gpio.h new file mode 100644 index 0000000000..f8584db759 --- /dev/null +++ b/src/mainboard/system76/gaze14/gpio.h @@ -0,0 +1 @@ +#include diff --git a/src/mainboard/system76/gaze14/ramstage.c b/src/mainboard/system76/gaze14/ramstage.c new file mode 100644 index 0000000000..01dffb8c1b --- /dev/null +++ b/src/mainboard/system76/gaze14/ramstage.c @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include "gpio.h" + +void mainboard_silicon_init_params(FSP_S_CONFIG *params) +{ + /* Configure pads prior to SiliconInit() in case there's any + * dependencies during hardware initialization. */ + cnl_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); +} + +static void dgpu_read_resources(struct device *dev) { + printk(BIOS_INFO, "system76: dgpu_read_resources %s\n", dev_path(dev)); + + pci_dev_read_resources(dev); + + int bar; + // Find all BARs on DGPU, mark them above 4g if prefetchable + for (bar = PCI_BASE_ADDRESS_0; bar <= PCI_BASE_ADDRESS_5; bar += 4) { + printk(BIOS_INFO, " BAR at 0x%02x\n", bar); + + struct resource *res; + res = probe_resource(dev, bar); + if (res) { + if (res->flags & IORESOURCE_PREFETCH) { + printk(BIOS_INFO, " marked above 4g\n"); + res->flags |= IORESOURCE_ABOVE_4G; + } else { + printk(BIOS_INFO, " not prefetch\n"); + } + } else { + printk(BIOS_INFO, " not found\n"); + } + } +} + +static void dgpu_enable_resources(struct device *dev) { + printk(BIOS_INFO, "system76: dgpu_enable_resources %s\n", dev_path(dev)); + + dev->subsystem_vendor = CONFIG_SUBSYSTEM_VENDOR_ID; + dev->subsystem_device = CONFIG_SUBSYSTEM_DEVICE_ID; + printk(BIOS_INFO, " subsystem <- %04x/%04x\n", dev->subsystem_vendor, dev->subsystem_device); + pci_write_config32(dev, 0x40, ((dev->subsystem_device & 0xffff) << 16) | (dev->subsystem_vendor & 0xffff)); + + pci_dev_enable_resources(dev); +} + +static struct device_operations dgpu_pci_ops_dev = { + .read_resources = dgpu_read_resources, + .set_resources = pci_dev_set_resources, + .enable_resources = dgpu_enable_resources, +#if CONFIG(HAVE_ACPI_TABLES) + .write_acpi_tables = pci_rom_write_acpi_tables, + .acpi_fill_ssdt = pci_rom_ssdt, +#endif + .init = pci_dev_init, + .ops_pci = &pci_dev_ops_pci, +}; + +static void dgpu_above_4g(void *unused) { + struct device *pdev; + + // Find PEG0 + pdev = pcidev_on_root(1, 0); + if (!pdev) { + printk(BIOS_ERR, "system76: failed to find PEG0\n"); + return; + } + printk(BIOS_INFO, "system76: PEG0 at %p, %04x:%04x\n", pdev, pdev->vendor, pdev->device); + + int fn; + for (fn = 0; fn < 8; fn++) { + struct device *dev; + + // Find DGPU functions + dev = pcidev_path_behind(pdev->link_list, PCI_DEVFN(0, fn)); + if (dev) { + printk(BIOS_INFO, "system76: DGPU fn %d at %p, %04x:%04x\n", fn, dev, dev->vendor, dev->device); + dev->ops = &dgpu_pci_ops_dev; + } else { + printk(BIOS_ERR, "system76: failed to find DGPU fn %d\n", fn); + } + } +} + +BOOT_STATE_INIT_ENTRY(BS_DEV_RESOURCES, BS_ON_ENTRY, dgpu_above_4g, NULL); diff --git a/src/mainboard/system76/cfl-h/romstage.c b/src/mainboard/system76/gaze14/romstage.c similarity index 73% rename from src/mainboard/system76/cfl-h/romstage.c rename to src/mainboard/system76/gaze14/romstage.c index e863d29d18..a800bcf8f4 100644 --- a/src/mainboard/system76/cfl-h/romstage.c +++ b/src/mainboard/system76/gaze14/romstage.c @@ -1,22 +1,8 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2019 System76 - * - * 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. - */ +/* SPDX-License-Identifier: GPL-2.0-only */ #include #include -//TODO: find correct values static const struct cnl_mb_cfg memcfg = { /* Parameters required to access SPD for CH0D0/CH0D1/CH1D0/CH1D1. */ .spd[0] = { @@ -43,11 +29,11 @@ static const struct cnl_mb_cfg memcfg = { */ .dq_map[DDR_CH0] = { {0x0F, 0xF0}, {0x00, 0xF0}, {0x0F, 0xF0}, - //{0x0F, 0x00}, {0xFF, 0x00}, {0xFF, 0x00} + //{0x0F, 0x00}, {0xFF, 0x00}, {0xFF, 0x00} }, .dq_map[DDR_CH1] = { {0x33, 0xCC}, {0x00, 0xCC}, {0x33, 0xCC}, - //{0x33, 0x00}, {0xFF, 0x00}, {0xFF, 0x00} + //{0x33, 0x00}, {0xFF, 0x00}, {0xFF, 0x00} }, /* @@ -71,7 +57,7 @@ static const struct cnl_mb_cfg memcfg = { * Rcomp target values. These will typically be the following * values for Cannon Lake : { 80, 40, 40, 40, 30 } */ - .rcomp_targets = { 60, 26, 20, 20, 26 }, + .rcomp_targets = { 50, 25, 20, 20, 26 }, /* * Indicates whether memory is interleaved. @@ -81,17 +67,20 @@ static const struct cnl_mb_cfg memcfg = { .dq_pins_interleaved = 1, /* - * VREF_CA configuraation. + * VREF_CA configuration. * Set to 0 VREF_CA goes to both CH_A and CH_B, * set to 1 VREF_CA goes to CH_A and VREF_DQ_A goes to CH_B, * set to 2 VREF_CA goes to CH_A and VREF_DQ_B goes to CH_B. */ .vref_ca_config = 2, - /* Early Command Training Enabled */ + /* Early Command Training */ .ect = 0, }; -void mainboard_memory_init_params(FSPM_UPD *memupd) { +void mainboard_memory_init_params(FSPM_UPD *memupd) +{ + // Set primary display to internal graphics + memupd->FspmConfig.PrimaryDisplay = 0; cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); } diff --git a/src/mainboard/system76/cfl-h/variants/gaze14_1650_15/hda_verb.c b/src/mainboard/system76/gaze14/variants/gaze14_1650_15/hda_verb.c similarity index 100% rename from src/mainboard/system76/cfl-h/variants/gaze14_1650_15/hda_verb.c rename to src/mainboard/system76/gaze14/variants/gaze14_1650_15/hda_verb.c diff --git a/src/mainboard/system76/cfl-h/variants/gaze14_1650_15/include/variant/gpio.h b/src/mainboard/system76/gaze14/variants/gaze14_1650_15/include/variant/gpio.h similarity index 100% rename from src/mainboard/system76/cfl-h/variants/gaze14_1650_15/include/variant/gpio.h rename to src/mainboard/system76/gaze14/variants/gaze14_1650_15/include/variant/gpio.h diff --git a/src/mainboard/system76/cfl-h/variants/gaze14_1650_17/hda_verb.c b/src/mainboard/system76/gaze14/variants/gaze14_1650_17/hda_verb.c similarity index 100% rename from src/mainboard/system76/cfl-h/variants/gaze14_1650_17/hda_verb.c rename to src/mainboard/system76/gaze14/variants/gaze14_1650_17/hda_verb.c diff --git a/src/mainboard/system76/cfl-h/variants/gaze14_1650_17/include/variant/gpio.h b/src/mainboard/system76/gaze14/variants/gaze14_1650_17/include/variant/gpio.h similarity index 100% rename from src/mainboard/system76/cfl-h/variants/gaze14_1650_17/include/variant/gpio.h rename to src/mainboard/system76/gaze14/variants/gaze14_1650_17/include/variant/gpio.h diff --git a/src/mainboard/system76/cfl-h/variants/gaze14_1660ti_15/hda_verb.c b/src/mainboard/system76/gaze14/variants/gaze14_1660ti_15/hda_verb.c similarity index 100% rename from src/mainboard/system76/cfl-h/variants/gaze14_1660ti_15/hda_verb.c rename to src/mainboard/system76/gaze14/variants/gaze14_1660ti_15/hda_verb.c diff --git a/src/mainboard/system76/cfl-h/variants/gaze14_1660ti_17/hda_verb.c b/src/mainboard/system76/gaze14/variants/gaze14_1660ti_17/hda_verb.c similarity index 100% rename from src/mainboard/system76/cfl-h/variants/gaze14_1660ti_17/hda_verb.c rename to src/mainboard/system76/gaze14/variants/gaze14_1660ti_17/hda_verb.c diff --git a/src/mainboard/system76/gaze15/Kconfig b/src/mainboard/system76/gaze15/Kconfig index 76c83993a2..ab272fad5f 100644 --- a/src/mainboard/system76/gaze15/Kconfig +++ b/src/mainboard/system76/gaze15/Kconfig @@ -4,8 +4,7 @@ config BOARD_SPECIFIC_OPTIONS def_bool y select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_HID - select DRIVERS_SYSTEM76_EC - select EC_ACPI + select EC_SYSTEM76_EC select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_SMI_HANDLER diff --git a/src/mainboard/system76/gaze15/acpi/ac.asl b/src/mainboard/system76/gaze15/acpi/ac.asl deleted file mode 100644 index 7326676198..0000000000 --- a/src/mainboard/system76/gaze15/acpi/ac.asl +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (AC) -{ - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - - Name (ACFG, One) - - Method (_PSR, 0, NotSerialized) // _PSR: Power Source - { - Return (ACFG) - } - - Method (_STA, 0, NotSerialized) // _STA: Status - { - Return (0x0F) - } -} diff --git a/src/mainboard/system76/gaze15/acpi/battery.asl b/src/mainboard/system76/gaze15/acpi/battery.asl deleted file mode 100644 index bc239dd9c0..0000000000 --- a/src/mainboard/system76/gaze15/acpi/battery.asl +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (BAT0) -{ - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, Zero) // _UID: Unique ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - Name (BFCC, Zero) - Method (_STA, 0, NotSerialized) // _STA: Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Return (0x1F) - } - Else - { - Return (0x0F) - } - } - Else - { - Return (0x0F) - } - } - - Name (PBIF, Package (0x0D) - { - One, - 0xFFFFFFFF, - 0xFFFFFFFF, - One, - 0x39D0, - Zero, - Zero, - 0x40, - 0x40, - "BAT", - "0001", - "LION", - "Notebook" - }) - Method (IVBI, 0, NotSerialized) - { - PBIF [One] = 0xFFFFFFFF - PBIF [0x02] = 0xFFFFFFFF - PBIF [0x04] = 0xFFFFFFFF - PBIF [0x09] = " " - PBIF [0x0A] = " " - PBIF [0x0B] = " " - PBIF [0x0C] = " " - BFCC = Zero - } - - Method (UPBI, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF) - PBIF [One] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF) - PBIF [0x02] = Local0 - BFCC = Local0 - Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF) - PBIF [0x04] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF) - PBIF [0x05] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF) - PBIF [0x06] = Local0 - PBIF [0x09] = "BAT" - PBIF [0x0A] = "0001" - PBIF [0x0B] = "LION" - PBIF [0x0C] = "Notebook" - } - Else - { - IVBI () - } - } - - Method (_BIF, 0, NotSerialized) // _BIF: Battery Information - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBI () - } - Else - { - IVBI () - } - - Return (PBIF) /* \_SB_.BAT0.PBIF */ - } - - Name (PBST, Package (0x04) - { - Zero, - 0xFFFFFFFF, - 0xFFFFFFFF, - 0x3D90 - }) - Method (IVBS, 0, NotSerialized) - { - PBST [Zero] = Zero - PBST [One] = 0xFFFFFFFF - PBST [0x02] = 0xFFFFFFFF - PBST [0x03] = 0x2710 - } - - Method (UPBS, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = Zero - Local1 = Zero - If (^^AC.ACFG) - { - If (((^^PCI0.LPCB.EC0.BST0 & 0x02) == 0x02)) - { - Local0 |= 0x02 - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - } - Else - { - Local0 |= One - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - - Local7 = (Local1 & 0x8000) - If ((Local7 == 0x8000)) - { - Local1 ^= 0xFFFF - } - - Local2 = (^^PCI0.LPCB.EC0.BRC0 & 0xFFFF) - Local3 = (^^PCI0.LPCB.EC0.BPV0 & 0xFFFF) - PBST [Zero] = Local0 - PBST [One] = Local1 - PBST [0x02] = Local2 - PBST [0x03] = Local3 - If ((BFCC != ^^PCI0.LPCB.EC0.BFC0)) - { - Notify (BAT0, 0x81) // Information Change - } - } - Else - { - IVBS () - } - } - - Method (_BST, 0, NotSerialized) // _BST: Battery Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBS () - } - Else - { - IVBS () - } - - Return (PBST) /* \_SB_.BAT0.PBST */ - } -} diff --git a/src/mainboard/system76/gaze15/acpi/ec.asl b/src/mainboard/system76/gaze15/acpi/ec.asl deleted file mode 100644 index 8c7a15ddcc..0000000000 --- a/src/mainboard/system76/gaze15/acpi/ec.asl +++ /dev/null @@ -1,217 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (EC0) -{ - Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */) // _HID: Hardware ID - Name (_GPE, 0x03 /* GPP_K3 */) // _GPE: General Purpose Events - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings - { - IO (Decode16, - 0x0062, // Range Minimum - 0x0062, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - IO (Decode16, - 0x0066, // Range Minimum - 0x0066, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - }) - - #include "acpi/ec_ram.asl" - - Name (ECOK, Zero) - Method (_REG, 2, Serialized) // _REG: Region Availability - { - Debug = Concatenate("EC: _REG", Concatenate(ToHexString(Arg0), Concatenate(" ", ToHexString(Arg1)))) - If (((Arg0 == 0x03) && (Arg1 == One))) { - // Enable hardware touchpad lock, airplane mode, and keyboard backlight keys - ECOS = 1 - - // Enable software display brightness keys - WINF = 1 - - // Set current AC state - ^^^^AC.ACFG = ADP - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - PNOT () - - // EC is now available - ECOK = Arg1 - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (PTS, 1, Serialized) { - Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) - If (ECOK) { - // Clear wake cause - WFNO = Zero - } - } - - Method (WAK, 1, Serialized) { - Debug = Concatenate("EC: WAK: ", ToHexString(Arg0)) - If (ECOK) { - // Set current AC state - ^^^^AC.ACFG = ADP - - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (_Q0A, 0, NotSerialized) // Touchpad Toggle - { - Debug = "EC: Touchpad Toggle" - } - - Method (_Q0B, 0, NotSerialized) // Screen Toggle - { - Debug = "EC: Screen Toggle" - } - - Method (_Q0C, 0, NotSerialized) // Mute - { - Debug = "EC: Mute" - } - - Method (_Q0D, 0, NotSerialized) // Keyboard Backlight - { - Debug = "EC: Keyboard Backlight" - } - - Method (_Q0E, 0, NotSerialized) // Volume Down - { - Debug = "EC: Volume Down" - } - - Method (_Q0F, 0, NotSerialized) // Volume Up - { - Debug = "EC: Volume Up" - } - - Method (_Q10, 0, NotSerialized) // Switch Video Mode - { - Debug = "EC: Switch Video Mode" - } - - Method (_Q11, 0, NotSerialized) // Brightness Down - { - Debug = "EC: Brightness Down" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (20) - } - } - - Method (_Q12, 0, NotSerialized) // Brightness Up - { - Debug = "EC: Brightness Up" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (19) - } - } - - Method (_Q13, 0, NotSerialized) // Camera Toggle - { - Debug = "EC: Camera Toggle" - } - - Method (_Q14, 0, NotSerialized) // Airplane Mode - { - Debug = "EC: Airplane Mode" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (8) - } - // TODO: hardware airplane mode - } - - Method (_Q15, 0, NotSerialized) // Suspend Button - { - Debug = "EC: Suspend Button" - Notify (SLPB, 0x80) - } - - Method (_Q16, 0, NotSerialized) // AC Detect - { - Debug = "EC: AC Detect" - ^^^^AC.ACFG = ADP - Notify (AC, 0x80) // Status Change - If (BAT0) - { - Notify (^^^^BAT0, 0x81) // Information Change - Notify (^^^^BAT0, 0x80) // Status Change - } - } - - Method (_Q17, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (17)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q19, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (19)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q1B, 0, NotSerialized) // Lid Close - { - Debug = "EC: Lid Close" - Notify (LID0, 0x80) - } - - Method (_Q1C, 0, NotSerialized) // Thermal Trip - { - Debug = "EC: Thermal Trip" - /* TODO - Notify (\_TZ.TZ0, 0x81) // Thermal Trip Point Change - Notify (\_TZ.TZ0, 0x80) // Thermal Status Change - */ - } - - Method (_Q1D, 0, NotSerialized) // Power Button - { - Debug = "EC: Power Button" - Notify (PWRB, 0x80) - } - - Method (_Q50, 0, NotSerialized) // Other Events - { - Local0 = OEM4 - If (Local0 == 0x8A) { - Debug = "EC: White Keyboard Backlight" - Notify (^^^^S76D, 0x80) - } ElseIf (Local0 == 0x9F) { - Debug = "EC: Color Keyboard Toggle" - Notify (^^^^S76D, 0x81) - } ElseIf (Local0 == 0x81) { - Debug = "EC: Color Keyboard Down" - Notify (^^^^S76D, 0x82) - } ElseIf (Local0 == 0x82) { - Debug = "EC: Color Keyboard Up" - Notify (^^^^S76D, 0x83) - } ElseIf (Local0 == 0x80) { - Debug = "EC: Color Keyboard Color Change" - Notify (^^^^S76D, 0x84) - } Else { - Debug = Concatenate("EC: Other: ", ToHexString(Local0)) - } - } -} diff --git a/src/mainboard/system76/gaze15/acpi/ec_ram.asl b/src/mainboard/system76/gaze15/acpi/ec_ram.asl deleted file mode 100644 index d5f97edbd7..0000000000 --- a/src/mainboard/system76/gaze15/acpi/ec_ram.asl +++ /dev/null @@ -1,175 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF) -Field (ERAM, ByteAcc, Lock, Preserve) -{ - NMSG, 8, - SLED, 4, - Offset (0x02), - MODE, 1, - FAN0, 1, - TME0, 1, - TME1, 1, - FAN1, 1, - , 2, - Offset (0x03), - LSTE, 1, - LSW0, 1, - LWKE, 1, - WAKF, 1, - , 2, - PWKE, 1, - MWKE, 1, - AC0, 8, - PSV, 8, - CRT, 8, - TMP, 8, - AC1, 8, - BBST, 8, - Offset (0x0B), - Offset (0x0C), - Offset (0x0D), - Offset (0x0E), - SLPT, 8, - SWEJ, 1, - SWCH, 1, - Offset (0x10), - ADP, 1, - AFLT, 1, - BAT0, 1, - BAT1, 1, - , 3, - PWOF, 1, - WFNO, 8, - BPU0, 32, - BDC0, 32, - BFC0, 32, - BTC0, 32, - BDV0, 32, - BST0, 32, - BPR0, 32, - BRC0, 32, - BPV0, 32, - BTP0, 16, - BRS0, 16, - BCW0, 32, - BCL0, 32, - BCG0, 32, - BG20, 32, - BMO0, 64, - BIF0, 64, - BSN0, 32, - BTY0, 64, - Offset (0x67), - Offset (0x68), - ECOS, 8, - LNXD, 8, - ECPS, 8, - Offset (0x6C), - BTMP, 16, - EVTN, 8, - Offset (0x72), - PRCL, 8, - PRC0, 8, - PRC1, 8, - PRCM, 8, - PRIN, 8, - PSTE, 8, - PCAD, 8, - PEWL, 8, - PWRL, 8, - PECD, 8, - PEHI, 8, - PECI, 8, - PEPL, 8, - PEPM, 8, - PWFC, 8, - PECC, 8, - PDT0, 8, - PDT1, 8, - PDT2, 8, - PDT3, 8, - PRFC, 8, - PRS0, 8, - PRS1, 8, - PRS2, 8, - PRS3, 8, - PRS4, 8, - PRCS, 8, - PEC0, 8, - PEC1, 8, - PEC2, 8, - PEC3, 8, - CMDR, 8, - CVRT, 8, - GTVR, 8, - FANT, 8, - SKNT, 8, - AMBT, 8, - MCRT, 8, - DIM0, 8, - DIM1, 8, - PMAX, 8, - PPDT, 8, - PECH, 8, - PMDT, 8, - TSD0, 8, - TSD1, 8, - TSD2, 8, - TSD3, 8, - CPUP, 16, - MCHP, 16, - SYSP, 16, - CPAP, 16, - MCAP, 16, - SYAP, 16, - CFSP, 16, - CPUE, 16, - Offset (0xC6), - Offset (0xC7), - VGAT, 8, - OEM1, 8, - OEM2, 8, - OEM3, 16, - OEM4, 8, - Offset (0xCE), - DUT1, 8, - DUT2, 8, - RPM1, 16, - RPM2, 16, - RPM4, 16, - Offset (0xD7), - DTHL, 8, - DTBP, 8, - AIRP, 8, - WINF, 8, - RINF, 8, - Offset (0xDD), - INF2, 8, - MUTE, 1, - Offset (0xE0), - RPM3, 16, - ECKS, 8, - Offset (0xE4), - , 4, - XTUF, 1, - EP12, 1, - Offset (0xE5), - INF3, 8, - Offset (0xE7), - GFOF, 8, - Offset (0xE9), - KPCR, 1, - Offset (0xEA), - Offset (0xF0), - PL1T, 16, - PL2T, 16, - TAUT, 8, - Offset (0xF8), - FCMD, 8, - FDAT, 8, - FBUF, 8, - FBF1, 8, - FBF2, 8, - FBF3, 8 -} diff --git a/src/mainboard/system76/gaze15/acpi/hid.asl b/src/mainboard/system76/gaze15/acpi/hid.asl deleted file mode 100644 index ce8fd3f28b..0000000000 --- a/src/mainboard/system76/gaze15/acpi/hid.asl +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (HIDD) -{ - Name (_HID, "INT33D5") - Name (HBSY, Zero) - Name (HIDX, Zero) - Name (HRDY, Zero) - - Method (HDEM, 0, Serialized) - { - HBSY = Zero - Return (HIDX) - } - - Method (HDMM, 0, Serialized) - { - Return (Zero) - } - - Method (HDSM, 1, Serialized) - { - HRDY = Arg0 - } - - Method (HPEM, 1, Serialized) - { - HBSY = One - HIDX = Arg0 - - Notify (HIDD, 0xC0) - Local0 = Zero - While (((Local0 < 0xFA) && HBSY)) - { - Sleep (0x04) - Local0++ - } - - If ((HBSY == One)) - { - HBSY = Zero - HIDX = Zero - Return (One) - } - Else - { - Return (Zero) - } - } -} diff --git a/src/mainboard/system76/gaze15/acpi/lid.asl b/src/mainboard/system76/gaze15/acpi/lid.asl deleted file mode 100644 index 2d974c8e7d..0000000000 --- a/src/mainboard/system76/gaze15/acpi/lid.asl +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (LID0) -{ - Name (_HID, EisaId ("PNP0C0D")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) - - Method (_LID, 0, NotSerialized) { - DEBUG = "LID: _LID" - If (^^PCI0.LPCB.EC0.ECOK) { - Return (^^PCI0.LPCB.EC0.LSTE) - } Else { - Return (One) - } - } - - Method (_PSW, 1, NotSerialized) { - DEBUG = Concatenate("LID: _PSW: ", ToHexString(Arg0)) - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.LWKE = Arg0 - } - } -} diff --git a/src/mainboard/system76/gaze15/acpi/mainboard.asl b/src/mainboard/system76/gaze15/acpi/mainboard.asl index 11735e8e01..2fef852ae5 100644 --- a/src/mainboard/system76/gaze15/acpi/mainboard.asl +++ b/src/mainboard/system76/gaze15/acpi/mainboard.asl @@ -1,15 +1,19 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#define EC_GPE_SCI 0x03 /* GPP_K3 */ +#define EC_GPE_SWI 0x06 /* GPP_K6 */ +#define EC_COLOR_KEYBOARD 1 +#include + Scope (\_SB) { - #include "ac.asl" - #include "battery.asl" - #include "buttons.asl" - #include "hid.asl" - #include "lid.asl" - #include "s76.asl" #include "sleep.asl" + Scope (PCI0) { + #include "backlight.asl" + #include "pegp.asl" + #include "dgpu.asl" + } } -Scope (_GPE) { +Scope (\_GPE) { #include "gpe.asl" } diff --git a/src/mainboard/system76/gaze15/acpi/s76.asl b/src/mainboard/system76/gaze15/acpi/s76.asl deleted file mode 100644 index 8deb293ea8..0000000000 --- a/src/mainboard/system76/gaze15/acpi/s76.asl +++ /dev/null @@ -1,89 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -// Notifications: -// 0x80 - hardware backlight toggle -// 0x81 - backlight toggle -// 0x82 - backlight down -// 0x83 - backlight up -// 0x84 - backlight color change -Device (S76D) { - Name (_HID, "17761776") - Name (_UID, 0) - - Method (RSET, 0, Serialized) { - Debug = "S76D: RSET" - SAPL(0) - SKBL(0) - SKBC(0xFFFFFF) - } - - Method (INIT, 0, Serialized) { - Debug = "S76D: INIT" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use software control - ^^PCI0.LPCB.EC0.ECOS = 2 - Return (0) - } Else { - Return (1) - } - } - - Method (FINI, 0, Serialized) { - Debug = "S76D: FINI" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use hardware control - ^^PCI0.LPCB.EC0.ECOS = 1 - Return (0) - } Else { - Return (1) - } - } - - // Get Airplane LED - Method (GAPL, 0, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (^^PCI0.LPCB.EC0.AIRP & 0x40) { - Return (1) - } - } - Return (0) - } - - // Set Airplane LED - Method (SAPL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (Arg0) { - ^^PCI0.LPCB.EC0.AIRP |= 0x40 - } Else { - ^^PCI0.LPCB.EC0.AIRP &= 0xBF - } - } - } - - // Set KB LED Brightness - Method (SKBL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 6 - ^^PCI0.LPCB.EC0.FBUF = Arg0 - ^^PCI0.LPCB.EC0.FBF1 = 0 - ^^PCI0.LPCB.EC0.FBF2 = Arg0 - ^^PCI0.LPCB.EC0.FCMD = 0xCA - } - } - - // Set Keyboard Color - Method (SKBC, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 0x3 - ^^PCI0.LPCB.EC0.FBUF = (Arg0 & 0xFF) - ^^PCI0.LPCB.EC0.FBF1 = ((Arg0 >> 16) & 0xFF) - ^^PCI0.LPCB.EC0.FBF2 = ((Arg0 >> 8) & 0xFF) - ^^PCI0.LPCB.EC0.FCMD = 0xCA - Return (Arg0) - } Else { - Return (0) - } - } -} diff --git a/src/mainboard/system76/gaze15/dsdt.asl b/src/mainboard/system76/gaze15/dsdt.asl index ba25ee2f6a..eac27b56f1 100644 --- a/src/mainboard/system76/gaze15/dsdt.asl +++ b/src/mainboard/system76/gaze15/dsdt.asl @@ -18,9 +18,6 @@ DefinitionBlock( { #include #include - #include "acpi/backlight.asl" - #include "acpi/pegp.asl" - #include "acpi/dgpu.asl" } #include @@ -28,7 +25,6 @@ DefinitionBlock( Scope (\_SB.PCI0.LPCB) { #include - #include "acpi/ec.asl" } #include "acpi/mainboard.asl" diff --git a/src/mainboard/system76/kbl-u/Kconfig b/src/mainboard/system76/kbl-u/Kconfig index 464ec2591e..52c580fb50 100644 --- a/src/mainboard/system76/kbl-u/Kconfig +++ b/src/mainboard/system76/kbl-u/Kconfig @@ -3,7 +3,6 @@ if BOARD_SYSTEM76_GALP2 || BOARD_SYSTEM76_GALP3 || BOARD_SYSTEM76_GALP3_B config BOARD_SPECIFIC_OPTIONS def_bool y select BOARD_ROMSIZE_KB_8192 - select EC_ACPI select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_CMOS_DEFAULT diff --git a/src/mainboard/system76/lemp9/Kconfig b/src/mainboard/system76/lemp9/Kconfig index 525488dd9a..097c592fcd 100644 --- a/src/mainboard/system76/lemp9/Kconfig +++ b/src/mainboard/system76/lemp9/Kconfig @@ -4,7 +4,7 @@ config BOARD_SPECIFIC_OPTIONS def_bool y select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_HID - select EC_ACPI + select EC_SYSTEM76_EC select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_SMI_HANDLER diff --git a/src/mainboard/system76/lemp9/acpi/ac.asl b/src/mainboard/system76/lemp9/acpi/ac.asl deleted file mode 100644 index 7326676198..0000000000 --- a/src/mainboard/system76/lemp9/acpi/ac.asl +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (AC) -{ - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - - Name (ACFG, One) - - Method (_PSR, 0, NotSerialized) // _PSR: Power Source - { - Return (ACFG) - } - - Method (_STA, 0, NotSerialized) // _STA: Status - { - Return (0x0F) - } -} diff --git a/src/mainboard/system76/lemp9/acpi/battery.asl b/src/mainboard/system76/lemp9/acpi/battery.asl deleted file mode 100644 index bc239dd9c0..0000000000 --- a/src/mainboard/system76/lemp9/acpi/battery.asl +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (BAT0) -{ - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, Zero) // _UID: Unique ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - Name (BFCC, Zero) - Method (_STA, 0, NotSerialized) // _STA: Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Return (0x1F) - } - Else - { - Return (0x0F) - } - } - Else - { - Return (0x0F) - } - } - - Name (PBIF, Package (0x0D) - { - One, - 0xFFFFFFFF, - 0xFFFFFFFF, - One, - 0x39D0, - Zero, - Zero, - 0x40, - 0x40, - "BAT", - "0001", - "LION", - "Notebook" - }) - Method (IVBI, 0, NotSerialized) - { - PBIF [One] = 0xFFFFFFFF - PBIF [0x02] = 0xFFFFFFFF - PBIF [0x04] = 0xFFFFFFFF - PBIF [0x09] = " " - PBIF [0x0A] = " " - PBIF [0x0B] = " " - PBIF [0x0C] = " " - BFCC = Zero - } - - Method (UPBI, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF) - PBIF [One] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF) - PBIF [0x02] = Local0 - BFCC = Local0 - Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF) - PBIF [0x04] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF) - PBIF [0x05] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF) - PBIF [0x06] = Local0 - PBIF [0x09] = "BAT" - PBIF [0x0A] = "0001" - PBIF [0x0B] = "LION" - PBIF [0x0C] = "Notebook" - } - Else - { - IVBI () - } - } - - Method (_BIF, 0, NotSerialized) // _BIF: Battery Information - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBI () - } - Else - { - IVBI () - } - - Return (PBIF) /* \_SB_.BAT0.PBIF */ - } - - Name (PBST, Package (0x04) - { - Zero, - 0xFFFFFFFF, - 0xFFFFFFFF, - 0x3D90 - }) - Method (IVBS, 0, NotSerialized) - { - PBST [Zero] = Zero - PBST [One] = 0xFFFFFFFF - PBST [0x02] = 0xFFFFFFFF - PBST [0x03] = 0x2710 - } - - Method (UPBS, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = Zero - Local1 = Zero - If (^^AC.ACFG) - { - If (((^^PCI0.LPCB.EC0.BST0 & 0x02) == 0x02)) - { - Local0 |= 0x02 - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - } - Else - { - Local0 |= One - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - - Local7 = (Local1 & 0x8000) - If ((Local7 == 0x8000)) - { - Local1 ^= 0xFFFF - } - - Local2 = (^^PCI0.LPCB.EC0.BRC0 & 0xFFFF) - Local3 = (^^PCI0.LPCB.EC0.BPV0 & 0xFFFF) - PBST [Zero] = Local0 - PBST [One] = Local1 - PBST [0x02] = Local2 - PBST [0x03] = Local3 - If ((BFCC != ^^PCI0.LPCB.EC0.BFC0)) - { - Notify (BAT0, 0x81) // Information Change - } - } - Else - { - IVBS () - } - } - - Method (_BST, 0, NotSerialized) // _BST: Battery Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBS () - } - Else - { - IVBS () - } - - Return (PBST) /* \_SB_.BAT0.PBST */ - } -} diff --git a/src/mainboard/system76/lemp9/acpi/buttons.asl b/src/mainboard/system76/lemp9/acpi/buttons.asl deleted file mode 100644 index 81e61242bf..0000000000 --- a/src/mainboard/system76/lemp9/acpi/buttons.asl +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (PWRB) -{ - Name (_HID, EisaId ("PNP0C0C")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) -} - -Device (SLPB) -{ - Name (_HID, EisaId ("PNP0C0E")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) -} diff --git a/src/mainboard/system76/lemp9/acpi/ec.asl b/src/mainboard/system76/lemp9/acpi/ec.asl deleted file mode 100644 index e6d7c35c6c..0000000000 --- a/src/mainboard/system76/lemp9/acpi/ec.asl +++ /dev/null @@ -1,221 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (EC0) -{ - Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */) // _HID: Hardware ID - Name (_GPE, 0x50 /* GPP_E16 */) // _GPE: General Purpose Events - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings - { - IO (Decode16, - 0x0062, // Range Minimum - 0x0062, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - IO (Decode16, - 0x0066, // Range Minimum - 0x0066, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - }) - - #include "acpi/ec_ram.asl" - - Name (ECOK, Zero) - Method (_REG, 2, Serialized) // _REG: Region Availability - { - Debug = Concatenate("EC: _REG", Concatenate(ToHexString(Arg0), Concatenate(" ", ToHexString(Arg1)))) - If (((Arg0 == 0x03) && (Arg1 == One))) { - // Enable hardware touchpad lock, airplane mode, and keyboard backlight keys - ECOS = 1 - - // Enable software display brightness keys - WINF = 1 - - // Set current AC state - ^^^^AC.ACFG = ADP - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - PNOT () - - // EC is now available - ECOK = Arg1 - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (PTS, 1, Serialized) { - Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) - If (ECOK) { - // Clear wake cause - WFNO = Zero - } - } - - Method (WAK, 1, Serialized) { - Debug = Concatenate("EC: WAK: ", ToHexString(Arg0)) - If (ECOK) { - // Set current AC state - ^^^^AC.ACFG = ADP - - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (_Q0A, 0, NotSerialized) // Touchpad Toggle - { - Debug = "EC: Touchpad Toggle" - } - - Method (_Q0B, 0, NotSerialized) // Screen Toggle - { - Debug = "EC: Screen Toggle" - } - - Method (_Q0C, 0, NotSerialized) // Mute - { - Debug = "EC: Mute" - } - - Method (_Q0D, 0, NotSerialized) // Keyboard Backlight - { - Debug = "EC: Keyboard Backlight" - } - - Method (_Q0E, 0, NotSerialized) // Volume Down - { - Debug = "EC: Volume Down" - } - - Method (_Q0F, 0, NotSerialized) // Volume Up - { - Debug = "EC: Volume Up" - } - - Method (_Q10, 0, NotSerialized) // Switch Video Mode - { - Debug = "EC: Switch Video Mode" - } - - Method (_Q11, 0, NotSerialized) // Brightness Down - { - Debug = "EC: Brightness Down" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (20) - } - } - - Method (_Q12, 0, NotSerialized) // Brightness Up - { - Debug = "EC: Brightness Up" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (19) - } - } - - Method (_Q13, 0, NotSerialized) // Camera Toggle - { - Debug = "EC: Camera Toggle" - } - - Method (_Q14, 0, NotSerialized) // Airplane Mode - { - Debug = "EC: Airplane Mode" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (8) - } - // TODO: hardware airplane mode - } - - Method (_Q15, 0, NotSerialized) // Suspend Button - { - Debug = "EC: Suspend Button" - Notify (SLPB, 0x80) - } - - Method (_Q16, 0, NotSerialized) // AC Detect - { - Debug = "EC: AC Detect" - ^^^^AC.ACFG = ADP - Notify (AC, 0x80) // Status Change - If (BAT0) - { - Notify (^^^^BAT0, 0x81) // Information Change - Notify (^^^^BAT0, 0x80) // Status Change - } - } - - Method (_Q17, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (17)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q19, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (19)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q1B, 0, NotSerialized) // Lid Close - { - Debug = "EC: Lid Close" - Notify (LID0, 0x80) - } - - Method (_Q1C, 0, NotSerialized) // Thermal Trip - { - Debug = "EC: Thermal Trip" - /* TODO - Notify (\_TZ.TZ0, 0x81) // Thermal Trip Point Change - Notify (\_TZ.TZ0, 0x80) // Thermal Status Change - */ - } - - Method (_Q1D, 0, NotSerialized) // Power Button - { - Debug = "EC: Power Button" - Notify (PWRB, 0x80) - } - - Method (_Q50, 0, NotSerialized) // Other Events - { - Local0 = OEM4 - If (Local0 == 0x8A) { - Debug = "EC: White Keyboard Backlight" - Notify (^^^^S76D, 0x80) - } ElseIf (Local0 == 0x9F) { - Debug = "EC: Color Keyboard Toggle" - Notify (^^^^S76D, 0x81) - } ElseIf (Local0 == 0x81) { - Debug = "EC: Color Keyboard Down" - Notify (^^^^S76D, 0x82) - } ElseIf (Local0 == 0x82) { - Debug = "EC: Color Keyboard Up" - Notify (^^^^S76D, 0x83) - } ElseIf (Local0 == 0x80) { - Debug = "EC: Color Keyboard Color Change" - Notify (^^^^S76D, 0x84) - } Else { - Debug = Concatenate("EC: Other: ", ToHexString(Local0)) - } - } -} diff --git a/src/mainboard/system76/lemp9/acpi/ec_ram.asl b/src/mainboard/system76/lemp9/acpi/ec_ram.asl deleted file mode 100644 index d5f97edbd7..0000000000 --- a/src/mainboard/system76/lemp9/acpi/ec_ram.asl +++ /dev/null @@ -1,175 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF) -Field (ERAM, ByteAcc, Lock, Preserve) -{ - NMSG, 8, - SLED, 4, - Offset (0x02), - MODE, 1, - FAN0, 1, - TME0, 1, - TME1, 1, - FAN1, 1, - , 2, - Offset (0x03), - LSTE, 1, - LSW0, 1, - LWKE, 1, - WAKF, 1, - , 2, - PWKE, 1, - MWKE, 1, - AC0, 8, - PSV, 8, - CRT, 8, - TMP, 8, - AC1, 8, - BBST, 8, - Offset (0x0B), - Offset (0x0C), - Offset (0x0D), - Offset (0x0E), - SLPT, 8, - SWEJ, 1, - SWCH, 1, - Offset (0x10), - ADP, 1, - AFLT, 1, - BAT0, 1, - BAT1, 1, - , 3, - PWOF, 1, - WFNO, 8, - BPU0, 32, - BDC0, 32, - BFC0, 32, - BTC0, 32, - BDV0, 32, - BST0, 32, - BPR0, 32, - BRC0, 32, - BPV0, 32, - BTP0, 16, - BRS0, 16, - BCW0, 32, - BCL0, 32, - BCG0, 32, - BG20, 32, - BMO0, 64, - BIF0, 64, - BSN0, 32, - BTY0, 64, - Offset (0x67), - Offset (0x68), - ECOS, 8, - LNXD, 8, - ECPS, 8, - Offset (0x6C), - BTMP, 16, - EVTN, 8, - Offset (0x72), - PRCL, 8, - PRC0, 8, - PRC1, 8, - PRCM, 8, - PRIN, 8, - PSTE, 8, - PCAD, 8, - PEWL, 8, - PWRL, 8, - PECD, 8, - PEHI, 8, - PECI, 8, - PEPL, 8, - PEPM, 8, - PWFC, 8, - PECC, 8, - PDT0, 8, - PDT1, 8, - PDT2, 8, - PDT3, 8, - PRFC, 8, - PRS0, 8, - PRS1, 8, - PRS2, 8, - PRS3, 8, - PRS4, 8, - PRCS, 8, - PEC0, 8, - PEC1, 8, - PEC2, 8, - PEC3, 8, - CMDR, 8, - CVRT, 8, - GTVR, 8, - FANT, 8, - SKNT, 8, - AMBT, 8, - MCRT, 8, - DIM0, 8, - DIM1, 8, - PMAX, 8, - PPDT, 8, - PECH, 8, - PMDT, 8, - TSD0, 8, - TSD1, 8, - TSD2, 8, - TSD3, 8, - CPUP, 16, - MCHP, 16, - SYSP, 16, - CPAP, 16, - MCAP, 16, - SYAP, 16, - CFSP, 16, - CPUE, 16, - Offset (0xC6), - Offset (0xC7), - VGAT, 8, - OEM1, 8, - OEM2, 8, - OEM3, 16, - OEM4, 8, - Offset (0xCE), - DUT1, 8, - DUT2, 8, - RPM1, 16, - RPM2, 16, - RPM4, 16, - Offset (0xD7), - DTHL, 8, - DTBP, 8, - AIRP, 8, - WINF, 8, - RINF, 8, - Offset (0xDD), - INF2, 8, - MUTE, 1, - Offset (0xE0), - RPM3, 16, - ECKS, 8, - Offset (0xE4), - , 4, - XTUF, 1, - EP12, 1, - Offset (0xE5), - INF3, 8, - Offset (0xE7), - GFOF, 8, - Offset (0xE9), - KPCR, 1, - Offset (0xEA), - Offset (0xF0), - PL1T, 16, - PL2T, 16, - TAUT, 8, - Offset (0xF8), - FCMD, 8, - FDAT, 8, - FBUF, 8, - FBF1, 8, - FBF2, 8, - FBF3, 8 -} diff --git a/src/mainboard/system76/lemp9/acpi/hid.asl b/src/mainboard/system76/lemp9/acpi/hid.asl deleted file mode 100644 index ce8fd3f28b..0000000000 --- a/src/mainboard/system76/lemp9/acpi/hid.asl +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (HIDD) -{ - Name (_HID, "INT33D5") - Name (HBSY, Zero) - Name (HIDX, Zero) - Name (HRDY, Zero) - - Method (HDEM, 0, Serialized) - { - HBSY = Zero - Return (HIDX) - } - - Method (HDMM, 0, Serialized) - { - Return (Zero) - } - - Method (HDSM, 1, Serialized) - { - HRDY = Arg0 - } - - Method (HPEM, 1, Serialized) - { - HBSY = One - HIDX = Arg0 - - Notify (HIDD, 0xC0) - Local0 = Zero - While (((Local0 < 0xFA) && HBSY)) - { - Sleep (0x04) - Local0++ - } - - If ((HBSY == One)) - { - HBSY = Zero - HIDX = Zero - Return (One) - } - Else - { - Return (Zero) - } - } -} diff --git a/src/mainboard/system76/lemp9/acpi/lid.asl b/src/mainboard/system76/lemp9/acpi/lid.asl deleted file mode 100644 index ea382eb045..0000000000 --- a/src/mainboard/system76/lemp9/acpi/lid.asl +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (LID0) -{ - Name (_HID, EisaId ("PNP0C0D")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) - - Method (_LID, 0, NotSerialized) { - DEBUG = "LID: _LID" - If (^^PCI0.LPCB.EC0.ECOK) { - Return (^^PCI0.LPCB.EC0.LSTE) - } Else { - Return (One) - } - } - - Method (_PSW, 1, NotSerialized) { - DEBUG = Concatenate("LID: _PSW: ", ToHexString(Arg0)) - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.LWKE = Arg0 - } - } -} diff --git a/src/mainboard/system76/lemp9/acpi/mainboard.asl b/src/mainboard/system76/lemp9/acpi/mainboard.asl index 11735e8e01..d279b068ff 100644 --- a/src/mainboard/system76/lemp9/acpi/mainboard.asl +++ b/src/mainboard/system76/lemp9/acpi/mainboard.asl @@ -1,15 +1,17 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#define EC_GPE_SCI 0x50 /* GPP_E16 */ +#define EC_GPE_SWI 0x29 /* GPP_D9 */ +#define EC_COLOR_KEYBOARD 0 +#include + Scope (\_SB) { - #include "ac.asl" - #include "battery.asl" - #include "buttons.asl" - #include "hid.asl" - #include "lid.asl" - #include "s76.asl" #include "sleep.asl" + Scope (PCI0) { + #include "backlight.asl" + } } -Scope (_GPE) { +Scope (\_GPE) { #include "gpe.asl" } diff --git a/src/mainboard/system76/lemp9/acpi/s76.asl b/src/mainboard/system76/lemp9/acpi/s76.asl deleted file mode 100644 index 399e569734..0000000000 --- a/src/mainboard/system76/lemp9/acpi/s76.asl +++ /dev/null @@ -1,84 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -// Notifications: -// 0x80 - hardware backlight toggle -// 0x81 - backlight toggle -// 0x82 - backlight down -// 0x83 - backlight up -// 0x84 - backlight color change -Device (S76D) { - Name (_HID, "17761776") - Name (_UID, 0) - - Method (RSET, 0, Serialized) { - Debug = "S76D: RSET" - SAPL(0) - SKBL(0) - } - - Method (INIT, 0, Serialized) { - Debug = "S76D: INIT" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use software control - ^^PCI0.LPCB.EC0.ECOS = 2 - Return (0) - } Else { - Return (1) - } - } - - Method (FINI, 0, Serialized) { - Debug = "S76D: FINI" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use hardware control - ^^PCI0.LPCB.EC0.ECOS = 1 - Return (0) - } Else { - Return (1) - } - } - - // Get Airplane LED - Method (GAPL, 0, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (^^PCI0.LPCB.EC0.AIRP & 0x40) { - Return (1) - } - } - Return (0) - } - - // Set Airplane LED - Method (SAPL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (Arg0) { - ^^PCI0.LPCB.EC0.AIRP |= 0x40 - } Else { - ^^PCI0.LPCB.EC0.AIRP &= 0xBF - } - } - } - - // Get KB LED - Method (GKBL, 0, Serialized) { - Local0 = 0 - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = One - ^^PCI0.LPCB.EC0.FCMD = 0xCA - Local0 = ^^PCI0.LPCB.EC0.FBUF - ^^PCI0.LPCB.EC0.FCMD = Zero - } - Return (Local0) - } - - // Set KB Led - Method (SKBL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = Zero - ^^PCI0.LPCB.EC0.FBUF = Arg0 - ^^PCI0.LPCB.EC0.FCMD = 0xCA - } - } -} diff --git a/src/mainboard/system76/lemp9/dsdt.asl b/src/mainboard/system76/lemp9/dsdt.asl index 31cba2df39..eac27b56f1 100644 --- a/src/mainboard/system76/lemp9/dsdt.asl +++ b/src/mainboard/system76/lemp9/dsdt.asl @@ -18,7 +18,6 @@ DefinitionBlock( { #include #include - #include "acpi/backlight.asl" } #include @@ -26,7 +25,6 @@ DefinitionBlock( Scope (\_SB.PCI0.LPCB) { #include - #include "acpi/ec.asl" } #include "acpi/mainboard.asl" diff --git a/src/mainboard/system76/oryp6/Kconfig b/src/mainboard/system76/oryp6/Kconfig index 7d3e09b8b5..54d96f1513 100644 --- a/src/mainboard/system76/oryp6/Kconfig +++ b/src/mainboard/system76/oryp6/Kconfig @@ -5,8 +5,7 @@ config BOARD_SPECIFIC_OPTIONS select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_HID select DRIVERS_I2C_TAS5825M - select DRIVERS_SYSTEM76_EC - select EC_ACPI + select EC_SYSTEM76_EC select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_SMI_HANDLER diff --git a/src/mainboard/system76/oryp6/acpi/ac.asl b/src/mainboard/system76/oryp6/acpi/ac.asl deleted file mode 100644 index 7326676198..0000000000 --- a/src/mainboard/system76/oryp6/acpi/ac.asl +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (AC) -{ - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - - Name (ACFG, One) - - Method (_PSR, 0, NotSerialized) // _PSR: Power Source - { - Return (ACFG) - } - - Method (_STA, 0, NotSerialized) // _STA: Status - { - Return (0x0F) - } -} diff --git a/src/mainboard/system76/oryp6/acpi/battery.asl b/src/mainboard/system76/oryp6/acpi/battery.asl deleted file mode 100644 index bc239dd9c0..0000000000 --- a/src/mainboard/system76/oryp6/acpi/battery.asl +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (BAT0) -{ - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, Zero) // _UID: Unique ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - Name (BFCC, Zero) - Method (_STA, 0, NotSerialized) // _STA: Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Return (0x1F) - } - Else - { - Return (0x0F) - } - } - Else - { - Return (0x0F) - } - } - - Name (PBIF, Package (0x0D) - { - One, - 0xFFFFFFFF, - 0xFFFFFFFF, - One, - 0x39D0, - Zero, - Zero, - 0x40, - 0x40, - "BAT", - "0001", - "LION", - "Notebook" - }) - Method (IVBI, 0, NotSerialized) - { - PBIF [One] = 0xFFFFFFFF - PBIF [0x02] = 0xFFFFFFFF - PBIF [0x04] = 0xFFFFFFFF - PBIF [0x09] = " " - PBIF [0x0A] = " " - PBIF [0x0B] = " " - PBIF [0x0C] = " " - BFCC = Zero - } - - Method (UPBI, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF) - PBIF [One] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF) - PBIF [0x02] = Local0 - BFCC = Local0 - Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF) - PBIF [0x04] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF) - PBIF [0x05] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF) - PBIF [0x06] = Local0 - PBIF [0x09] = "BAT" - PBIF [0x0A] = "0001" - PBIF [0x0B] = "LION" - PBIF [0x0C] = "Notebook" - } - Else - { - IVBI () - } - } - - Method (_BIF, 0, NotSerialized) // _BIF: Battery Information - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBI () - } - Else - { - IVBI () - } - - Return (PBIF) /* \_SB_.BAT0.PBIF */ - } - - Name (PBST, Package (0x04) - { - Zero, - 0xFFFFFFFF, - 0xFFFFFFFF, - 0x3D90 - }) - Method (IVBS, 0, NotSerialized) - { - PBST [Zero] = Zero - PBST [One] = 0xFFFFFFFF - PBST [0x02] = 0xFFFFFFFF - PBST [0x03] = 0x2710 - } - - Method (UPBS, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = Zero - Local1 = Zero - If (^^AC.ACFG) - { - If (((^^PCI0.LPCB.EC0.BST0 & 0x02) == 0x02)) - { - Local0 |= 0x02 - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - } - Else - { - Local0 |= One - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - - Local7 = (Local1 & 0x8000) - If ((Local7 == 0x8000)) - { - Local1 ^= 0xFFFF - } - - Local2 = (^^PCI0.LPCB.EC0.BRC0 & 0xFFFF) - Local3 = (^^PCI0.LPCB.EC0.BPV0 & 0xFFFF) - PBST [Zero] = Local0 - PBST [One] = Local1 - PBST [0x02] = Local2 - PBST [0x03] = Local3 - If ((BFCC != ^^PCI0.LPCB.EC0.BFC0)) - { - Notify (BAT0, 0x81) // Information Change - } - } - Else - { - IVBS () - } - } - - Method (_BST, 0, NotSerialized) // _BST: Battery Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBS () - } - Else - { - IVBS () - } - - Return (PBST) /* \_SB_.BAT0.PBST */ - } -} diff --git a/src/mainboard/system76/oryp6/acpi/buttons.asl b/src/mainboard/system76/oryp6/acpi/buttons.asl deleted file mode 100644 index 9ad4f03d65..0000000000 --- a/src/mainboard/system76/oryp6/acpi/buttons.asl +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (PWRB) -{ - Name (_HID, EisaId ("PNP0C0C")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) -} - -Device (SLPB) -{ - Name (_HID, EisaId ("PNP0C0E")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) -} diff --git a/src/mainboard/system76/oryp6/acpi/ec.asl b/src/mainboard/system76/oryp6/acpi/ec.asl deleted file mode 100644 index 8c7a15ddcc..0000000000 --- a/src/mainboard/system76/oryp6/acpi/ec.asl +++ /dev/null @@ -1,217 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (EC0) -{ - Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */) // _HID: Hardware ID - Name (_GPE, 0x03 /* GPP_K3 */) // _GPE: General Purpose Events - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings - { - IO (Decode16, - 0x0062, // Range Minimum - 0x0062, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - IO (Decode16, - 0x0066, // Range Minimum - 0x0066, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - }) - - #include "acpi/ec_ram.asl" - - Name (ECOK, Zero) - Method (_REG, 2, Serialized) // _REG: Region Availability - { - Debug = Concatenate("EC: _REG", Concatenate(ToHexString(Arg0), Concatenate(" ", ToHexString(Arg1)))) - If (((Arg0 == 0x03) && (Arg1 == One))) { - // Enable hardware touchpad lock, airplane mode, and keyboard backlight keys - ECOS = 1 - - // Enable software display brightness keys - WINF = 1 - - // Set current AC state - ^^^^AC.ACFG = ADP - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - PNOT () - - // EC is now available - ECOK = Arg1 - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (PTS, 1, Serialized) { - Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) - If (ECOK) { - // Clear wake cause - WFNO = Zero - } - } - - Method (WAK, 1, Serialized) { - Debug = Concatenate("EC: WAK: ", ToHexString(Arg0)) - If (ECOK) { - // Set current AC state - ^^^^AC.ACFG = ADP - - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (_Q0A, 0, NotSerialized) // Touchpad Toggle - { - Debug = "EC: Touchpad Toggle" - } - - Method (_Q0B, 0, NotSerialized) // Screen Toggle - { - Debug = "EC: Screen Toggle" - } - - Method (_Q0C, 0, NotSerialized) // Mute - { - Debug = "EC: Mute" - } - - Method (_Q0D, 0, NotSerialized) // Keyboard Backlight - { - Debug = "EC: Keyboard Backlight" - } - - Method (_Q0E, 0, NotSerialized) // Volume Down - { - Debug = "EC: Volume Down" - } - - Method (_Q0F, 0, NotSerialized) // Volume Up - { - Debug = "EC: Volume Up" - } - - Method (_Q10, 0, NotSerialized) // Switch Video Mode - { - Debug = "EC: Switch Video Mode" - } - - Method (_Q11, 0, NotSerialized) // Brightness Down - { - Debug = "EC: Brightness Down" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (20) - } - } - - Method (_Q12, 0, NotSerialized) // Brightness Up - { - Debug = "EC: Brightness Up" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (19) - } - } - - Method (_Q13, 0, NotSerialized) // Camera Toggle - { - Debug = "EC: Camera Toggle" - } - - Method (_Q14, 0, NotSerialized) // Airplane Mode - { - Debug = "EC: Airplane Mode" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (8) - } - // TODO: hardware airplane mode - } - - Method (_Q15, 0, NotSerialized) // Suspend Button - { - Debug = "EC: Suspend Button" - Notify (SLPB, 0x80) - } - - Method (_Q16, 0, NotSerialized) // AC Detect - { - Debug = "EC: AC Detect" - ^^^^AC.ACFG = ADP - Notify (AC, 0x80) // Status Change - If (BAT0) - { - Notify (^^^^BAT0, 0x81) // Information Change - Notify (^^^^BAT0, 0x80) // Status Change - } - } - - Method (_Q17, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (17)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q19, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (19)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q1B, 0, NotSerialized) // Lid Close - { - Debug = "EC: Lid Close" - Notify (LID0, 0x80) - } - - Method (_Q1C, 0, NotSerialized) // Thermal Trip - { - Debug = "EC: Thermal Trip" - /* TODO - Notify (\_TZ.TZ0, 0x81) // Thermal Trip Point Change - Notify (\_TZ.TZ0, 0x80) // Thermal Status Change - */ - } - - Method (_Q1D, 0, NotSerialized) // Power Button - { - Debug = "EC: Power Button" - Notify (PWRB, 0x80) - } - - Method (_Q50, 0, NotSerialized) // Other Events - { - Local0 = OEM4 - If (Local0 == 0x8A) { - Debug = "EC: White Keyboard Backlight" - Notify (^^^^S76D, 0x80) - } ElseIf (Local0 == 0x9F) { - Debug = "EC: Color Keyboard Toggle" - Notify (^^^^S76D, 0x81) - } ElseIf (Local0 == 0x81) { - Debug = "EC: Color Keyboard Down" - Notify (^^^^S76D, 0x82) - } ElseIf (Local0 == 0x82) { - Debug = "EC: Color Keyboard Up" - Notify (^^^^S76D, 0x83) - } ElseIf (Local0 == 0x80) { - Debug = "EC: Color Keyboard Color Change" - Notify (^^^^S76D, 0x84) - } Else { - Debug = Concatenate("EC: Other: ", ToHexString(Local0)) - } - } -} diff --git a/src/mainboard/system76/oryp6/acpi/ec_ram.asl b/src/mainboard/system76/oryp6/acpi/ec_ram.asl deleted file mode 100644 index d5f97edbd7..0000000000 --- a/src/mainboard/system76/oryp6/acpi/ec_ram.asl +++ /dev/null @@ -1,175 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF) -Field (ERAM, ByteAcc, Lock, Preserve) -{ - NMSG, 8, - SLED, 4, - Offset (0x02), - MODE, 1, - FAN0, 1, - TME0, 1, - TME1, 1, - FAN1, 1, - , 2, - Offset (0x03), - LSTE, 1, - LSW0, 1, - LWKE, 1, - WAKF, 1, - , 2, - PWKE, 1, - MWKE, 1, - AC0, 8, - PSV, 8, - CRT, 8, - TMP, 8, - AC1, 8, - BBST, 8, - Offset (0x0B), - Offset (0x0C), - Offset (0x0D), - Offset (0x0E), - SLPT, 8, - SWEJ, 1, - SWCH, 1, - Offset (0x10), - ADP, 1, - AFLT, 1, - BAT0, 1, - BAT1, 1, - , 3, - PWOF, 1, - WFNO, 8, - BPU0, 32, - BDC0, 32, - BFC0, 32, - BTC0, 32, - BDV0, 32, - BST0, 32, - BPR0, 32, - BRC0, 32, - BPV0, 32, - BTP0, 16, - BRS0, 16, - BCW0, 32, - BCL0, 32, - BCG0, 32, - BG20, 32, - BMO0, 64, - BIF0, 64, - BSN0, 32, - BTY0, 64, - Offset (0x67), - Offset (0x68), - ECOS, 8, - LNXD, 8, - ECPS, 8, - Offset (0x6C), - BTMP, 16, - EVTN, 8, - Offset (0x72), - PRCL, 8, - PRC0, 8, - PRC1, 8, - PRCM, 8, - PRIN, 8, - PSTE, 8, - PCAD, 8, - PEWL, 8, - PWRL, 8, - PECD, 8, - PEHI, 8, - PECI, 8, - PEPL, 8, - PEPM, 8, - PWFC, 8, - PECC, 8, - PDT0, 8, - PDT1, 8, - PDT2, 8, - PDT3, 8, - PRFC, 8, - PRS0, 8, - PRS1, 8, - PRS2, 8, - PRS3, 8, - PRS4, 8, - PRCS, 8, - PEC0, 8, - PEC1, 8, - PEC2, 8, - PEC3, 8, - CMDR, 8, - CVRT, 8, - GTVR, 8, - FANT, 8, - SKNT, 8, - AMBT, 8, - MCRT, 8, - DIM0, 8, - DIM1, 8, - PMAX, 8, - PPDT, 8, - PECH, 8, - PMDT, 8, - TSD0, 8, - TSD1, 8, - TSD2, 8, - TSD3, 8, - CPUP, 16, - MCHP, 16, - SYSP, 16, - CPAP, 16, - MCAP, 16, - SYAP, 16, - CFSP, 16, - CPUE, 16, - Offset (0xC6), - Offset (0xC7), - VGAT, 8, - OEM1, 8, - OEM2, 8, - OEM3, 16, - OEM4, 8, - Offset (0xCE), - DUT1, 8, - DUT2, 8, - RPM1, 16, - RPM2, 16, - RPM4, 16, - Offset (0xD7), - DTHL, 8, - DTBP, 8, - AIRP, 8, - WINF, 8, - RINF, 8, - Offset (0xDD), - INF2, 8, - MUTE, 1, - Offset (0xE0), - RPM3, 16, - ECKS, 8, - Offset (0xE4), - , 4, - XTUF, 1, - EP12, 1, - Offset (0xE5), - INF3, 8, - Offset (0xE7), - GFOF, 8, - Offset (0xE9), - KPCR, 1, - Offset (0xEA), - Offset (0xF0), - PL1T, 16, - PL2T, 16, - TAUT, 8, - Offset (0xF8), - FCMD, 8, - FDAT, 8, - FBUF, 8, - FBF1, 8, - FBF2, 8, - FBF3, 8 -} diff --git a/src/mainboard/system76/oryp6/acpi/hid.asl b/src/mainboard/system76/oryp6/acpi/hid.asl deleted file mode 100644 index ce8fd3f28b..0000000000 --- a/src/mainboard/system76/oryp6/acpi/hid.asl +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (HIDD) -{ - Name (_HID, "INT33D5") - Name (HBSY, Zero) - Name (HIDX, Zero) - Name (HRDY, Zero) - - Method (HDEM, 0, Serialized) - { - HBSY = Zero - Return (HIDX) - } - - Method (HDMM, 0, Serialized) - { - Return (Zero) - } - - Method (HDSM, 1, Serialized) - { - HRDY = Arg0 - } - - Method (HPEM, 1, Serialized) - { - HBSY = One - HIDX = Arg0 - - Notify (HIDD, 0xC0) - Local0 = Zero - While (((Local0 < 0xFA) && HBSY)) - { - Sleep (0x04) - Local0++ - } - - If ((HBSY == One)) - { - HBSY = Zero - HIDX = Zero - Return (One) - } - Else - { - Return (Zero) - } - } -} diff --git a/src/mainboard/system76/oryp6/acpi/lid.asl b/src/mainboard/system76/oryp6/acpi/lid.asl deleted file mode 100644 index 2d974c8e7d..0000000000 --- a/src/mainboard/system76/oryp6/acpi/lid.asl +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (LID0) -{ - Name (_HID, EisaId ("PNP0C0D")) - Name (_PRW, Package () { 0x06 /* GPP_K6 */, 3 }) - - Method (_LID, 0, NotSerialized) { - DEBUG = "LID: _LID" - If (^^PCI0.LPCB.EC0.ECOK) { - Return (^^PCI0.LPCB.EC0.LSTE) - } Else { - Return (One) - } - } - - Method (_PSW, 1, NotSerialized) { - DEBUG = Concatenate("LID: _PSW: ", ToHexString(Arg0)) - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.LWKE = Arg0 - } - } -} diff --git a/src/mainboard/system76/oryp6/acpi/mainboard.asl b/src/mainboard/system76/oryp6/acpi/mainboard.asl index 11735e8e01..2fef852ae5 100644 --- a/src/mainboard/system76/oryp6/acpi/mainboard.asl +++ b/src/mainboard/system76/oryp6/acpi/mainboard.asl @@ -1,15 +1,19 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#define EC_GPE_SCI 0x03 /* GPP_K3 */ +#define EC_GPE_SWI 0x06 /* GPP_K6 */ +#define EC_COLOR_KEYBOARD 1 +#include + Scope (\_SB) { - #include "ac.asl" - #include "battery.asl" - #include "buttons.asl" - #include "hid.asl" - #include "lid.asl" - #include "s76.asl" #include "sleep.asl" + Scope (PCI0) { + #include "backlight.asl" + #include "pegp.asl" + #include "dgpu.asl" + } } -Scope (_GPE) { +Scope (\_GPE) { #include "gpe.asl" } diff --git a/src/mainboard/system76/oryp6/acpi/s76.asl b/src/mainboard/system76/oryp6/acpi/s76.asl deleted file mode 100644 index 8deb293ea8..0000000000 --- a/src/mainboard/system76/oryp6/acpi/s76.asl +++ /dev/null @@ -1,89 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -// Notifications: -// 0x80 - hardware backlight toggle -// 0x81 - backlight toggle -// 0x82 - backlight down -// 0x83 - backlight up -// 0x84 - backlight color change -Device (S76D) { - Name (_HID, "17761776") - Name (_UID, 0) - - Method (RSET, 0, Serialized) { - Debug = "S76D: RSET" - SAPL(0) - SKBL(0) - SKBC(0xFFFFFF) - } - - Method (INIT, 0, Serialized) { - Debug = "S76D: INIT" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use software control - ^^PCI0.LPCB.EC0.ECOS = 2 - Return (0) - } Else { - Return (1) - } - } - - Method (FINI, 0, Serialized) { - Debug = "S76D: FINI" - RSET() - If (^^PCI0.LPCB.EC0.ECOK) { - // Set flags to use hardware control - ^^PCI0.LPCB.EC0.ECOS = 1 - Return (0) - } Else { - Return (1) - } - } - - // Get Airplane LED - Method (GAPL, 0, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (^^PCI0.LPCB.EC0.AIRP & 0x40) { - Return (1) - } - } - Return (0) - } - - // Set Airplane LED - Method (SAPL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - If (Arg0) { - ^^PCI0.LPCB.EC0.AIRP |= 0x40 - } Else { - ^^PCI0.LPCB.EC0.AIRP &= 0xBF - } - } - } - - // Set KB LED Brightness - Method (SKBL, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 6 - ^^PCI0.LPCB.EC0.FBUF = Arg0 - ^^PCI0.LPCB.EC0.FBF1 = 0 - ^^PCI0.LPCB.EC0.FBF2 = Arg0 - ^^PCI0.LPCB.EC0.FCMD = 0xCA - } - } - - // Set Keyboard Color - Method (SKBC, 1, Serialized) { - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.FDAT = 0x3 - ^^PCI0.LPCB.EC0.FBUF = (Arg0 & 0xFF) - ^^PCI0.LPCB.EC0.FBF1 = ((Arg0 >> 16) & 0xFF) - ^^PCI0.LPCB.EC0.FBF2 = ((Arg0 >> 8) & 0xFF) - ^^PCI0.LPCB.EC0.FCMD = 0xCA - Return (Arg0) - } Else { - Return (0) - } - } -} diff --git a/src/mainboard/system76/oryp6/dsdt.asl b/src/mainboard/system76/oryp6/dsdt.asl index ba25ee2f6a..eac27b56f1 100644 --- a/src/mainboard/system76/oryp6/dsdt.asl +++ b/src/mainboard/system76/oryp6/dsdt.asl @@ -18,9 +18,6 @@ DefinitionBlock( { #include #include - #include "acpi/backlight.asl" - #include "acpi/pegp.asl" - #include "acpi/dgpu.asl" } #include @@ -28,7 +25,6 @@ DefinitionBlock( Scope (\_SB.PCI0.LPCB) { #include - #include "acpi/ec.asl" } #include "acpi/mainboard.asl" diff --git a/src/mainboard/system76/thelio-b1/Kconfig b/src/mainboard/system76/thelio-b1/Kconfig index 3b91526c4c..99d903eba6 100644 --- a/src/mainboard/system76/thelio-b1/Kconfig +++ b/src/mainboard/system76/thelio-b1/Kconfig @@ -4,7 +4,6 @@ config BOARD_SPECIFIC_OPTIONS def_bool y select ADD_FSP_BINARIES select BOARD_ROMSIZE_KB_16384 - select EC_ACPI select EXCLUDE_EMMC_INTERFACE select FSP_USE_REPO select HAVE_ACPI_RESUME diff --git a/src/mainboard/system76/whl-u/Kconfig b/src/mainboard/system76/whl-u/Kconfig index 99a17100b6..39f769e06a 100644 --- a/src/mainboard/system76/whl-u/Kconfig +++ b/src/mainboard/system76/whl-u/Kconfig @@ -4,7 +4,7 @@ config BOARD_SPECIFIC_OPTIONS def_bool y select BOARD_ROMSIZE_KB_16384 select DRIVERS_I2C_HID - select EC_ACPI + select EC_SYSTEM76_EC select HAVE_ACPI_RESUME select HAVE_ACPI_TABLES select HAVE_CMOS_DEFAULT diff --git a/src/mainboard/system76/whl-u/acpi/ac.asl b/src/mainboard/system76/whl-u/acpi/ac.asl deleted file mode 100644 index 7326676198..0000000000 --- a/src/mainboard/system76/whl-u/acpi/ac.asl +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (AC) -{ - Name (_HID, "ACPI0003" /* Power Source Device */) // _HID: Hardware ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - - Name (ACFG, One) - - Method (_PSR, 0, NotSerialized) // _PSR: Power Source - { - Return (ACFG) - } - - Method (_STA, 0, NotSerialized) // _STA: Status - { - Return (0x0F) - } -} diff --git a/src/mainboard/system76/whl-u/acpi/battery.asl b/src/mainboard/system76/whl-u/acpi/battery.asl deleted file mode 100644 index bc239dd9c0..0000000000 --- a/src/mainboard/system76/whl-u/acpi/battery.asl +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (BAT0) -{ - Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID - Name (_UID, Zero) // _UID: Unique ID - Name (_PCL, Package (0x01) // _PCL: Power Consumer List - { - _SB - }) - Name (BFCC, Zero) - Method (_STA, 0, NotSerialized) // _STA: Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Return (0x1F) - } - Else - { - Return (0x0F) - } - } - Else - { - Return (0x0F) - } - } - - Name (PBIF, Package (0x0D) - { - One, - 0xFFFFFFFF, - 0xFFFFFFFF, - One, - 0x39D0, - Zero, - Zero, - 0x40, - 0x40, - "BAT", - "0001", - "LION", - "Notebook" - }) - Method (IVBI, 0, NotSerialized) - { - PBIF [One] = 0xFFFFFFFF - PBIF [0x02] = 0xFFFFFFFF - PBIF [0x04] = 0xFFFFFFFF - PBIF [0x09] = " " - PBIF [0x0A] = " " - PBIF [0x0B] = " " - PBIF [0x0C] = " " - BFCC = Zero - } - - Method (UPBI, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF) - PBIF [One] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF) - PBIF [0x02] = Local0 - BFCC = Local0 - Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF) - PBIF [0x04] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF) - PBIF [0x05] = Local0 - Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF) - PBIF [0x06] = Local0 - PBIF [0x09] = "BAT" - PBIF [0x0A] = "0001" - PBIF [0x0B] = "LION" - PBIF [0x0C] = "Notebook" - } - Else - { - IVBI () - } - } - - Method (_BIF, 0, NotSerialized) // _BIF: Battery Information - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBI () - } - Else - { - IVBI () - } - - Return (PBIF) /* \_SB_.BAT0.PBIF */ - } - - Name (PBST, Package (0x04) - { - Zero, - 0xFFFFFFFF, - 0xFFFFFFFF, - 0x3D90 - }) - Method (IVBS, 0, NotSerialized) - { - PBST [Zero] = Zero - PBST [One] = 0xFFFFFFFF - PBST [0x02] = 0xFFFFFFFF - PBST [0x03] = 0x2710 - } - - Method (UPBS, 0, NotSerialized) - { - If (^^PCI0.LPCB.EC0.BAT0) - { - Local0 = Zero - Local1 = Zero - If (^^AC.ACFG) - { - If (((^^PCI0.LPCB.EC0.BST0 & 0x02) == 0x02)) - { - Local0 |= 0x02 - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - } - Else - { - Local0 |= One - Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) - } - - Local7 = (Local1 & 0x8000) - If ((Local7 == 0x8000)) - { - Local1 ^= 0xFFFF - } - - Local2 = (^^PCI0.LPCB.EC0.BRC0 & 0xFFFF) - Local3 = (^^PCI0.LPCB.EC0.BPV0 & 0xFFFF) - PBST [Zero] = Local0 - PBST [One] = Local1 - PBST [0x02] = Local2 - PBST [0x03] = Local3 - If ((BFCC != ^^PCI0.LPCB.EC0.BFC0)) - { - Notify (BAT0, 0x81) // Information Change - } - } - Else - { - IVBS () - } - } - - Method (_BST, 0, NotSerialized) // _BST: Battery Status - { - If (^^PCI0.LPCB.EC0.ECOK) - { - UPBS () - } - Else - { - IVBS () - } - - Return (PBST) /* \_SB_.BAT0.PBST */ - } -} diff --git a/src/mainboard/system76/whl-u/acpi/buttons.asl b/src/mainboard/system76/whl-u/acpi/buttons.asl deleted file mode 100644 index 81e61242bf..0000000000 --- a/src/mainboard/system76/whl-u/acpi/buttons.asl +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (PWRB) -{ - Name (_HID, EisaId ("PNP0C0C")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) -} - -Device (SLPB) -{ - Name (_HID, EisaId ("PNP0C0E")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) -} diff --git a/src/mainboard/system76/whl-u/acpi/ec.asl b/src/mainboard/system76/whl-u/acpi/ec.asl deleted file mode 100644 index f8002b089a..0000000000 --- a/src/mainboard/system76/whl-u/acpi/ec.asl +++ /dev/null @@ -1,226 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (EC0) -{ - Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */) // _HID: Hardware ID - Name (_GPE, 0x50 /* GPP_E16 */) // _GPE: General Purpose Events - Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings - { - IO (Decode16, - 0x0062, // Range Minimum - 0x0062, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - IO (Decode16, - 0x0066, // Range Minimum - 0x0066, // Range Maximum - 0x00, // Alignment - 0x01, // Length - ) - }) - - #include "acpi/ec_ram.asl" - - Name (ECOK, Zero) - Method (_REG, 2, Serialized) // _REG: Region Availability - { - Debug = Concatenate("EC: _REG", Concatenate(ToHexString(Arg0), Concatenate(" ", ToHexString(Arg1)))) - If (((Arg0 == 0x03) && (Arg1 == One))) { - // Enable hardware touchpad lock, airplane mode, and keyboard backlight keys - ECOS = 1 - - // Enable software display brightness keys - WINF = 1 - - // Set current AC state - ^^^^AC.ACFG = ADP - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - PNOT () - - // EC is now available - ECOK = Arg1 - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (PTS, 1, Serialized) { - Debug = Concatenate("EC: PTS: ", ToHexString(Arg0)) - If (ECOK) { - // Clear wake cause - WFNO = Zero - } - } - - Method (WAK, 1, Serialized) { - Debug = Concatenate("EC: WAK: ", ToHexString(Arg0)) - If (ECOK) { - // Set current AC state - ^^^^AC.ACFG = ADP - - // Update battery information and status - ^^^^BAT0.UPBI() - ^^^^BAT0.UPBS() - - // Notify of changes - Notify(^^^^AC, Zero) - Notify(^^^^BAT0, Zero) - - Sleep (1000) - - // Reset System76 Device - ^^^^S76D.RSET() - } - } - - Method (_Q0A, 0, NotSerialized) // Touchpad Toggle - { - Debug = "EC: Touchpad Toggle" - } - - Method (_Q0B, 0, NotSerialized) // Screen Toggle - { - Debug = "EC: Screen Toggle" - } - - Method (_Q0C, 0, NotSerialized) // Mute - { - Debug = "EC: Mute" - } - - Method (_Q0D, 0, NotSerialized) // Keyboard Backlight - { - Debug = "EC: Keyboard Backlight" - } - - Method (_Q0E, 0, NotSerialized) // Volume Down - { - Debug = "EC: Volume Down" - } - - Method (_Q0F, 0, NotSerialized) // Volume Up - { - Debug = "EC: Volume Up" - } - - Method (_Q10, 0, NotSerialized) // Switch Video Mode - { - Debug = "EC: Switch Video Mode" - } - - Method (_Q11, 0, NotSerialized) // Brightness Down - { - Debug = "EC: Brightness Down" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (20) - } - } - - Method (_Q12, 0, NotSerialized) // Brightness Up - { - Debug = "EC: Brightness Up" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (19) - } - } - - Method (_Q13, 0, NotSerialized) // Camera Toggle - { - Debug = "EC: Camera Toggle" - } - - Method (_Q14, 0, NotSerialized) // Airplane Mode - { - Debug = "EC: Airplane Mode" - if (^^^^HIDD.HRDY) { - ^^^^HIDD.HPEM (8) - } - // TODO: hardware airplane mode - } - - Method (_Q15, 0, NotSerialized) // Suspend Button - { - Debug = "EC: Suspend Button" - Notify (SLPB, 0x80) - } - - Method (_Q16, 0, NotSerialized) // AC Detect - { - Debug = "EC: AC Detect" - ^^^^AC.ACFG = ADP - Notify (AC, 0x80) // Status Change - Sleep (0x01F4) - If (BAT0) - { - Notify (^^^^BAT0, 0x81) // Information Change - Sleep (0x32) - Notify (^^^^BAT0, 0x80) // Status Change - Sleep (0x32) - } - } - - Method (_Q17, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (17)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q19, 0, NotSerialized) // BAT0 Update - { - Debug = "EC: BAT0 Update (19)" - Notify (^^^^BAT0, 0x81) // Information Change - } - - Method (_Q1B, 0, NotSerialized) // Lid Close - { - Debug = "EC: Lid Close" - Notify (LID0, 0x80) - } - - Method (_Q1C, 0, NotSerialized) // Thermal Trip - { - Debug = "EC: Thermal Trip" - /* TODO - Notify (\_TZ.TZ0, 0x81) // Thermal Trip Point Change - Notify (\_TZ.TZ0, 0x80) // Thermal Status Change - */ - } - - Method (_Q1D, 0, NotSerialized) // Power Button - { - Debug = "EC: Power Button" - Notify (PWRB, 0x80) - } - - Method (_Q50, 0, NotSerialized) // Other Events - { - Local0 = OEM4 - If (Local0 == 0x8A) { - Debug = "EC: White Keyboard Backlight" - Notify (^^^^S76D, 0x80) - } ElseIf (Local0 == 0x9F) { - Debug = "EC: Color Keyboard Toggle" - Notify (^^^^S76D, 0x81) - } ElseIf (Local0 == 0x81) { - Debug = "EC: Color Keyboard Down" - Notify (^^^^S76D, 0x82) - } ElseIf (Local0 == 0x82) { - Debug = "EC: Color Keyboard Up" - Notify (^^^^S76D, 0x83) - } ElseIf (Local0 == 0x80) { - Debug = "EC: Color Keyboard Color Change" - Notify (^^^^S76D, 0x84) - } Else { - Debug = Concatenate("EC: Other: ", ToHexString(Local0)) - } - } -} diff --git a/src/mainboard/system76/whl-u/acpi/ec_ram.asl b/src/mainboard/system76/whl-u/acpi/ec_ram.asl deleted file mode 100644 index d5f97edbd7..0000000000 --- a/src/mainboard/system76/whl-u/acpi/ec_ram.asl +++ /dev/null @@ -1,175 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF) -Field (ERAM, ByteAcc, Lock, Preserve) -{ - NMSG, 8, - SLED, 4, - Offset (0x02), - MODE, 1, - FAN0, 1, - TME0, 1, - TME1, 1, - FAN1, 1, - , 2, - Offset (0x03), - LSTE, 1, - LSW0, 1, - LWKE, 1, - WAKF, 1, - , 2, - PWKE, 1, - MWKE, 1, - AC0, 8, - PSV, 8, - CRT, 8, - TMP, 8, - AC1, 8, - BBST, 8, - Offset (0x0B), - Offset (0x0C), - Offset (0x0D), - Offset (0x0E), - SLPT, 8, - SWEJ, 1, - SWCH, 1, - Offset (0x10), - ADP, 1, - AFLT, 1, - BAT0, 1, - BAT1, 1, - , 3, - PWOF, 1, - WFNO, 8, - BPU0, 32, - BDC0, 32, - BFC0, 32, - BTC0, 32, - BDV0, 32, - BST0, 32, - BPR0, 32, - BRC0, 32, - BPV0, 32, - BTP0, 16, - BRS0, 16, - BCW0, 32, - BCL0, 32, - BCG0, 32, - BG20, 32, - BMO0, 64, - BIF0, 64, - BSN0, 32, - BTY0, 64, - Offset (0x67), - Offset (0x68), - ECOS, 8, - LNXD, 8, - ECPS, 8, - Offset (0x6C), - BTMP, 16, - EVTN, 8, - Offset (0x72), - PRCL, 8, - PRC0, 8, - PRC1, 8, - PRCM, 8, - PRIN, 8, - PSTE, 8, - PCAD, 8, - PEWL, 8, - PWRL, 8, - PECD, 8, - PEHI, 8, - PECI, 8, - PEPL, 8, - PEPM, 8, - PWFC, 8, - PECC, 8, - PDT0, 8, - PDT1, 8, - PDT2, 8, - PDT3, 8, - PRFC, 8, - PRS0, 8, - PRS1, 8, - PRS2, 8, - PRS3, 8, - PRS4, 8, - PRCS, 8, - PEC0, 8, - PEC1, 8, - PEC2, 8, - PEC3, 8, - CMDR, 8, - CVRT, 8, - GTVR, 8, - FANT, 8, - SKNT, 8, - AMBT, 8, - MCRT, 8, - DIM0, 8, - DIM1, 8, - PMAX, 8, - PPDT, 8, - PECH, 8, - PMDT, 8, - TSD0, 8, - TSD1, 8, - TSD2, 8, - TSD3, 8, - CPUP, 16, - MCHP, 16, - SYSP, 16, - CPAP, 16, - MCAP, 16, - SYAP, 16, - CFSP, 16, - CPUE, 16, - Offset (0xC6), - Offset (0xC7), - VGAT, 8, - OEM1, 8, - OEM2, 8, - OEM3, 16, - OEM4, 8, - Offset (0xCE), - DUT1, 8, - DUT2, 8, - RPM1, 16, - RPM2, 16, - RPM4, 16, - Offset (0xD7), - DTHL, 8, - DTBP, 8, - AIRP, 8, - WINF, 8, - RINF, 8, - Offset (0xDD), - INF2, 8, - MUTE, 1, - Offset (0xE0), - RPM3, 16, - ECKS, 8, - Offset (0xE4), - , 4, - XTUF, 1, - EP12, 1, - Offset (0xE5), - INF3, 8, - Offset (0xE7), - GFOF, 8, - Offset (0xE9), - KPCR, 1, - Offset (0xEA), - Offset (0xF0), - PL1T, 16, - PL2T, 16, - TAUT, 8, - Offset (0xF8), - FCMD, 8, - FDAT, 8, - FBUF, 8, - FBF1, 8, - FBF2, 8, - FBF3, 8 -} diff --git a/src/mainboard/system76/whl-u/acpi/hid.asl b/src/mainboard/system76/whl-u/acpi/hid.asl deleted file mode 100644 index ce8fd3f28b..0000000000 --- a/src/mainboard/system76/whl-u/acpi/hid.asl +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (HIDD) -{ - Name (_HID, "INT33D5") - Name (HBSY, Zero) - Name (HIDX, Zero) - Name (HRDY, Zero) - - Method (HDEM, 0, Serialized) - { - HBSY = Zero - Return (HIDX) - } - - Method (HDMM, 0, Serialized) - { - Return (Zero) - } - - Method (HDSM, 1, Serialized) - { - HRDY = Arg0 - } - - Method (HPEM, 1, Serialized) - { - HBSY = One - HIDX = Arg0 - - Notify (HIDD, 0xC0) - Local0 = Zero - While (((Local0 < 0xFA) && HBSY)) - { - Sleep (0x04) - Local0++ - } - - If ((HBSY == One)) - { - HBSY = Zero - HIDX = Zero - Return (One) - } - Else - { - Return (Zero) - } - } -} diff --git a/src/mainboard/system76/whl-u/acpi/lid.asl b/src/mainboard/system76/whl-u/acpi/lid.asl deleted file mode 100644 index ea382eb045..0000000000 --- a/src/mainboard/system76/whl-u/acpi/lid.asl +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -Device (LID0) -{ - Name (_HID, EisaId ("PNP0C0D")) - Name (_PRW, Package () { 0x29 /* GPP_D9 */, 3 }) - - Method (_LID, 0, NotSerialized) { - DEBUG = "LID: _LID" - If (^^PCI0.LPCB.EC0.ECOK) { - Return (^^PCI0.LPCB.EC0.LSTE) - } Else { - Return (One) - } - } - - Method (_PSW, 1, NotSerialized) { - DEBUG = Concatenate("LID: _PSW: ", ToHexString(Arg0)) - If (^^PCI0.LPCB.EC0.ECOK) { - ^^PCI0.LPCB.EC0.LWKE = Arg0 - } - } -} diff --git a/src/mainboard/system76/whl-u/acpi/mainboard.asl b/src/mainboard/system76/whl-u/acpi/mainboard.asl index 06e0e48ffc..a11c0f11f4 100644 --- a/src/mainboard/system76/whl-u/acpi/mainboard.asl +++ b/src/mainboard/system76/whl-u/acpi/mainboard.asl @@ -1,25 +1,26 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#define EC_GPE_SCI 0x50 /* GPP_E16 */ +#define EC_GPE_SWI 0x29 /* GPP_D9 */ + #if defined(CONFIG_BOARD_SYSTEM76_DARP5) - #define COLOR_KEYBOARD 1 + #define EC_COLOR_KEYBOARD 1 #elif defined(CONFIG_BOARD_SYSTEM76_GALP3_C) - #define COLOR_KEYBOARD 0 + #define EC_COLOR_KEYBOARD 0 #else #error Unknown Mainboard #endif +#include Scope (\_SB) { - #include "ac.asl" - #include "battery.asl" - #include "buttons.asl" - #include "hid.asl" - #include "lid.asl" - #include "s76.asl" #include "sleep.asl" + Scope (PCI0) { + #include "backlight.asl" + } +} + +Scope (\_GPE) { + #include "gpe.asl" } #include "tbt.asl" - -Scope (_GPE) { - #include "gpe.asl" -} diff --git a/src/mainboard/system76/whl-u/dsdt.asl b/src/mainboard/system76/whl-u/dsdt.asl index 31cba2df39..eac27b56f1 100644 --- a/src/mainboard/system76/whl-u/dsdt.asl +++ b/src/mainboard/system76/whl-u/dsdt.asl @@ -18,7 +18,6 @@ DefinitionBlock( { #include #include - #include "acpi/backlight.asl" } #include @@ -26,7 +25,6 @@ DefinitionBlock( Scope (\_SB.PCI0.LPCB) { #include - #include "acpi/ec.asl" } #include "acpi/mainboard.asl"