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

Commit f0a7a7c1 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-fg-gen4: Use ESR_ACTUAL for calculating cell impedance



Cell impedance calculation is currently getting ESR which is used
for TTF calculations. Instead, use ESR_ACTUAL which provides a
stable value as per the hardware recommendation.

Change-Id: I2e32a209287134869f6e4e7e012626e48d64b09a
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 1ec7e9b2
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -791,10 +791,21 @@ static int fg_gen4_get_cell_impedance(struct fg_gen4_chip *chip, int *val)
{
	struct fg_dev *fg = &chip->fg;
	int rc, esr_uohms, temp, vbat_term_mv, v_delta, rprot_uohms = 0;
	int rslow_uohms;

	rc = fg_get_battery_resistance(fg, &esr_uohms);
	if (rc < 0)
	rc = fg_get_sram_prop(fg, FG_SRAM_ESR_ACT, &esr_uohms);
	if (rc < 0) {
		pr_err("failed to get ESR_ACT, rc=%d\n", rc);
		return rc;
	}

	rc = fg_get_sram_prop(fg, FG_SRAM_RSLOW, &rslow_uohms);
	if (rc < 0) {
		pr_err("failed to get Rslow, rc=%d\n", rc);
		return rc;
	}

	esr_uohms += rslow_uohms;

	if (!chip->dt.five_pin_battery)
		goto out;