power: pm8921-bms: implement BMS reset

Sometimes during testing it is convenient to force the BMS to take a new
OCV, essentially restarting the BMS soc calculation in order to test
short portions of the battery profile.

Implement a BMS_reset module parameter, which sets OCV to the
instantaneous VBAT and resets the coulomb counter whenever a 'Y' is
written to it.

Furthermore, in the bms reset mode, keep UUC constant at 3%, and do not
run adjusting algorithms until a 'N' is written to the module parameter.

Note that this feature should only be used with a fake battery, as it
maintains a constant voltage and gives us near true OCV estimates.
Also, the adjusting algorithm is disabled due to this reason. If
adjustments to the OCV were allowed, we will end up adjusting the SOC
higher, because the OCV est will never go low as the battery discharges.
It will fail the test cases for which this feature is designed.

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