diff options
Diffstat (limited to 'board/reef_it8320/battery.c')
-rw-r--r-- | board/reef_it8320/battery.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/board/reef_it8320/battery.c b/board/reef_it8320/battery.c index 1b16a672b2..f03000f3c7 100644 --- a/board/reef_it8320/battery.c +++ b/board/reef_it8320/battery.c @@ -1,4 +1,4 @@ -/* Copyright 2017 The Chromium OS Authors. All rights reserved. +/* Copyright 2017 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -20,7 +20,7 @@ #include "i2c.h" #include "util.h" -#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) +#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args) enum battery_type { BATTERY_SONY_CORP, @@ -135,7 +135,7 @@ const struct battery_info batt_info_smp_cos4870 = { * unwanted low VSYS_Prochot# assertion can be avoided. */ .voltage_min = 6100, - .precharge_current = 256, /* mA */ + .precharge_current = 256, /* mA */ .start_charging_min_c = 0, .start_charging_max_c = 46, .charging_min_c = 0, @@ -183,7 +183,7 @@ const struct battery_info batt_info_sonycorp = { * unwanted low VSYS_Prochot# assertion can be avoided. */ .voltage_min = 6100, - .precharge_current = 256, /* mA */ + .precharge_current = 256, /* mA */ .start_charging_min_c = 0, .start_charging_max_c = 50, .charging_min_c = 0, @@ -240,7 +240,7 @@ const struct battery_info batt_info_panasoic = { * unwanted low VSYS_Prochot# assertion can be avoided. */ .voltage_min = 6100, - .precharge_current = 256, /* mA */ + .precharge_current = 256, /* mA */ .start_charging_min_c = 0, .start_charging_max_c = 50, .charging_min_c = 0, @@ -384,7 +384,7 @@ const struct battery_info batt_info_c22n1626 = { * unwanted low VSYS_Prochot# assertion can be avoided. */ .voltage_min = 6100, - .precharge_current = 256, /* mA */ + .precharge_current = 256, /* mA */ .start_charging_min_c = 0, .start_charging_max_c = 45, .charging_min_c = 0, @@ -398,7 +398,7 @@ static int batt_smp_cos4870_init(void) int batt_status; return battery_status(&batt_status) ? 0 : - batt_status & STATUS_INITIALIZED; + batt_status & STATUS_INITIALIZED; } static int batt_sony_corp_init(void) @@ -411,8 +411,9 @@ static int batt_sony_corp_init(void) * : 0b - Allowed to Discharge * : 1b - Not Allowed to Discharge */ - return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 : - !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT); + return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? + 0 : + !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT); } static int batt_panasonic_init(void) @@ -425,8 +426,9 @@ static int batt_panasonic_init(void) * : 0b - Not Allowed to Discharge * : 1b - Allowed to Discharge */ - return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 : - !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT); + return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? + 0 : + !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT); } static int batt_c22n1626_init(void) @@ -439,8 +441,9 @@ static int batt_c22n1626_init(void) * : 0b - Not Allowed to Discharge * : 1b - Allowed to Discharge */ - return sb_read(SB_PACK_STATUS, &batt_status) ? 0 : - !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT); + return sb_read(SB_PACK_STATUS, &batt_status) ? + 0 : + !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT); } static const struct ship_mode_info ship_mode_info_smp_cos4870 = { @@ -513,7 +516,8 @@ BUILD_ASSERT(ARRAY_SIZE(info) == BATTERY_TYPE_COUNT); static inline const struct board_batt_params *board_get_batt_params(void) { return &info[board_battery_type == BATTERY_TYPE_COUNT ? - DEFAULT_BATTERY_TYPE : board_battery_type]; + DEFAULT_BATTERY_TYPE : + board_battery_type]; } enum battery_present battery_hw_present(void) @@ -540,8 +544,9 @@ static int board_get_battery_type(void) /* Initialize fast charging parameters */ chg_params = board_get_batt_params()->fast_chg_params; - prev_chg_profile_info = &chg_params->chg_profile_info[ - chg_params->default_temp_range_profile]; + prev_chg_profile_info = + &chg_params->chg_profile_info + [chg_params->default_temp_range_profile]; return board_battery_type; } @@ -571,11 +576,11 @@ int board_cut_off_battery(void) { int rv; const struct ship_mode_info *ship_mode_inf = - board_get_batt_params()->ship_mode_inf; + board_get_batt_params()->ship_mode_inf; /* Ship mode command must be sent twice to take effect */ rv = sb_write(ship_mode_inf->ship_mode_reg, - ship_mode_inf->ship_mode_data); + ship_mode_inf->ship_mode_data); if (rv != EC_SUCCESS) return rv; @@ -591,7 +596,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr) /* Do not discharge on AC if the battery is still waking up */ if (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) && - !(curr->batt.status & STATUS_FULLY_CHARGED)) + !(curr->batt.status & STATUS_FULLY_CHARGED)) return 0; /* @@ -608,8 +613,8 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr) * and suspend USB charging and DC/DC converter. */ if (!battery_is_cut_off() && - !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) && - (curr->batt.status & STATUS_FULLY_CHARGED)) + !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) && + (curr->batt.status & STATUS_FULLY_CHARGED)) return 1; /* @@ -642,10 +647,10 @@ int charger_profile_override(struct charge_state_data *curr) return 0; } - return charger_profile_override_common(curr, - board_get_batt_params()->fast_chg_params, - &prev_chg_profile_info, - board_get_batt_params()->batt_info->voltage_max); + return charger_profile_override_common( + curr, board_get_batt_params()->fast_chg_params, + &prev_chg_profile_info, + board_get_batt_params()->batt_info->voltage_max); } /* @@ -671,7 +676,7 @@ enum battery_present battery_is_present(void) * Battery status will be inactive until it is initialized. */ if (batt_pres == BP_YES && batt_pres_prev != batt_pres && - !battery_is_cut_off()) { + !battery_is_cut_off()) { /* Re-init board battery if battery presence status changes */ if (board_get_battery_type() == BATTERY_TYPE_COUNT) { if (bd9995x_get_battery_voltage() >= |