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

Commit 3b37e737 authored by Zhenhua Huang's avatar Zhenhua Huang
Browse files

power: qpnp-bms: Improve logic for storing FCC learnt data



BMS module supports 16 (8-bit) battery backed-up registers.
Make sure that while backing-up the new data, always replace
the oldest stored data.

CRs-Fixed: 730047
Change-Id: I5fc406ec24ce242b722926cc1096f7dcaf561656
Signed-off-by: default avatarZhenhua Huang <zhenhuah@codeaurora.org>
parent 169417fe
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3095,8 +3095,10 @@ static int backup_new_fcc(struct qpnp_bms_chip *chip, int fcc_mah,
		min_cycle = chip->fcc_learning_samples[0].chargecycles;
		for (i = 1; i < chip->min_fcc_learning_samples; i++) {
			if (min_cycle >
				chip->fcc_learning_samples[i].chargecycles)
				chip->fcc_learning_samples[i].chargecycles) {
				pos = i;
				break;
			}
		}
	} else {
		/* find an empty location */