power: pm891-charger: Poll for EOC

The charge done irq  on pm8921 is unreliable, it may fire prematurely
or not fire at all even when the battery is fully charged.

Add software workaround for end of charging (EOC). Once the pmic is in
fastcharging phase check battery voltage via ADC, battery current via
BMS and other conditions favouring, declare EOC.

Software has to disable auto charging and reenable auto charging once
EOC has been detected. This is to reset the pmic FSM to a state where
charging will resume after vbat falls below resume voltage.

Since we are polling for EOC, we can't go to sleep, hence add a
wakelock.

Also enable FASTCHG and VBATDET LOW interrupt since there are
software actions associated for proper EOC polling.

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