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

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

Merge "power: fg-alg: Show last TTF while clearing Ibatt samples"

parents 81dd3beb 24b7273e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -982,6 +982,9 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val)

	/* at least 10 samples are required to produce a stable IBATT */
	if (ttf->ibatt.size < MAX_TTF_SAMPLES) {
		if (ttf->clear_ibatt)
			*val = ttf->last_ttf;
		else
			*val = -1;
		return 0;
	}
@@ -998,6 +1001,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val)
		return rc;
	}

	ttf->clear_ibatt = false;
	ibatt_avg = -ibatt_avg / MILLI_UNIT;
	vbatt_avg /= MILLI_UNIT;

@@ -1303,6 +1307,7 @@ static void ttf_work(struct work_struct *work)
			pr_debug("Clear Ibatt buffer, Ibatt_avg=%d Ibatt_now=%d\n",
					ibatt_avg, ibatt_now);
			ttf_circ_buf_clr(&ttf->ibatt);
			ttf->clear_ibatt = true;
		}

		rc = get_time_to_full_locked(ttf, &ttf_now);
@@ -1312,7 +1317,7 @@ static void ttf_work(struct work_struct *work)
		}

		/* keep the wake lock and prime the IBATT and VBATT buffers */
		if (ttf_now < 0) {
		if (ttf_now < 0 || ttf->clear_ibatt) {
			/* delay for one FG cycle */
			schedule_delayed_work(&ttf->ttf_work,
					msecs_to_jiffies(1000));
+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ struct ttf {
	struct range_data	*step_chg_cfg;
	bool			step_chg_cfg_valid;
	bool			ocv_step_chg_cfg_valid;
	bool			clear_ibatt;
	int			step_chg_num_params;
	int			mode;
	int			last_ttf;