qcom: smb1355: restart charging after bat-discharge
SMB1355 is designed to have a minimum charging current of 500mA,
below which charging will be disabled and remain so even after
the current rise above.
Set to keep attempting re-enabling of charging until charging is
disabled by master or input is unplugged. Make the retry interval
250ms.
Change-Id: I348fe80023186dea29cb9142404f2c46a216ed37
Signed-off-by: Harry Yang <harryy@codeaurora.org>
diff --git a/drivers/power/supply/qcom/smb1355-charger.c b/drivers/power/supply/qcom/smb1355-charger.c
index b2c0059..4e1bb17 100644
--- a/drivers/power/supply/qcom/smb1355-charger.c
+++ b/drivers/power/supply/qcom/smb1355-charger.c
@@ -62,6 +62,10 @@
#define CHGR_BATTOV_CFG_REG (CHGR_BASE + 0x70)
#define BATTOV_SETTING_MASK GENMASK(7, 0)
+#define POWER_MODE_HICCUP_CFG (BATIF_BASE + 0x72)
+#define MAX_HICCUP_DUETO_BATDIS_MASK GENMASK(5, 2)
+#define HICCUP_TIMEOUT_CFG_MASK GENMASK(1, 0)
+
#define TEMP_COMP_STATUS_REG (MISC_BASE + 0x07)
#define SKIN_TEMP_RST_HOT_BIT BIT(6)
#define SKIN_TEMP_UB_HOT_BIT BIT(5)
@@ -580,6 +584,16 @@
return rc;
}
+ /* HICCUP setting, unlimited retry with 250ms interval */
+ rc = smb1355_masked_write(chip, POWER_MODE_HICCUP_CFG,
+ HICCUP_TIMEOUT_CFG_MASK | MAX_HICCUP_DUETO_BATDIS_MASK,
+ 0);
+ if (rc < 0) {
+ pr_err("Couldn't enable parallel current sensing rc=%d\n",
+ rc);
+ return rc;
+ }
+
/* enable parallel current sensing */
rc = smb1355_masked_write(chip, CFG_REG,
VCHG_EN_CFG_BIT, VCHG_EN_CFG_BIT);