Loading drivers/power/supply/qcom/fg-alg.c +7 −2 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; Loading Loading @@ -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); Loading @@ -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)); Loading drivers/power/supply/qcom/fg-alg.h +1 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading
drivers/power/supply/qcom/fg-alg.c +7 −2 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; Loading Loading @@ -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); Loading @@ -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)); Loading
drivers/power/supply/qcom/fg-alg.h +1 −0 Original line number Diff line number Diff line Loading @@ -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; Loading