summaryrefslogtreecommitdiff
path: root/include/charger.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-03-10 18:59:35 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-11 20:11:44 +0000
commit7ad578bfb93e995b59841417f98dc693fa81e9a3 (patch)
tree1945f29c920ee0680e8c8cd9853be162c2f2266c /include/charger.h
parente8cb700579e12ddb0c0f2cda784f04adb6de40f8 (diff)
downloadchrome-ec-7ad578bfb93e995b59841417f98dc693fa81e9a3.tar.gz
charger: Add new APIs for measured charge values
Some of the charger ICs can provide measurements for the charge voltage and the charge current. This information is needed by the OCPC module. Previously, the charge_get_current() and charge_get_voltage() functions were modified to provide this information. However, those functions are intended to provide the set voltage and current targets for the charger IC. This commit adds a new set of APIs, charge_get_actual_current() and charge_get_actual_voltage() which provides the actual charge current and voltage if the charger IC is able to provide that information. BUG=b:182018616 BRANCH=dedede TEST=Build and flash madoo, verify that `charger` EC console command shows the set current and voltage targets instead of the measured values. Check that the `chgstate` command shows the measured values for use with the OCPC module. TEST=Verify that charging from the sub board works. TEST=Verify that resistances are still calculated and seem reasonable. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I82565d18908d9ea0f54934787897937488e280e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2750866 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include/charger.h')
-rw-r--r--include/charger.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/charger.h b/include/charger.h
index d8d62c1e9b..402f9eca73 100644
--- a/include/charger.h
+++ b/include/charger.h
@@ -85,6 +85,12 @@ struct charger_drv {
enum ec_error_list (*get_voltage)(int chgnum, int *voltage);
enum ec_error_list (*set_voltage)(int chgnum, int voltage);
+
+ /* Get the measured charge current and voltage in mA/mV */
+ enum ec_error_list (*get_actual_current)(int chgnum, int *current);
+ enum ec_error_list (*get_actual_voltage)(int chgnum, int *voltage);
+
+
/* Discharge battery when on AC power. */
enum ec_error_list (*discharge_on_ac)(int chgnum, int enable);
@@ -250,6 +256,10 @@ enum ec_error_list charger_set_current(int chgnum, int current);
enum ec_error_list charger_get_voltage(int chgnum, int *voltage);
enum ec_error_list charger_set_voltage(int chgnum, int voltage);
+/* Get the measured charge current and voltage in mA/mV */
+enum ec_error_list charger_get_actual_current(int chgnum, int *current);
+enum ec_error_list charger_get_actual_voltage(int chgnum, int *voltage);
+
/* Discharge battery when on AC power. */
enum ec_error_list charger_discharge_on_ac(int enable);