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

Commit 01d87694 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: smb1351-charger: limit FCC dynamically for SMB1350



SMB1350 has a fast charge current (FCC) limit of 2600 mA. Add a
conditional check for SMB1350 to limit FCC while setting it.

Change-Id: I66239a69b481d4e3a718423bcf2529c9ad7246ce
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 0c95706d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -734,6 +734,13 @@ static int smb1351_fastchg_current_set(struct smb1351_charger *chip,
		return smb1351_masked_write(chip, VARIOUS_FUNC_2_REG,
				PRECHG_TO_FASTCHG_BIT, PRECHG_TO_FASTCHG_BIT);
	} else {
		if (chip->version == SMB_UNKNOWN)
			return -EINVAL;

		/* SMB1350 supports FCC upto 2600 mA */
		if (chip->version == SMB1350 && fastchg_current > 2600)
			fastchg_current = 2600;

		/* set fastchg current */
		for (i = ARRAY_SIZE(fast_chg_current) - 1; i >= 0; i--) {
			if (fast_chg_current[i] <= fastchg_current)