power: Remove last AC check from power_set_limit
Unconditionally set the power limit based on the current AC state when power_set_limit is called. The contional logic to run it only on ACIN# state change is already done in power_event. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
a198289695
commit
568fae6aba
@@ -327,16 +327,9 @@ static bool power_peci_limit(bool ac) {
|
|||||||
|
|
||||||
// Set the power draw limit depending on if on AC or DC power
|
// Set the power draw limit depending on if on AC or DC power
|
||||||
void power_set_limit(void) {
|
void power_set_limit(void) {
|
||||||
static bool last_power_limit_ac = true;
|
|
||||||
if (peci_available()) {
|
if (peci_available()) {
|
||||||
bool ac = !gpio_get(&ACIN_N);
|
bool ac = !gpio_get(&ACIN_N);
|
||||||
if (last_power_limit_ac != ac) {
|
power_peci_limit(ac);
|
||||||
if (power_peci_limit(ac)) {
|
|
||||||
last_power_limit_ac = ac;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
last_power_limit_ac = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // HAVE_DGPU
|
#else // HAVE_DGPU
|
||||||
|
Reference in New Issue
Block a user