summaryrefslogtreecommitdiff
path: root/common/charge_manager.c
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-01-07 14:04:47 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-13 21:58:50 +0000
commita13309c180c2402adb9a0fdc24c8e7d89f74cbcf (patch)
tree0ba26aaa7dcef3eba68b57abc23efeb7423c528a /common/charge_manager.c
parentf352aae8b42fafaf8b468f932a7fee214c2a7c45 (diff)
downloadchrome-ec-a13309c180c2402adb9a0fdc24c8e7d89f74cbcf.tar.gz
charge_manager: Re-set the active port if the active supplier changes
If we're charging on a port and the active port supplier changes, it is an indication of a significant change. Re-set the port as active, to give the board-level function an opportunity to reject the port, in case charging is untenable. BUG=None TEST=Manual on Samus. Plug Zinger, verify that 20V is negotiated correctly. BRANCH=Samus Change-Id: I4a530d5bab510498dd9b30f141208ce33b52ef6b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/239250 Reviewed-by: Alec Berg <alecaberg@chromium.org>
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;