diff --git a/chip/lm4/switch.c b/chip/lm4/switch.c index 237f130712..5c08ee4575 100644 --- a/chip/lm4/switch.c +++ b/chip/lm4/switch.c @@ -373,8 +373,10 @@ static void state_machine(uint64_t tnow) * Otherwise we could power on the AP only to shut it right * back down due to insufficient battery. */ +#ifdef CONFIG_TASK_CHARGER if (charge_get_state() == PWR_STATE_INIT) break; +#endif /* * Power the system on if possible. Gating due to insufficient diff --git a/include/charge_state.h b/include/charge_state.h index e55a7c529c..68ae1d08b4 100644 --- a/include/charge_state.h +++ b/include/charge_state.h @@ -146,7 +146,10 @@ int charge_get_percent(void); /** * Return non-zero if discharging and battery so low we should shut down. */ +#ifdef CONFIG_TASK_CHARGER int charge_want_shutdown(void); - +#else +static inline int charge_want_shutdown(void) { return 0; } +#endif #endif /* __CROS_EC_CHARGE_STATE_H */