summaryrefslogtreecommitdiff
path: root/include/battery.h
diff options
context:
space:
mode:
authorRuben Rodriguez Buchillon <coconutruben@chromium.org>2017-11-28 11:01:47 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-16 04:08:26 -0800
commit51e9e69f386366256807e6f4ccdd258821cdcfe0 (patch)
treec6fc8260505edadf8da3e6e0237a7bc6b3906da3 /include/battery.h
parentbe1f97a2551549d81f77f0439a23683343234c40 (diff)
downloadchrome-ec-51e9e69f386366256807e6f4ccdd258821cdcfe0.tar.gz
power: introducing pwr_avg console command
pwr_avg provides an average voltage, current, and power over the last 1 minute. It's up to the battery drivers to implement this functionality. This change allows us to have better power tracking while minimizing the power impact on the EC, because - the pwr_avg command only needs to be called once every minute, and is short, thus less expensive to parse on ECs without a UART buffer - the work done to keep the avg is partially done by the batteries already and it's just a question of retrieving it. undefined on wheatley since no power debugging planned on that board. usage: > pwr_avg mv = 7153 ma = -605 mw = -4327 BUG=chromium:752320 BRANCH=None TEST=make buildall -j Change-Id: Id1a3479d277aedf90dfa965afb4ee9136654b1cf Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/823884 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/battery.h')
-rw-r--r--include/battery.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/battery.h b/include/battery.h
index 0ccd29319d..43425fcd8c 100644
--- a/include/battery.h
+++ b/include/battery.h
@@ -74,6 +74,16 @@ struct batt_params {
int flags; /* Flags */
};
+/*
+ * Provide a 1 minute average of the current and voltage on the battery.
+ * Does not check for flags or whether those values are bad readings.
+ * See driver/battery/[your_driver].h/c for details on implementation and
+ * how the average is calculated.
+ */
+
+int battery_get_avg_current(void); /* in mA */
+int battery_get_avg_voltage(void); /* in mV */
+
/* Flags for batt_params */
/* Battery wants to be charged */