addp3: Use virtual wire for calculating power state

This commit is contained in:
Jeremy Soller
2023-02-21 20:06:20 -07:00
parent db10c198b3
commit 55f961406c
2 changed files with 26 additions and 5 deletions

View File

@ -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;

View File

@ -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