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

Commit b9a15b82 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-smbcharger: restart charging if AICL is suspended



If the VUSB collapses because of load during parallel charging,
rerun the AICL by detecting if AICL is suspended. Also do that
while checking if the parallel charger is not ready enough.

CRs-Fixed: 786186
Change-Id: Ic41872281dfa3432ca1ff7967386b8e850fb73ea
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 8bcee50a
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -1700,6 +1700,10 @@ static int smbchg_get_aicl_level_ma(struct smbchg_chip *chip)
		return 0;
	}
	reg &= ICL_STS_MASK;
	if (reg & AICL_SUSP_BIT) {
		pr_warn("AICL suspended: %02x\n", reg);
		return 0;
	}
	if (reg >= ARRAY_SIZE(usb_current_table)) {
		pr_warn("invalid AICL value: %02x\n", reg);
		return 0;
@@ -1802,8 +1806,12 @@ static void smbchg_parallel_usb_en_work(struct work_struct *work)

	smbchg_relax(chip, PM_PARALLEL_CHECK);
	mutex_lock(&chip->parallel.lock);
	if (smbchg_is_parallel_usb_ok(chip))
	if (smbchg_is_parallel_usb_ok(chip)) {
		smbchg_parallel_usb_enable(chip);
	} else if (chip->parallel.current_max_ma != 0) {
		pr_smb(PR_STATUS, "parallel charging unavailable\n");
		smbchg_parallel_usb_disable(chip);
	}
	mutex_unlock(&chip->parallel.lock);
}