From 0e364a685be9a96ca3be033b24a07246cfa08833 Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Wed, 13 Jan 2021 18:21:16 -0800 Subject: 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 Change-Id: Idb6e7d2e51acd0c5279bbb055b75774c6dab6901 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628573 Tested-by: Aseda Aboagye Reviewed-by: Diana Z Commit-Queue: Aseda Aboagye --- common/charge_state_v2.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'common/charge_state_v2.c') diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 56f65003d9..29826e8796 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -2515,11 +2515,6 @@ void charge_set_active_chg_chip(int idx) CPRINTS("Act Chg: %d", idx); curr.ocpc.active_chg_chip = idx; - if (idx == CHARGE_PORT_NONE) { - curr.ocpc.last_error = 0; - curr.ocpc.integral = 0; - curr.ocpc.last_vsys = OCPC_UNINIT; - } } #endif /* CONFIG_OCPC */ @@ -2576,6 +2571,13 @@ void charge_reset_stable_current(void) } #endif +#ifdef CONFIG_OCPC +void trigger_ocpc_reset(void) +{ + ocpc_reset(&curr.ocpc); +} +#endif + /*****************************************************************************/ /* Host commands */ -- cgit v1.2.1