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

Commit 082b922a authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-qg: Do not round-up/down battery SOC in BASS



The rounding of battery SOC causes the monotonic SOC to
drop higher than expected (ratio of the drop of
monotonic to battery SOC is higher) leading to a bad
UX.

Change-Id: I7da1c3cff4fb9470a3904407f180463c26315e61
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 8a8da4d3
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -333,14 +333,13 @@ static int qg_process_tcss_soc(struct qpnp_qg *chip, int sys_soc)
static int qg_process_bass_soc(struct qpnp_qg *chip, int sys_soc)
{
	int bass_soc = sys_soc, msoc = chip->msoc;
	int batt_soc = CAP(0, 100, DIV_ROUND_CLOSEST(chip->batt_soc, 100));

	if (!chip->dt.bass_enable && !(qg_ss_feature & QG_BASS))
		goto exit_soc_scale;

	qg_dbg(chip, QG_DEBUG_SOC, "BASS Entry: fifo_i=%d sys_soc=%d msoc=%d batt_soc=%d fvss_active=%d\n",
			chip->last_fifo_i_ua, sys_soc, msoc,
			batt_soc, chip->fvss_active);
			chip->batt_soc, chip->fvss_active);

	/* Skip BASS if FVSS is active */
	if (chip->fvss_active)
@@ -352,11 +351,11 @@ static int qg_process_bass_soc(struct qpnp_qg *chip, int sys_soc)

	if (!chip->bass_active) {
		chip->bass_active = true;
		chip->bsoc_bass_entry = batt_soc;
		chip->bsoc_bass_entry = chip->batt_soc;
	}

	/* Drop the sys_soc by 1% if batt_soc has dropped */
	if ((chip->bsoc_bass_entry - batt_soc) >= 1) {
	if ((chip->bsoc_bass_entry - chip->batt_soc) >= 100) {
		bass_soc = (msoc > 0) ? msoc - 1 : 0;
		chip->bass_active = false;
	}