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

Commit 604b46da authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg: fix reading OCV junction coefficients



Commit 5d82a81e ("power: qpnp-fg: add support for restoring
battery information") created a bug in getting OCV junction
coefficients p1p2 and p2p3 from the data read from same offset.
Fix it.

Change-Id: Icf106e612a890b378fd1993eceac71b1f21770d0
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 323ea2db
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -5435,20 +5435,14 @@ static int populate_system_data(struct fg_chip *chip)
				chip->ocv_coeffs[8], chip->ocv_coeffs[9],
				chip->ocv_coeffs[10], chip->ocv_coeffs[11]);
	}
	rc = fg_mem_read(chip, buffer, OCV_JUNCTION_REG, 1, 0, 0);
	if (rc) {
		pr_err("Failed to read ocv junctions: %d\n", rc);
		goto done;
	}

	rc = fg_mem_read(chip, buffer, OCV_JUNCTION_REG, 1, 1, 0);
	rc = fg_mem_read(chip, buffer, OCV_JUNCTION_REG, 2, 0, 0);
	if (rc) {
		pr_err("Failed to read ocv junctions: %d\n", rc);
		goto done;
	}

	chip->ocv_junction_p1p2 = buffer[0] * 100 / 255;
	chip->ocv_junction_p2p3 = buffer[0] * 100 / 255;
	chip->ocv_junction_p2p3 = buffer[1] * 100 / 255;

	rc = load_battery_aging_data(chip);
	if (rc) {