summaryrefslogtreecommitdiff
path: root/common/charger.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-05-14 12:13:08 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-15 05:28:08 +0000
commit65df2fd6e444f6655838d55af63de59e699238a2 (patch)
tree8049186891b2509a1bced4d30cf4ba15b238d54c /common/charger.c
parent10aecec841361727e7ed8f16a13e0d7a575e77ff (diff)
downloadchrome-ec-65df2fd6e444f6655838d55af63de59e699238a2.tar.gz
Add "debug" option to charge_state_v2.c
This is useful for testing battery charge profiles. When enabled, a dump of all battery, charger, and charge state information will be printed whenever the battery charge percentage changes. BUG=none BRANCH=ToT TEST=make buildall -j On the EC console: chg debug on then watch the console while either charging or discharging the battery. Disable with chg debug off Change-Id: I6725c461461f90fcd812873f97490e980ab47bc6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199816 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common/charger.c')
-rw-r--r--common/charger.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/charger.c b/common/charger.c
index 8a07a62818..36d81fd3d0 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -5,6 +5,7 @@
* Common functions for battery charging.
*/
+#include "battery_smart.h"
#include "charger.h"
#include "common.h"
#include "console.h"
@@ -114,7 +115,7 @@ static int check_print_error(int rv)
return 0;
}
-static int print_info(void)
+void print_charger_debug(void)
{
int d;
const struct charger_info *info = charger_get_info();
@@ -165,8 +166,6 @@ static int print_info(void)
ccprintf("%5d\n", dptf_limit_ma);
else
ccputs("disabled\n");
-
- return EC_SUCCESS;
}
static int command_charger(int argc, char **argv)
@@ -174,8 +173,10 @@ static int command_charger(int argc, char **argv)
int d;
char *e;
- if (argc != 3)
- return print_info();
+ if (argc != 3) {
+ print_charger_debug();
+ return EC_SUCCESS;
+ }
if (strcasecmp(argv[1], "input") == 0) {
d = strtoi(argv[2], &e, 0);