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

Commit a5327905 authored by Shyam Kumar Thella's avatar Shyam Kumar Thella
Browse files

power: fg-alg: Fix condition to schedule TTF work



In the TTF algorithm, end ttf_work only during charging when SOC is
100% or charge is terminated.

ttf_work needs to be scheduled during discharging so that TTE
calculation can use ibatt_avg calculated from ibatt samples collected
every 10 seconds.

Fixes: 6a4db4ee ("power: fg-alg: Fix condition to schedule TTF work").

Change-Id: I59c3088706d014cd0d3d961cf302b0cf274ce2d6
Signed-off-by: default avatarShyam Kumar Thella <sthella@codeaurora.org>
parent e9b4bea3
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1437,11 +1437,10 @@ static void ttf_work(struct work_struct *work)
	}
	pr_debug("TTF: charge_status:%d charge_done:%d msoc:%d\n",
			charge_status, charge_done, msoc);
	/*
	 * Do not schedule ttf work when SOC is 100%
	 * or charge terminated
	 */
	if ((msoc == 100) || charge_done)
	/* Do not schedule ttf work if SOC is 100% or charge teminated. */
	if (charge_done ||
		((msoc == 100) &&
			(charge_status == POWER_SUPPLY_STATUS_CHARGING)))
		goto end_work;

	rc =  ttf->get_ttf_param(ttf->data, TTF_IBAT, &ibatt_now);