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

Commit f6727182 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Ashay Jaiswal
Browse files

power: smbcharger: Re-run AICL irrespective of the AICL status



In the current implementation AICL is not re-run if its already
in progress. However in case where ICL gets updated while AICL
is in progress, the updated ICL value is not considered unless
AICL re-runs again. Handle this by re-running AICL irrespective of
the AICL status.

CRs-Fixed: 907473
Change-Id: Ie25f5a078ad99e4864370998c4abdf7edacb43f4
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 7427cd00
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -1812,20 +1812,6 @@ static void taper_irq_en(struct smbchg_chip *chip, bool en)
	mutex_unlock(&chip->taper_irq_lock);
}

static bool smbchg_is_aicl_complete(struct smbchg_chip *chip)
{
	int rc;
	u8 reg;

	rc = smbchg_read(chip, &reg,
			chip->usb_chgpth_base + ICL_STS_1_REG, 1);
	if (rc < 0) {
		dev_err(chip->dev, "Could not read usb icl sts 1: %d\n", rc);
		return true;
	}
	return (reg & AICL_STS_BIT) != 0;
}

static int smbchg_get_aicl_level_ma(struct smbchg_chip *chip)
{
	int rc;
@@ -2591,7 +2577,7 @@ static int set_usb_current_limit_vote_cb(struct device *dev,
		return 0;

	aicl_ma = smbchg_get_aicl_level_ma(chip);
	if (icl_ma > aicl_ma && smbchg_is_aicl_complete(chip))
	if (icl_ma > aicl_ma)
		smbchg_rerun_aicl(chip);
	smbchg_parallel_usb_check_ok(chip);
	return 0;