summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-01 03:03:57 +0800
committerChromeBot <chrome-bot@google.com>2013-05-01 14:32:49 -0700
commit041b39d0cd2232a2ed923517635073cae7a2b3f4 (patch)
treee7ee5e60d8a7e719d5c57c9f3da2576db1cf3fd2
parent71be505f3363f2e82225a9869878b98dbb047dbf (diff)
downloadchrome-ec-041b39d0cd2232a2ed923517635073cae7a2b3f4.tar.gz
spring: Implement battery cut-off command
BUG=chrome-os-partner:18818 TEST='ectool batterycutoff' on Spring. BRANCH=spring Original-Change-Id: Idf315562930744ae1e7425d6e15915b0477c2343 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49651 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 8961ef44e4c11b65df5bab93281825d374c87d81) Change-Id: Ia01b29342b7154264eab548f5e03a8ff824600a5 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49785 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/board.h2
-rw-r--r--common/battery_spring.c21
-rw-r--r--common/build.mk1
3 files changed, 23 insertions, 1 deletions
diff --git a/board/spring/board.h b/board/spring/board.h
index 50de094a81..c45b93f8c1 100644
--- a/board/spring/board.h
+++ b/board/spring/board.h
@@ -59,7 +59,7 @@
#define CONFIG_CMD_PMU
/* Battery */
-#define CONFIG_BATTERY_BQ20Z453
+#define CONFIG_BATTERY_SPRING
/* Low battery threshold. In mAh. */
#define BATTERY_AP_OFF_LEVEL 1
diff --git a/common/battery_spring.c b/common/battery_spring.c
new file mode 100644
index 0000000000..28baf58c33
--- /dev/null
+++ b/common/battery_spring.c
@@ -0,0 +1,21 @@
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Smart battery driver for Spring.
+ */
+
+#include "host_command.h"
+#include "smart_battery.h"
+
+#define PARAM_CUT_OFF 0x0010
+
+int battery_command_cut_off(struct host_cmd_handler_args *args)
+{
+ sb_write(SB_MANUFACTURER_ACCESS, PARAM_CUT_OFF);
+ sb_write(SB_MANUFACTURER_ACCESS, PARAM_CUT_OFF);
+
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off,
+ EC_VER_MASK(0));
diff --git a/common/build.mk b/common/build.mk
index 3366e0c254..baa1c39e23 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -11,6 +11,7 @@ common-y+=memory_commands.o shared_mem.o system_common.o hooks.o
common-y+=gpio_commands.o version.o printf.o queue.o
common-$(CONFIG_BATTERY_BQ20Z453)+=battery_bq20z453.o
common-$(CONFIG_BATTERY_LINK)+=battery_link.o
+common-$(CONFIG_BATTERY_SPRING)+=battery_spring.o
common-$(CONFIG_CHARGER_BQ24725)+=charger_bq24725.o
common-$(CONFIG_PMU_TPS65090)+=pmu_tps65090.o pmu_tps65090_charger.o
common-$(CONFIG_EOPTION)+=eoption.o