diff --git a/src/board/system76/addp3/include/board/gpio.h b/src/board/system76/addp3/include/board/gpio.h index 080be9e..e94b71d 100644 --- a/src/board/system76/addp3/include/board/gpio.h +++ b/src/board/system76/addp3/include/board/gpio.h @@ -34,10 +34,10 @@ extern struct Gpio __code PWR_BTN_N; extern struct Gpio __code PWR_SW_N; extern struct Gpio __code SLP_SUS_N; #define HAVE_SUS_PWR_ACK 0 -extern struct Gpio __code SUSB_N_PCH; -extern struct Gpio __code SUSC_N_PCH; +#define HAVE_SUSB_N_PCH 0 +#define HAVE_SUSC_N_PCH 0 extern struct Gpio __code VA_EC_EN; -extern struct Gpio __code WLAN_EN; +#define HAVE_WLAN_EN 0 extern struct Gpio __code WLAN_PWR_EN; extern struct Gpio __code XLP_OUT; diff --git a/src/board/system76/common/power.c b/src/board/system76/common/power.c index 08fc2d0..216425c 100644 --- a/src/board/system76/common/power.c +++ b/src/board/system76/common/power.c @@ -64,9 +64,14 @@ #define HAVE_SLP_SUS_N 1 #endif -#ifndef HAVE_XLP_OUT -#define HAVE_XLP_OUT 1 +#ifndef HAVE_SUSB_N_PCH +#define HAVE_SUSB_N_PCH 1 #endif + +#ifndef HAVE_SUSC_N_PCH +#define HAVE_SUSC_N_PCH 1 +#endif + #ifndef HAVE_SUSWARN_N #define HAVE_SUSWARN_N 1 #endif @@ -128,15 +133,31 @@ enum PowerState power_state = POWER_STATE_OFF; enum PowerState calculate_power_state(void) { //TODO: Deep Sx states using SLP_SUS# +#if HAVE_SUSB_N_PCH if (gpio_get(&SUSB_N_PCH)) { // S3, S4, and S5 planes powered return POWER_STATE_S0; } +#else + // Use eSPI virtual wire if there is no dedicated GPIO + if (vw_get(&VW_SLP_S3_N)) { + // S3, S4, and S5 planes powered + return POWER_STATE_S0; + } +#endif +#if HAVE_SUSC_N_PCH if (gpio_get(&SUSC_N_PCH)) { // S4 and S5 planes powered return POWER_STATE_S3; } +#else + // Use eSPI virtual wire if there is no dedicated GPIO + if (vw_get(&VW_SLP_S4_N)) { + // S4 and S5 planes powered + return POWER_STATE_S3; + } +#endif if (gpio_get(&EC_RSMRST_N)) { // S5 plane powered