From 0d438a3314a90cfc95430e5e8539e52fcb7667e9 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 24 Feb 2023 11:28:50 -0700 Subject: [PATCH] Make sure power_state is S0 before attempting PECI --- src/board/system76/common/peci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/board/system76/common/peci.c b/src/board/system76/common/peci.c index 8372549..05f3228 100644 --- a/src/board/system76/common/peci.c +++ b/src/board/system76/common/peci.c @@ -65,9 +65,8 @@ void peci_init(void) {} // Returns true if peci is available bool peci_available(void) { - // If ESPI_RESET# (named BUF_PLT_RST_N) is low, PECI is not available - // This is because no ESPI transactions will be possible - if (!gpio_get(&BUF_PLT_RST_N)) return false; + // Power state must be S0 for PECI to be useful + if (power_state != POWER_STATE_S0) return false; // If VW_PLTRST_N virtual wire is not VWS_HIGH, PECI is not available // This is because the CPU has not yet exited reset @@ -228,6 +227,9 @@ void peci_init(void) { // Returns true if peci is available bool peci_available(void) { + // Power state must be S0 for PECI to be useful + if (power_state != POWER_STATE_S0) return false; + // PECI is available if PLTRST# is high return gpio_get(&BUF_PLT_RST_N); }