system76/common/peci.c: Do not use PECI when in C10 state and using ESPI

This commit is contained in:
Jeremy Soller 2020-12-29 10:06:06 -07:00 committed by Jeremy Soller
parent 0595ba2b16
commit c3fa2a27a7

View File

@ -1,10 +1,12 @@
// SPDX-License-Identifier: GPL-3.0-only
#include <board/fan.h>
#include <board/gpio.h>
#include <board/peci.h>
#include <board/power.h>
#include <common/debug.h>
#include <common/macro.h>
#include <ec/espi.h>
#include <ec/gpio.h>
#include <ec/pwm.h>
@ -118,9 +120,15 @@ int peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
// PECI information can be found here: https://www.intel.com/content/dam/www/public/us/en/documents/design-guides/core-i7-lga-2011-guide.pdf
void peci_event(void) {
uint8_t duty;
if (power_state == POWER_STATE_S0) {
// Use PECI if in S0 state
#if EC_ESPI
// Use PECI if CPU is not in C10 state
if (gpio_get(&CPU_C10_GATE_N))
#else // EC_ESPI
// Use PECI if in S0 state
if (power_state == POWER_STATE_S0)
#endif // EC_ESPI
{
// Wait for completion
while (HOSTAR & 1) {}
// Clear status