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

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

Merge "power: fg-alg: add function to qualify capacity learning start"

parents e3b18bfc f4952b89
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -486,6 +486,11 @@ static int cap_learning_begin(struct cap_learning *cl, u32 batt_soc_cp)
	int rc, cc_soc_sw, batt_soc_pct;
	u32 batt_soc_prime;

	if (cl->ok_to_begin && !cl->ok_to_begin(cl->data)) {
		pr_debug("Not OK to begin\n");
		return -EINVAL;
	}

	batt_soc_pct = DIV_ROUND_CLOSEST(batt_soc_cp, 100);

	if ((cl->dt.max_start_soc != -EINVAL &&
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ struct cap_learning {
	bool			active;
	struct mutex		lock;
	struct cl_params	dt;
	bool (*ok_to_begin)(void *data);
	int (*get_learned_capacity)(void *data, int64_t *learned_cap_uah);
	int (*store_learned_capacity)(void *data, int64_t learned_cap_uah);
	int (*get_cc_soc)(void *data, int *cc_soc_sw);