summaryrefslogtreecommitdiff
path: root/common/charge_manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/charge_manager.c')
-rw-r--r--common/charge_manager.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 470c20d08c..54ab8f004c 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -203,8 +203,15 @@ static void charge_manager_refresh(void)
while (1) {
charge_manager_get_best_charge_port(&new_port, &new_supplier);
- /* If the port changed, attempt to switch to it */
- if (new_port == charge_port ||
+ /*
+ * If the port or supplier changed, make an attempt to switch to
+ * the port. We will re-set the active port on a supplier change
+ * to give the board-level function another chance to reject
+ * the port, for example, if the port has become a charge
+ * source.
+ */
+ if ((new_port == charge_port &&
+ new_supplier == charge_supplier) ||
board_set_active_charge_port(new_port) == EC_SUCCESS)
break;