diff --git a/src/board/system76/common/peci.c b/src/board/system76/common/peci.c index 9febff0..6800450 100644 --- a/src/board/system76/common/peci.c +++ b/src/board/system76/common/peci.c @@ -245,7 +245,7 @@ uint8_t peci_get_fan_duty(void) { #if CONFIG_BUS_ESPI // Use PECI if CPU is not in C10 sleep state // HOST_C10 virtual wire is high when CPU is in C10 sleep state - peci_on = !vw_get(&VW_HOST_C10); + peci_on = vw_get(&VW_HOST_C10) == VWS_LOW; #else // CONFIG_BUS_ESPI // Use PECI if in S0 state peci_on = power_state == POWER_STATE_S0; diff --git a/src/board/system76/common/power.c b/src/board/system76/common/power.c index 18229f5..1d9e403 100644 --- a/src/board/system76/common/power.c +++ b/src/board/system76/common/power.c @@ -124,17 +124,17 @@ enum PowerState calculate_power_state(void) { #if CONFIG_BUS_ESPI // Use eSPI virtual wires if available - if (vw_get(&VW_SLP_S3_N)) { + if (vw_get(&VW_SLP_S3_N) == VWS_HIGH) { // S3, S4, and S5 planes powered return POWER_STATE_S0; } - if (vw_get(&VW_SLP_S4_N)) { + if (vw_get(&VW_SLP_S4_N) == VWS_HIGH) { // S4 and S5 planes powered return POWER_STATE_S3; } - if (vw_get(&VW_SLP_S5_N)) { + if (vw_get(&VW_SLP_S5_N) == VWS_HIGH) { // S5 plane powered return POWER_STATE_S5; } @@ -341,7 +341,7 @@ void power_set_limit(void) { // We don't use power_state because the latency needs to be low #if CONFIG_BUS_ESPI // HOST_C10 virtual wire is high when CPU is in C10 sleep state - if (!vw_get(&VW_HOST_C10)) { + if (vw_get(&VW_HOST_C10) == VWS_LOW) { #else // CONFIG_BUS_ESPI if (gpio_get(&BUF_PLT_RST_N)) { #endif // CONFIG_BUS_ESPI @@ -578,7 +578,7 @@ void power_event(void) { if (power_state == POWER_STATE_S0) { #if CONFIG_BUS_ESPI // HOST_C10 virtual wire is high when CPU is in C10 sleep state - if (vw_get(&VW_HOST_C10)) { + if (vw_get(&VW_HOST_C10) == VWS_HIGH) { // Modern suspend, flashing green light if ((time - last_time) >= 1000) { gpio_set(&LED_PWR, !gpio_get(&LED_PWR));