diff options
-rw-r--r-- | board/samus/board.h | 1 | ||||
-rw-r--r-- | driver/battery/samus.c | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/board/samus/board.h b/board/samus/board.h index cd17381767..da51e73631 100644 --- a/board/samus/board.h +++ b/board/samus/board.h @@ -24,6 +24,7 @@ #define CONFIG_CMD_ACCEL_INFO #undef CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT #define CONFIG_BATTERY_CRITICAL_SHUTDOWN_TIMEOUT 60 +#define CONFIG_BATTERY_CUT_OFF #define CONFIG_POWER_COMMON #define CONFIG_CHIPSET_CAN_THROTTLE #define CONFIG_KEYBOARD_BOARD_CONFIG diff --git a/driver/battery/samus.c b/driver/battery/samus.c index 89f6dc9b68..88ee48310d 100644 --- a/driver/battery/samus.c +++ b/driver/battery/samus.c @@ -10,6 +10,7 @@ #include "console.h" #include "ec_commands.h" #include "extpower.h" +#include "i2c.h" #include "util.h" static const struct battery_info info = { @@ -220,3 +221,26 @@ enum battery_disconnect_state battery_get_disconnect_state(void) return BATTERY_NOT_DISCONNECTED; } #endif /* CONFIG_BATTERY_REVIVE_DISCONNECT */ + +#define PARAM_CUT_OFF_LOW 0x10 +#define PARAM_CUT_OFF_HIGH 0x00 + +int board_cut_off_battery(void) +{ + int rv; + uint8_t buf[3]; + + 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; +} + |