diff options
author | Ryan Zhang <ryan.zhang.quanta@gmail.com> | 2016-11-09 17:11:07 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-11-14 22:47:44 -0800 |
commit | 7618346aaad71ed03a4e55018a164353359244ba (patch) | |
tree | fa6b5456ec6b32042883ea60a9ff8c4122d92ad5 | |
parent | af848fcce3cd080abe0470be61a15c9c97c5bf5c (diff) | |
download | chrome-ec-7618346aaad71ed03a4e55018a164353359244ba.tar.gz |
Electro: modify battery cutoff command
Follow Banon's setting
BUG=chrome-os-partner:59535
BRANCH=master
TEST=`make -j buildall`, shipping mode works well.
Change-Id: Idf4b253ddb86a82752fca0f872ddb9603dee256c
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/411023
Commit-Ready: Ryan Zhang <ryan.zhang.quanta@gmail.com>
Tested-by: 志偉 黃 <David.Huang@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/reef/battery.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/board/reef/battery.c b/board/reef/battery.c index 112f15372e..9480dfd548 100644 --- a/board/reef/battery.c +++ b/board/reef/battery.c @@ -15,9 +15,8 @@ #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 ELECTRO_SHIP_MODE_REG 0x3a +#define ELECTRO_SHIP_MODE_DAT 0xC574 /* Battery info for BQ40Z55 */ static const struct battery_info info = { @@ -54,21 +53,13 @@ const struct battery_info *battery_get_info(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); - - return rv; + rv = sb_write(ELECTRO_SHIP_MODE_REG, ELECTRO_SHIP_MODE_DAT); + if (rv != EC_SUCCESS) + return rv; + + return sb_write(ELECTRO_SHIP_MODE_REG, ELECTRO_SHIP_MODE_DAT); } enum battery_disconnect_state battery_get_disconnect_state(void) |