diff options
-rw-r--r-- | board/cheza/battery.c | 18 | ||||
-rw-r--r-- | board/cheza/board.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/board/cheza/battery.c b/board/cheza/battery.c index cc302a3e1a..69b4eff28a 100644 --- a/board/cheza/battery.c +++ b/board/cheza/battery.c @@ -6,6 +6,11 @@ */ #include "battery.h" +#include "battery_smart.h" + +/* Shutdown mode parameter to write to manufacturer access register */ +#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS +#define SB_SHUTDOWN_DATA 0x0010 /* Battery info for rev-0 */ static const struct battery_info info = { @@ -26,3 +31,16 @@ const struct battery_info *battery_get_info(void) { return &info; } + +int board_cut_off_battery(void) +{ + int rv; + + /* Ship mode command must be sent twice to take effect */ + rv = sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA); + + if (rv != EC_SUCCESS) + return rv; + + return sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA); +} diff --git a/board/cheza/board.h b/board/cheza/board.h index 811dfba33a..9ab1fef92c 100644 --- a/board/cheza/board.h +++ b/board/cheza/board.h @@ -55,6 +55,7 @@ #define CONFIG_EXTPOWER_GPIO /* Battery */ +#define CONFIG_BATTERY_CUT_OFF #define CONFIG_BATTERY_PRESENT_GPIO GPIO_BATT_PRES_ODL #define CONFIG_BATTERY_SMART |