diff options
-rw-r--r-- | board/samus_pd/board.c | 5 | ||||
-rw-r--r-- | common/charge_manager.c | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c index cf388c2c7f..6241c313bc 100644 --- a/board/samus_pd/board.c +++ b/board/samus_pd/board.c @@ -496,6 +496,11 @@ void pd_send_host_event(int mask) pd_send_ec_int(); } +int battery_is_cut_off(void) +{ + return 0; /* Always return NOT cut off */ +} + /****************************************************************************/ /* Console commands */ static int command_ec_int(int argc, char **argv) diff --git a/common/charge_manager.c b/common/charge_manager.c index 22ef0e9532..d0660a3031 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -650,6 +650,21 @@ static void charge_manager_get_best_charge_port(int *new_port, } +#ifdef CONFIG_BATTERY + /* + * if no battery present then retain same charge port + * and charge supplier to avoid the port switching + */ + if (charge_port != CHARGE_SUPPLIER_NONE && + charge_port != port && + (battery_is_present() == BP_NO || + (battery_is_present() == BP_YES && + battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL))) { + port = charge_port; + supplier = charge_supplier; + } +#endif + *new_port = port; *new_supplier = supplier; } |