power: pm8921-charger: fix end of charging issues

While checking for end of charge current, voltage collapse protection (vcp)
should be 0. If it is 1 end of charging should not happen.

Also the regulation loop sometimes might read back zero. It is okay to
declare eoc in such cases.

The vbatdet_irq may not trigger when charging is enabled and vbat falls
below vbatdet. This is because charging resumes before vbatdet_irq's
debounce time period elapses which causes vbat to increase above vbatdet
as the battery has begun charging. To circumvent this issue disable
charging when the eoc is declared and enable it only upon vbatdet_low_irq.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
1 file changed