summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2019-02-15 16:04:39 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-19 22:15:24 -0800
commit06c7c1bff3705fd5e8c8c0bb20a89bbd54d95bb8 (patch)
tree954d001448791f99687d46c24ef7401f551fed7f
parentd6c1c538f904335a20236ff59885d553f91870a8 (diff)
downloadchrome-ec-06c7c1bff3705fd5e8c8c0bb20a89bbd54d95bb8.tar.gz
nocturne: Discharge on AC when changing chg ports
When a charger is plugged in and a higher power charger is plugged into the other port, nocturne will switch to actively charge from the higher power charger. However, during this time, the charger IC is still switching which puts a large load on the input path. While opening the FET to the higher power charger, this load can cause an overcurrent event and some chargers will latch off due to this overcurrent event. This commit simply stops the charger IC from switching while we are switching charge ports. BUG=chromium:926056 BRANCH=firmware-nocturne-10984.B TEST=Flash nocturne, plug in Suzy-Q, verify that DUT is charging, plug in Apple 87W charger, verify DUT switches to Apple charge port and is charging and no overcurrent event is seen. TEST=Hibernate nocturne. Plug in charger, verify that DUT boots and is charging. TEST=Cutoff nocturne. Plug in charger, verify that DUT boots and is charging. Change-Id: I1287c273ad6f7ce7ebfedef6224bd45faa66eb4f Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1474746 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> (cherry picked from commit 7a08e07eb6653422b43ca20bd0760da45564d574) Reviewed-on: https://chromium-review.googlesource.com/1476292 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/nocturne/board.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 20b4b3983b..3b170dd06f 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -703,10 +703,13 @@ int board_set_active_charge_port(int port)
port < CONFIG_USB_PD_PORT_COUNT);
int i;
int rv;
+ int old_port;
if (!is_real_port && port != CHARGE_PORT_NONE)
return EC_ERROR_INVAL;
+ old_port = charge_manager_get_active_charge_port();
+
CPRINTS("New chg p%d", port);
if (port == CHARGE_PORT_NONE) {
@@ -742,12 +745,23 @@ int board_set_active_charge_port(int port)
CPRINTS("p%d: sink path disable failed.", i);
}
+ /*
+ * Stop the charger IC from switching while changing ports. Otherwise,
+ * we can overcurrent the adapter we're switching to. (crbug.com/926056)
+ */
+ if (old_port != CHARGE_PORT_NONE)
+ charger_discharge_on_ac(1);
+
/* Enable requested charge port. */
if (ppc_vbus_sink_enable(port, 1)) {
CPRINTS("p%d: sink path enable failed.");
+ charger_discharge_on_ac(0);
return EC_ERROR_UNKNOWN;
}
+ /* Allow the charger IC to begin/continue switching. */
+ charger_discharge_on_ac(0);
+
return EC_SUCCESS;
}