power: pm8921-charger: calculate safety time

We observed that to fully charge a depleted battery with a 500mA source
the default safety time of 180 minutes is insufficient. The safety timer
kicks in at around 95% and stops charging the battery.

Instead of assuming a default of 180 minutes, calculate the charge time
required based on battery capacity and the minimum possible charge
current. Add a 20 minute buffer period to this calculated safety time.

CRs-Fixed: 414619
Change-Id: I08d8d319d096c050ae53d90eeac293c9b1bab2bf
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
5 files changed