mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 00:51:29 +00:00
samus: add battery cutoff
Add battery cutoff to samus. BUG=chrome-os-partner:35744 BRANCH=samus TEST=tested "cutoff" console command cuts off battery and "ectool batterycutoff" from host cuts off battery Change-Id: I88194c9c601594dee144933cabef5b1dc536ab0d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/242830 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
0cefc2eeb5
commit
0ef55f5899
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user