Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 79632756 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Stephen Boyd
Browse files

power: pm8921-bms: remember soc between restarts



Currently the code does not have a mechanism to remember the soc
reported just before shutting down and upon restarting the new
soc reported is off from the previous soc value reported.

This change introduces
- a method to save soc in an unused coincell back register: ssbi address
  0x107 is not used on 8921 and serves the purpose of storing the soc.
  The driver reads this value and uses it to scale the reported soc.
- a method to detect that a battery was removed and perhaps replaced by a
  different one. If the battery is found replaced the driver is notified
  of the change and it disregards the soc value it read from the backup
  register. The charger driver has a battery backed bit (force vref
  therm) which it sets in its initialization sequence. Once set the
  value remains between restarts, unless the battery is removed. The
  default value of this bit is 0. Hence if a zero is detected before
  writing to it, battery was removed between restarts - this mechanism
  is used to notify the BMS to disregard the soc read from the backup
  register.

Note that for this to work correctly the bootloader needs to be updated to
not overwrite register 0x107 upon restart.

CRs-Fixed: 370287
Change-Id: If7d098552d36eb27a396ee7d37f78d3629861f6e
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 597e7b85
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment