summaryrefslogtreecommitdiff
path: root/drivers/power/qcom-charger
diff options
context:
space:
mode:
authorNicholas Troast <ntroast@codeaurora.org>2016-11-14 11:12:29 -0800
committerNicholas Troast <ntroast@codeaurora.org>2016-11-14 11:12:29 -0800
commit8931ef2e5c0a1fa231f71c85ffa8cdf364b128da (patch)
tree851dd9ec10cf6b005bc8d7189ecd02800b5a9187 /drivers/power/qcom-charger
parent3b6627812391e69a0bd08db485d8d5f89208ce86 (diff)
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>
Diffstat (limited to 'drivers/power/qcom-charger')
-rw-r--r--drivers/power/qcom-charger/qpnp-smb2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c
index a00ad8343a88..f81db5052c2b 100644
--- a/drivers/power/qcom-charger/qpnp-smb2.c
+++ b/drivers/power/qcom-charger/qpnp-smb2.c
@@ -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);