summaryrefslogtreecommitdiff
path: root/common/battery.c
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2014-04-23 09:50:42 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-23 22:59:51 +0000
commit2e7ea4efdb56af411f13e0224a945a67dd6f0dcb (patch)
treea80a84201c14427adc1acab5a240125563eb0448 /common/battery.c
parentfcf26a43ab1737acc873afcc1b61b4fb20389966 (diff)
downloadchrome-ec-2e7ea4efdb56af411f13e0224a945a67dd6f0dcb.tar.gz
battery: move cut-off commands to common/battery.cstabilize-5791.0.B
So that host and EC commands will be defined in common/battery.c. The board-specific battery.c can focus on the proprietary method. BUG=chrome-os-partner:28248 BRANCH=tot,nyan TEST=make buildall runtest Tested "cutoff" in EC console on big. Change-Id: I213c0d601d0241c8dea309d6ac60c72452d2d100 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/196621 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/battery.c')
-rw-r--r--common/battery.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/battery.c b/common/battery.c
index 25df2e17a3..19ad2e49b8 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -10,6 +10,7 @@
#include "common.h"
#include "console.h"
#include "gpio.h"
+#include "host_command.h"
#include "timer.h"
#include "util.h"
#include "watchdog.h"
@@ -248,3 +249,22 @@ DECLARE_CONSOLE_COMMAND(battery, command_battery,
"<repeat_count> <sleep_ms>",
"Print battery info",
NULL);
+
+
+#ifdef CONFIG_BATTERY_CUT_OFF
+int battery_command_cut_off(struct host_cmd_handler_args *args)
+{
+ return board_cut_off_battery();
+}
+DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off,
+ EC_VER_MASK(0));
+
+static int command_cutoff(int argc, char **argv)
+{
+ return board_cut_off_battery();
+}
+DECLARE_CONSOLE_COMMAND(cutoff, command_cutoff,
+ "",
+ "Cut off the battery output",
+ NULL);
+#endif /* CONFIG_BATTERY_CUT_OFF */