summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-04-23 14:02:39 -0700
committerCommit Bot <commit-bot@chromium.org>2021-04-27 19:26:38 +0000
commitb0e85f04fa46113163c059ccf86f85e5bfe152c4 (patch)
tree43ba0e2535cce6d2af2f750a76d7f60ce2db6f83
parent64a958827240c03d3096c60cf44882854464e340 (diff)
downloadchrome-ec-b0e85f04fa46113163c059ccf86f85e5bfe152c4.tar.gz
usb_pe_drp: Consider CHARGE_PORT_NONE for HardRst
When we arrive in the EC image without a battery and with a PD supplier, we would eventually consider sending a HardReset since we are expecting SourceCaps to be sent by the port partner. However, since we no longer maintain our contract across images and we would like for the board to not brown out, we avoid sending the HardReset and simply disable the port instead. However, this situation can occur before we decide on a charge port. Therefore, this commit simply adds another condition when deciding to skip sending the HardReset. If a battery is not present, but there's no active charge port, we must be running on AC somehow so don't send the HardReset as this port may in fact be the previous charge port. BUG=b:176214112,b:178728138 BRANCH=dedede TEST=Build and flash galith; plug in charger on C1, remove battery, sysjump between RO and RW many times, verify that SoC remains in S0. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I16054d9c1ddac780243524e23a656ba3770bb4a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2848290 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2854422 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--common/usbc/usb_pe_drp_sm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 5c5e107333..1d7600a49e 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -3529,17 +3529,21 @@ static void pe_snk_hard_reset_entry(int port)
}
/*
- * If we're about to kill our active charge port and have no battery
- * to supply power, disable the PE layer instead.
+ * If we're about to kill our active charge port and have no battery to
+ * supply power, disable the PE layer instead. If we have no battery,
+ * but we haven't determined our active charge port yet, also avoid
+ * performing the HardReset. It might be that this port was our active
+ * charge port.
*
* Note: On systems without batteries (ex. chromeboxes), it's preferable
* to brown out rather than leave the port only semi-functional for a
- * customer. For systems which should have a battery, this condition
- * is not expected to be encountered by a customer.
+ * customer. For systems which should have a battery, this condition is
+ * not expected to be encountered by a customer.
*/
if (IS_ENABLED(CONFIG_BATTERY) && (battery_is_present() == BP_NO) &&
IS_ENABLED(CONFIG_CHARGE_MANAGER) &&
- (port == charge_manager_get_active_charge_port()) &&
+ ((port == charge_manager_get_active_charge_port() ||
+ (charge_manager_get_active_charge_port() == CHARGE_PORT_NONE))) &&
system_get_reset_flags() & EC_RESET_FLAG_SYSJUMP) {
CPRINTS("C%d: Disabling port to avoid brown out, "
"please reboot EC to enable port again", port);