From 041b39d0cd2232a2ed923517635073cae7a2b3f4 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Wed, 1 May 2013 03:03:57 +0800 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/49651 Reviewed-by: Vincent Palatin (cherry picked from commit 8961ef44e4c11b65df5bab93281825d374c87d81) Change-Id: Ia01b29342b7154264eab548f5e03a8ff824600a5 Signed-off-by: Vic Yang Reviewed-on: https://gerrit.chromium.org/gerrit/49785 Reviewed-by: Vincent Palatin --- board/spring/board.h | 2 +- common/battery_spring.c | 21 +++++++++++++++++++++ common/build.mk | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 common/battery_spring.c 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 -- cgit v1.2.1