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

Commit c7a993cb authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-qg: Clear learnt capacity on loading a new profile"

parents 2f80685a 533fbd01
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2028,6 +2028,7 @@ static int qg_reset(struct qpnp_qg *chip)
static int qg_setprop_batt_age_level(struct qpnp_qg *chip, int batt_age_level)
{
	int rc = 0;
	u16 data = 0;

	if (!chip->dt.multi_profile_load)
		return 0;
@@ -2053,6 +2054,13 @@ static int qg_setprop_batt_age_level(struct qpnp_qg *chip, int batt_age_level)
			pr_err("error in storing batt_age_level rc =%d\n", rc);
	}

	/* Clear the learned capacity on loading a new profile */
	rc = qg_sdam_multibyte_write(QG_SDAM_LEARNED_CAPACITY_OFFSET,
						(u8 *)&data, 2);

	if (rc < 0)
		pr_err("Failed to clear SDAM learnt capacity rc=%d\n", rc);

	qg_dbg(chip, QG_DEBUG_PROFILE, "Profile with batt_age_level = %d loaded\n",
						chip->batt_age_level);