Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 145d2d39 authored by Harry Yang's avatar Harry Yang
Browse files

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: default avatarHarry Yang <harryy@codeaurora.org>
parent 4d9a308b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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 @@ static int smb1355_init_hw(struct smb1355 *chip)
		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);