power: pm8921-bms: implement max current indication
It will be nice to have the BMS also report an approximate max current
that can be drawn from a battery before it falls below the cutoff
voltage. This value can be estimated by calculating the voltage
delta between noload voltage(ocv) and the lowest voltage allowed
(cutoff). Dividing this voltage delta by the estimated resistance
gives us the max current the battery can provide, above which the
battery will likely dip below the cutoff voltage.
The open circuit voltage estimate and the battery resistance
that help in calculate the max current are available when state of
charge (SOC) is being calculated. So, calculate and save the max current
every time SOC is calculated and report this value via a public api.
This max current is used in the Battery Current Limiting (BCL) driver.
Consequently, remove the api that returns battery resistance and
clean up the charger driver from calculating the max current.
Change-Id: I8882575084eefa6a23bd59b8d2a54a53d793298e
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
3 files changed