summaryrefslogtreecommitdiff
path: root/include/ocpc.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-07-09 11:14:47 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-21 01:34:31 +0000
commit032bbb26f089d6285cf4198442c65c2621294290 (patch)
treed57367e1bcba479758ad63508674aa3e386822bd /include/ocpc.h
parent3e083f33a6739b00ea69ba1387dedfc4af8821a6 (diff)
downloadchrome-ec-032bbb26f089d6285cf4198442c65c2621294290.tar.gz
OCPC: Calculate system & battery resistance
In order to optimize charging from the auxiliary charger, we need to calculate the system resistance as well as the battery resistance. This allows some charger ICs to compensate for the losses from their output node to the battery. In order to perform this calculation, we must do it when the AP is off (or in suspend) which provides the condition that nearly all of the charge current is entering the battery and isn't being largely consumed by the rest of the system. The combined Rsys+Rbatt calculation is relatively straightforward as it's the delta between the VSYS output and the battery voltage divided by the current entering the battery. In order to separate out the two terms, we can look at the delta between the VSYS output and the VSYS node that's connected to the BFET as well as look at the egress current from the auxiliary charger and the current entering the battery. This commit adds this system resistance measurements and enables it for the RAA489000. The resistances are updated in S5/G3 when charging from the auxiliary charger every ~2.4s. BUG=b:148980020 BRANCH=None TEST=Build and flash waddledoo, verify that charging continues to work in all power states and battery can become full. TEST=Verify that charge current is still close to the target without excessively exceeding it. TEST=Verify charging in constant load via `stressapptest`. TEST=Verify charging in bursty workload via `stressapptest` with pauses for power spikes while monitoring charge current with a current probe. TEST=Verify charging works out of battery cutoff from the auxiliary charger. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I1faa3a0b2b3d8f4fd44d72cd1f546226268df0c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2290058 Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include/ocpc.h')
-rw-r--r--include/ocpc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/ocpc.h b/include/ocpc.h
index 6c0dcd7d34..aeec618863 100644
--- a/include/ocpc.h
+++ b/include/ocpc.h
@@ -17,12 +17,17 @@ struct ocpc_data {
int active_chg_chip;
int combined_rsys_rbatt_mo; /* System resistance b/w output and Vbatt */
+ int rsys_mo; /* System resistance b/w output and VSYS node */
+ int rbatt_mo; /* Resistance between VSYS node and battery */
/* ADC values */
int primary_vbus_mv; /* VBUS measured by the primary charger IC */
int primary_ibus_ma; /* IBUS measrued by the primary charger IC */
int secondary_vbus_mv; /* VBUS measured by the secondary charger IC */
int secondary_ibus_ma; /* IBUS measure by the secondary charger IC */
+ int vsys_aux_mv; /* VSYS output measured by aux charger IC */
+ int vsys_mv; /* VSYS measured by main charger IC */
+ int isys_ma; /* Egress current measured by aux charger IC */
/* PID values */
int last_error;