Replace magic numbers with #defines for charger bq24773.c

BUG=none
BRANCH=none
TEST=buildall -j

Change-Id: I125fbe7716f6c8b78011c3a39745ec4992074795
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199796
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
Bill Richardson
2014-05-14 10:58:08 -07:00
committed by chrome-internal-fetch
parent c46f569a39
commit 10aecec841
2 changed files with 25 additions and 9 deletions

View File

@@ -32,15 +32,15 @@
/* Charger parameters */
static const struct charger_info bq24773_charger_info = {
.name = "bq24773",
.voltage_max = 19200,
.voltage_min = 1024,
.voltage_step = 16,
.current_max = REG_TO_CURRENT(0x1FC0, R_SNS),
.current_min = REG_TO_CURRENT(128, R_SNS),
.current_step = REG_TO_CURRENT(64, R_SNS),
.input_current_max = REG8_TO_CURRENT(0x7F, R_AC),
.input_current_min = REG8_TO_CURRENT(2, R_AC),
.input_current_step = REG8_TO_CURRENT(1, R_AC),
.voltage_max = CHARGE_V_MAX,
.voltage_min = CHARGE_V_MIN,
.voltage_step = CHARGE_V_STEP,
.current_max = REG_TO_CURRENT(CHARGE_I_MAX, R_SNS),
.current_min = REG_TO_CURRENT(CHARGE_I_MIN, R_SNS),
.current_step = REG_TO_CURRENT(CHARGE_I_STEP, R_SNS),
.input_current_max = REG_TO_CURRENT(INPUT_I_MAX, R_AC),
.input_current_min = REG_TO_CURRENT(INPUT_I_MIN, R_AC),
.input_current_step = REG_TO_CURRENT(INPUT_I_STEP, R_AC),
};
/* bq24773 specific interfaces */

View File

@@ -30,4 +30,20 @@
#define OPTION2_EN_EXTILIM (1 << 7)
/* ChargeCurrent Register - 0x14 (mA) */
#define CHARGE_I_OFF 0
#define CHARGE_I_MIN 128
#define CHARGE_I_MAX 8128
#define CHARGE_I_STEP 64
/* MaxChargeVoltage Register - 0x15 (mV) */
#define CHARGE_V_MIN 1024
#define CHARGE_V_MAX 19200
#define CHARGE_V_STEP 16
/* InputCurrent Register - 0x3f (mA) */
#define INPUT_I_MIN 128
#define INPUT_I_MAX 8128
#define INPUT_I_STEP 64
#endif /* __CROS_EC_CHARGER_BQ24773_H */