summaryrefslogtreecommitdiff
path: root/board/elm
diff options
context:
space:
mode:
authorDavid Huang <David.Huang@quantatw.com>2016-04-21 19:43:32 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-04-21 19:46:41 -0700
commit4f0ab3118496b9c4dc74df9e1d62f82d0f0db9f1 (patch)
tree9f0ae5a726520455bc387858d40c905d75fb46d0 /board/elm
parentc65700730d07dfd6813b5c74c6bbece218d8c3d7 (diff)
downloadchrome-ec-4f0ab3118496b9c4dc74df9e1d62f82d0f0db9f1.tar.gz
elm: Modify battery cutoff command
Modify battery cutoff command for EVT BRANCH=elm BUG=chrome-os-partner:52548 TEST=Use "ectool batterycutoff" to check battery enter shipmode. Change-Id: Ia0c620f95d6e94ec658f92c5b56cbab3ae964848 Signed-off-by: David Huang <David.Huang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/340168 Commit-Ready: 志偉 黃 <David.Huang@quantatw.com> Tested-by: Koro Chen <koro.chen@mediatek.com> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board/elm')
-rw-r--r--board/elm/battery.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/board/elm/battery.c b/board/elm/battery.c
index da1359440a..4be0462efd 100644
--- a/board/elm/battery.c
+++ b/board/elm/battery.c
@@ -7,12 +7,11 @@
#include "battery.h"
#include "battery_smart.h"
-#include "i2c.h"
#include "util.h"
/* Shutdown mode parameter to write to manufacturer access register */
-#define PARAM_CUT_OFF_LOW 0x10
-#define PARAM_CUT_OFF_HIGH 0x00
+#define SB_SHIP_MODE_REG 0x3a
+#define SB_SHUTDOWN_DATA 0xC574
static const struct battery_info info = {
.voltage_max = 13050,
@@ -39,27 +38,15 @@ const struct battery_info *battery_get_info(void)
return &info;
}
-static int cutoff(void)
+int board_cut_off_battery(void)
{
int rv;
- uint8_t buf[3];
/* Ship mode command must be sent twice to take effect */
- buf[0] = SB_MANUFACTURER_ACCESS & 0xff;
- buf[1] = PARAM_CUT_OFF_LOW;
- buf[2] = PARAM_CUT_OFF_HIGH;
-
- i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
- rv |= i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR, buf, 3, NULL, 0,
- I2C_XFER_SINGLE);
- i2c_lock(I2C_PORT_BATTERY, 0);
+ rv = sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA);
- return rv;
-}
+ if (rv != EC_SUCCESS)
+ return rv;
-int board_cut_off_battery(void)
-{
- return cutoff();
+ return sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA);
}