summaryrefslogtreecommitdiff
path: root/common/charge_manager.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-01-13 18:21:16 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-21 21:37:51 +0000
commit0e364a685be9a96ca3be033b24a07246cfa08833 (patch)
treea829ef4e138e7d0fb9243df5ed511c4e87a541d8 /common/charge_manager.c
parent080a1be650c45744cd430b194b8a4a5601a9286c (diff)
downloadchrome-ec-0e364a685be9a96ca3be033b24a07246cfa08833.tar.gz
OCPC: Init VSYS to VBAT when starting charge
In order to prevent high current spikes when the OCPC PID loop runs, this commit sets the initial VSYS voltage to that of the battery. BUG=b:175334490 BRANCH=dedede TEST=Build and flash DUT. Using a Type-C breakout board and a current probe, plug in charger to sub board, verify that no initial current spike exceeds that of the contract. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Idb6e7d2e51acd0c5279bbb055b75774c6dab6901 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628573 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/charge_manager.c')
-rw-r--r--common/charge_manager.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 476e5c9a36..368daff0a0 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -699,10 +699,21 @@ static void charge_manager_refresh(void)
* the port, for example, if the port has become a charge
* source.
*/
- if ((active_charge_port_initialized &&
+ if (active_charge_port_initialized &&
new_port == charge_port &&
- new_supplier == charge_supplier) ||
- board_set_active_charge_port(new_port) == EC_SUCCESS)
+ new_supplier == charge_supplier)
+ break;
+
+ /*
+ * For OCPC systems, reset the OCPC state to prevent current
+ * spikes.
+ */
+ if (IS_ENABLED(CONFIG_OCPC)) {
+ charge_set_active_chg_chip(new_port);
+ trigger_ocpc_reset();
+ }
+
+ if (board_set_active_charge_port(new_port) == EC_SUCCESS)
break;
/* 'Dont charge' request must be accepted. */
@@ -720,10 +731,6 @@ static void charge_manager_refresh(void)
active_charge_port_initialized = 1;
- /* Set the active charger chip based upon the selected charge port. */
- if (IS_ENABLED(CONFIG_OCPC))
- charge_set_active_chg_chip(new_port);
-
/*
* Clear override if it wasn't selected as the 'best' port -- it means
* that no charge is available on the port, or the port was rejected.