diff options
author | Philip Chen <philipchen@google.com> | 2017-07-19 18:38:24 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-07-27 15:44:01 -0700 |
commit | e8812717f7f5879ea6c258f01e4c8ed6adf53b5b (patch) | |
tree | 088288eee9a690835c50fbf5d0c6af535f0448c4 /board/scarlet/battery.c | |
parent | 19bd0659b3f4c00c9826b3b0005649f8f716d32a (diff) | |
download | chrome-ec-e8812717f7f5879ea6c258f01e4c8ed6adf53b5b.tar.gz |
scarlet: Add max17055 fuel gauge for rev1 board
BUG=b:63870414
BRANCH=none
TEST=build scarlet, and test
battery console command on scarlet rev0
Change-Id: I58171058d70a94734ce69cac860f8a1849083dfb
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/578301
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board/scarlet/battery.c')
-rw-r--r-- | board/scarlet/battery.c | 67 |
1 files changed, 9 insertions, 58 deletions
diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c index 03bcfc3a5e..e27d547a71 100644 --- a/board/scarlet/battery.c +++ b/board/scarlet/battery.c @@ -14,20 +14,17 @@ #include "extpower.h" #include "util.h" -/* Shutdown mode parameter to write to manufacturer access register */ -#define SB_SHUTDOWN_DATA 0x0010 - static const struct battery_info info = { - .voltage_max = 8688, /* 8700mA, round down for chg reg */ - .voltage_normal = 7600, - .voltage_min = 5800, - .precharge_current = 256, + .voltage_max = 4350, + .voltage_normal = 3800, + .voltage_min = 3000, + .precharge_current = 700, .start_charging_min_c = 0, - .start_charging_max_c = 50, + .start_charging_max_c = 45, .charging_min_c = 0, - .charging_max_c = 50, + .charging_max_c = 45, .discharging_min_c = -20, - .discharging_max_c = 60, + .discharging_max_c = 55, }; const struct battery_info *battery_get_info(void) @@ -35,15 +32,6 @@ const struct battery_info *battery_get_info(void) return &info; } -/* - * Just a placeholder. - * TODO(philipchen): Implement this function in MAX17055 driver. - */ -enum battery_present battery_is_present(void) -{ - return BP_YES; -} - int board_cut_off_battery(void) { return rt946x_cutoff_battery(); @@ -51,46 +39,9 @@ int board_cut_off_battery(void) enum battery_disconnect_state battery_get_disconnect_state(void) { - uint8_t data[6]; - int rv; - - /* - * Take note if we find that the battery isn't in disconnect state, - * and always return NOT_DISCONNECTED without probing the battery. - * This assumes the battery will not go to disconnect state during - * runtime. - */ - static int not_disconnected; - - if (not_disconnected) + if (battery_is_present() == BP_YES) return BATTERY_NOT_DISCONNECTED; - - if (extpower_is_present()) { - /* Check if battery charging + discharging is disabled. */ - rv = sb_read_mfgacc(PARAM_OPERATION_STATUS, - SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data)); - if (rv) - return BATTERY_DISCONNECT_ERROR; - if (~data[3] & (BATTERY_DISCHARGING_DISABLED | - BATTERY_CHARGING_DISABLED)) { - not_disconnected = 1; - return BATTERY_NOT_DISCONNECTED; - } - - /* - * Battery is neither charging nor discharging. Verify that - * we didn't enter this state due to a safety fault. - */ - rv = sb_read_mfgacc(PARAM_SAFETY_STATUS, - SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data)); - if (rv || data[2] || data[3] || data[4] || data[5]) - return BATTERY_DISCONNECT_ERROR; - - /* No safety fault, battery is disconnected */ - return BATTERY_DISCONNECTED; - } - not_disconnected = 1; - return BATTERY_NOT_DISCONNECTED; + return BATTERY_DISCONNECTED; } int charger_profile_override(struct charge_state_data *curr) |