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

Commit 60fcf7d4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-bms: fix boot time iavg calculation algorithm"

parents 09594414 a2f72174
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -1264,7 +1264,6 @@ static int adjust_uuc(struct qpnp_bms_chip *chip,
}

#define MIN_IAVG_MA 250
#define MIN_SECONDS_FOR_VALID_SAMPLE	20
static int calculate_unusable_charge_uah(struct qpnp_bms_chip *chip,
					struct soc_params *params,
					int batt_temp)
@@ -1288,6 +1287,7 @@ static int calculate_unusable_charge_uah(struct qpnp_bms_chip *chip,
		chip->iavg_num_samples = IAVG_SAMPLES;
	}

	if (params->delta_time_s >= IAVG_MINIMAL_TIME) {
		/*
		* if charging use a nominal avg current to keep
		* a reasonable UUC while charging
@@ -1299,6 +1299,7 @@ static int calculate_unusable_charge_uah(struct qpnp_bms_chip *chip,
		chip->iavg_num_samples++;
		if (chip->iavg_num_samples >= IAVG_SAMPLES)
			chip->iavg_num_samples = IAVG_SAMPLES;
	}

	/* now that this sample is added calcualte the average */
	uuc_iavg_ma = 0;
@@ -1329,7 +1330,6 @@ static int calculate_unusable_charge_uah(struct qpnp_bms_chip *chip,
	uuc_uah_iavg = adjust_uuc(chip, params, pc_unusable,
					uuc_uah_iavg, batt_temp);

	chip->first_time_calc_uuc = 0;
	return uuc_uah_iavg;
}

@@ -2361,6 +2361,7 @@ done_calculating:

	get_current_time(&chip->last_recalc_time);
	chip->first_time_calc_soc = 0;
	chip->first_time_calc_uuc = 0;
	return chip->calculated_soc;
}