power: qpnp-fg-gen3: make TTF monotonic by limiting slope

Currently if there is a spike in system load or a thermal event which
causes the battery current to change dramatically then the TTF can jump.

While a battery is charging the TTF should be monotonically decreasing.

Track the TTF starting with the first estimate and set hard bounds of -2
and -0.1 on the slope. The negative slope ensures the TTF is
monotonically decreasing and the hard bounds on the slope smooth out
significant changes in the TTF.

Change-Id: I68a934599ff25bc5a9eb67b372b28a723532a540
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2 files changed