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

Commit 5d215e4c authored by Ashay Jaiswal's avatar Ashay Jaiswal Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-smbcharger: fix aicl level reporting logic



smbchg_get_aicl_level_ma function can never report AICL_SUSPEND
status as the status bit is reset before AICL_SUSPEND check.
Fix this by checking AICL_SUSPEND bit status before resetting the
bit.

CRs-Fixed: 851902
Change-Id: I8bb9bf60ab13a0665ce4e178ebf25d6d384b9d7a
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 377d2dff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1866,11 +1866,11 @@ static int smbchg_get_aicl_level_ma(struct smbchg_chip *chip)
		dev_err(chip->dev, "Could not read usb icl sts 1: %d\n", rc);
		return 0;
	}
	reg &= ICL_STS_MASK;
	if (reg & AICL_SUSP_BIT) {
		pr_warn("AICL suspended: %02x\n", reg);
		return 0;
	}
	reg &= ICL_STS_MASK;
	if (reg >= ARRAY_SIZE(usb_current_table)) {
		pr_warn("invalid AICL value: %02x\n", reg);
		return 0;