power: pm8921-charger: tune IR compensation algorithm
It was observed that the IR compensation scheme was overcharging the
battery and based on the battery type and inaccuracies in the adc
readings it could overcharge the battery to a point where the protection
circuits of the battery would kick in. Prevent this by changing the
round up method of compensating to a round down method.
Also it was observed that a down correction causes the battery terminal
voltage to drop even further - this was because when vddmax is lowered
it results in the battery consuming less current bringing the terminal
voltage even lower. The algorithm quickly adds an up correction to the
vddmax the next time around. Add some hysteresis in the scheme i.e. don't
increase the vddmax unless the battery voltage at the terminals is below
the desired voltage by 13mV (instead of 10).
Change-Id: I2a908457f5a693216e55c0928043c433305a22cb
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
1 file changed