power: pm8921-bms: lock/unlock BMS output registers
The BMS hardware has two sets of registers, shadow registers
which the hardware automatically updates and the output registers
which the software is supposed to read from.
Unless the bms output is locked, the output registers are updated
whenever the shadow registers are updated. If the software were
reading the output registers at the same time, corrupt values
will be read. Moreover the software expects the values to remain
intact while it is doing soc calculations - It reads multiple
registers like ocv, rbatt and cc for one soc calculations and
expects that these registers don't change.
The BMS hardware provides a bit (HOLD_OREG_DATA) where an update to
shadow register won't change the output registers. Set this bit before
reading from the BMS.
Change-Id: Icddf115054b72155479295ba5f4adb3a21b5a97a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
1 file changed