summaryrefslogtreecommitdiff
path: root/common/charge_state_v2.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-12-04 13:59:46 -0800
committerCommit Bot <commit-bot@chromium.org>2020-12-10 00:47:38 +0000
commitc9d96b69410f496d4aea21bce5ef4cef9b0fd5fa (patch)
tree424d12a2113fe5187b9755482eba44c6c30b963c /common/charge_state_v2.c
parent868c16a6257bac63079304b4e83d75083dabd5f6 (diff)
downloadchrome-ec-c9d96b69410f496d4aea21bce5ef4cef9b0fd5fa.tar.gz
chgstv2: OCPC: Don't always touch primary charger
On OCPC systems, when charging from an auxiliary charge port, we should not unconditionally touch the primary charger as the charger drivers may have configured the primary charger in a specific way depending on the charging phase occurring. This commit simply has the charger task not always touch the primary charger when a charge_request comes in on OCPC systems. BUG=b:174167890 BRANCH=dedede TEST=Build and flash drawcia, discharge battery until DFET is disabled, plug in 45W charger on sub-board, verify that precharge currents are applied and when the battery requests a fast charge current, the current is maintained at the precharge current level for a few seconds. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I9d74bd8369ca0c5f6434ac5ec2c22bbbb2c11560 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575838 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/charge_state_v2.c')
-rw-r--r--common/charge_state_v2.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 409d484dae..e4c9441f13 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1251,8 +1251,17 @@ static int charge_request(int voltage, int current)
* up. This helps avoid large current spikes when connecting
* battery.
*/
- if (current >= 0)
- r2 = charger_set_current(0, current);
+ if (current >= 0) {
+#ifdef CONFIG_OCPC
+ /*
+ * For OCPC systems, don't unconditionally modify the primary
+ * charger IC's charge current. It may be handled by the
+ * charger drivers directly.
+ */
+ if (curr.ocpc.active_chg_chip == CHARGER_PRIMARY)
+#endif
+ r2 = charger_set_current(0, current);
+ }
if (r2 != EC_SUCCESS)
problem(PR_SET_CURRENT, r2);