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

Commit de193409 authored by Vamshi Krishna B V's avatar Vamshi Krishna B V
Browse files

power: fg-alg: add min_start_soc to begin the capacity learning



Currently, capacity learning begins based on SOC threshold and
battery temperature. Since the SOC threshold to begin cannot be
qualified in certain low battery conditions, add another minimum
SOC threshold for a better qualification.

CRs-Fixed: 2225348
Change-Id: If916c0a04cec785dc25f3c70d0ea1643d598f479
Signed-off-by: default avatarVamshi Krishna B V <vbv@codeaurora.org>
parent c287f849
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -327,13 +327,15 @@ static int cap_learning_process_full_data(struct cap_learning *cl)
 */
static int cap_learning_begin(struct cap_learning *cl, u32 batt_soc)
{
	int rc, cc_soc_sw, batt_soc_msb;
	int rc, cc_soc_sw, batt_soc_msb, batt_soc_pct;

	batt_soc_msb = batt_soc >> 24;
	if (DIV_ROUND_CLOSEST(batt_soc_msb * 100, FULL_SOC_RAW) >
		cl->dt.start_soc) {
		pr_debug("Battery SOC %d is high!, not starting\n",
			batt_soc_msb);
	batt_soc_pct = DIV_ROUND_CLOSEST(batt_soc_msb * 100, FULL_SOC_RAW);

	if (batt_soc_pct > cl->dt.max_start_soc ||
			batt_soc_pct < cl->dt.min_start_soc) {
		pr_debug("Battery SOC %d is high/low, not starting\n",
			batt_soc_pct);
		return -EINVAL;
	}

+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ struct cycle_counter {
};

struct cl_params {
	int	start_soc;
	int	min_start_soc;
	int	max_start_soc;
	int	max_temp;
	int	min_temp;
	int	max_cap_inc;