Skip to content

Commit 08c3b5c

Browse files
authored
Merge pull request #692 from FrameworkComputer/lotus.add_condition_to_avoid_prochot
Add condition to avoid prochot
2 parents d671dc0 + dac1e0e commit 08c3b5c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

zephyr/program/lotus/lotus/src/charger.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,19 @@ void board_check_current(void)
253253
static int curr_status = EC_DEASSERTED_PROCHOT;
254254
static int pre_status = EC_DEASSERTED_PROCHOT;
255255
static int active_port;
256+
static int active_current;
256257
static int pre_active_port;
257258
static int shunt_register;
258259

259260
active_port = charge_manager_get_active_charge_port();
261+
active_current = pd_get_active_current(active_port);
260262

261-
if (active_port == CHARGE_PORT_NONE) {
263+
if (active_port == CHARGE_PORT_NONE || !extpower_is_present()) {
262264
if (pre_active_port != active_port) {
263265
curr_status = EC_DEASSERTED_PROCHOT;
264266
throttle_ap(THROTTLE_OFF, THROTTLE_HARD, THROTTLE_SRC_AC);
265267

268+
pre_status = curr_status;
266269
pre_active_port = active_port;
267270
}
268271
hook_call_deferred(&board_check_current_data, 100 * MSEC);
@@ -274,8 +277,8 @@ void board_check_current(void)
274277
else
275278
shunt_register = 5;
276279

277-
if (ABS(INA2XX_SHUNT_UV(sv) / shunt_register) > pd_get_active_current(active_port)) {
278-
/* Only assert the prochot at EVT phase */
280+
if (ABS(INA2XX_SHUNT_UV(sv) / shunt_register) > active_current &&
281+
(INA2XX_SHUNT_UV(sv) > 0) && (active_current != 0)) {
279282
curr_status = EC_ASSERTED_PROCHOT;
280283
hook_call_deferred(&board_check_current_data, 10 * MSEC);
281284
} else if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {

0 commit comments

Comments
 (0)