mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 10:45:22 +00:00
charger: bd99955: Set pre-charge current in addition to fast charge
Pre-charge vs fast-charge mode depends on battery voltage relative to VSYS. Rather than checking battery voltage (which may change), set pre-charge and fast-charge currents whenever charger_set_current() is called. BUG=chrome-os-partner:55416 BRANCH=None TEST=Manual on kevin. Verify system continues to boot with no battery. Attach depleted battery, run "battery" and verify charger current is ~200 mA. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I68c06108c6d85ceede396294bedd1a017ddddd52 Reviewed-on: https://chromium-review.googlesource.com/361993 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
7f2e7f7212
commit
27aac6efb6
@@ -592,6 +592,8 @@ int charger_get_current(int *current)
|
||||
|
||||
int charger_set_current(int current)
|
||||
{
|
||||
int rv;
|
||||
|
||||
/* Charge current step 64 mA */
|
||||
current &= ~0x3F;
|
||||
|
||||
@@ -601,8 +603,14 @@ int charger_set_current(int current)
|
||||
else if (current < bd99955_charger_info.current_min)
|
||||
current = bd99955_charger_info.current_min;
|
||||
|
||||
return ch_raw_write16(BD99955_CMD_CHG_CURRENT, current,
|
||||
BD99955_BAT_CHG_COMMAND);
|
||||
rv = ch_raw_write16(BD99955_CMD_CHG_CURRENT, current,
|
||||
BD99955_BAT_CHG_COMMAND);
|
||||
if (rv)
|
||||
return rv;
|
||||
|
||||
return ch_raw_write16(BD99955_CMD_IPRECH_SET,
|
||||
MIN(current, BD99955_IPRECH_MAX),
|
||||
BD99955_EXTENDED_COMMAND);
|
||||
}
|
||||
|
||||
int charger_get_voltage(int *voltage)
|
||||
|
||||
@@ -108,7 +108,10 @@ enum bd99955_charge_port {
|
||||
#define BD99955_CMD_VSYSVAL_THH_SET 0x12
|
||||
#define BD99955_CMD_VSYSVAL_THL_SET 0x13
|
||||
#define BD99955_CMD_ITRICH_SET 0x14
|
||||
|
||||
#define BD99955_CMD_IPRECH_SET 0x15
|
||||
#define BD99955_IPRECH_MAX 1024
|
||||
|
||||
#define BD99955_CMD_ICHG_SET 0x16
|
||||
#define BD99955_CMD_ITERM_SET 0x17
|
||||
#define BD99955_CMD_VPRECHG_TH_SET 0x18
|
||||
|
||||
Reference in New Issue
Block a user