qpnp-smb2: clear the ICL override during probe

When PD negotiates a higher input current limit the ICL override bit will
be set. If a reboot happens then the ICL override will still be set after
the reboot. Clear the ICL override during probe to ensure that the correct
ICL is honored since PD is neither enabled nor has it negotiated a higher
ICL yet.

Change-Id: Iaa5f221d530721f7ff4a413a609192baf98ff359
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
This commit is contained in:
Nicholas Troast 2016-11-14 11:12:29 -08:00
parent 3b66278123
commit 8931ef2e5c

View file

@ -1049,6 +1049,7 @@ static int smb2_init_hw(struct smb2 *chip)
{
struct smb_charger *chg = &chip->chg;
int rc;
u8 stat;
if (chip->dt.no_battery)
chg->fake_capacity = 50;
@ -1069,6 +1070,21 @@ static int smb2_init_hw(struct smb2 *chip)
chg->otg_cl_ua = chip->dt.otg_cl_ua;
rc = smblib_read(chg, APSD_RESULT_STATUS_REG, &stat);
if (rc < 0) {
pr_err("Couldn't read APSD_RESULT_STATUS rc=%d\n", rc);
return rc;
}
/* clear the ICL override if it is set */
if (stat & ICL_OVERRIDE_LATCH_BIT) {
rc = smblib_write(chg, CMD_APSD_REG, ICL_OVERRIDE_BIT);
if (rc < 0) {
pr_err("Couldn't disable ICL override rc=%d\n", rc);
return rc;
}
}
/* votes must be cast before configuring software control */
vote(chg->pl_disable_votable,
PL_INDIRECT_VOTER, true, 0);