Files
OpenCellular/board/ryu/battery.c
Vic Yang 965e6bd9f9 ryu: Implement battery cut-off
The battery cut-off is achieved by putting BQ27742 in SHUTDOWN mode.

BRANCH=None
BUG=None
TEST=Unplug AC and do 'cutoff' in EC console. The EC console goes
unresponsive.

Change-Id: I4a1aa359d79333d47aaf53b685a52960e5dfd652
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225007
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-10-23 03:32:47 +00:00

39 lines
966 B
C

/* Copyright 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Battery pack vendor provided charging profile
*/
#include "battery.h"
#include "common.h"
#include "i2c.h"
/* Battery temperature ranges in degrees C */
static const struct battery_info info = {
/* Design voltage */
.voltage_max = 4350,
.voltage_normal = 3800,
.voltage_min = 2800,
/* Pre-charge current: I <= 0.01C */
.precharge_current = 64, /* mA */
/* Operational temperature range */
.start_charging_min_c = 0,
.start_charging_max_c = 45,
.charging_min_c = 0,
.charging_max_c = 50,
.discharging_min_c = -20,
.discharging_max_c = 60,
};
const struct battery_info *battery_get_info(void)
{
return &info;
}
int board_cut_off_battery(void)
{
/* Write SET_SHUTDOWN(0x13) to CTRL(0x00) */
return i2c_write16(I2C_PORT_BATTERY, 0xaa, 0x0, 0x13);
}