mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 01:21:49 +00:00
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>
This commit is contained in:
@@ -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;
|
||||
rv = sb_write(ELECTRO_SHIP_MODE_REG, ELECTRO_SHIP_MODE_DAT);
|
||||
if (rv != EC_SUCCESS)
|
||||
return rv;
|
||||
|
||||
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;
|
||||
return sb_write(ELECTRO_SHIP_MODE_REG, ELECTRO_SHIP_MODE_DAT);
|
||||
}
|
||||
|
||||
enum battery_disconnect_state battery_get_disconnect_state(void)
|
||||
|
||||
Reference in New Issue
Block a user