mirror of
https://github.com/LineageOS/android_kernel_samsung_msm8226.git
synced 2026-09-28 00:00:22 +02:00
Full charge capacity(FCC) of the battery changes as it ages. Failing to update the FCC will lead to SOC errors. Add the following changes to support FCC learning - 1. Add configurable parameters to - enable/disable fcc learning - minimum soc to start FCC learning - minimum ocv (pc) to start FCC learning - minimum cycles to update fcc vs temp. table 2. New FCC is calculated using the cc count- FCC_NEW = (cc_end - cc_start) / (soc2 - soc1) cc_end = CC count when charing ends cc_start = CC count when charging starts soc1, soc2 = starting and ending SOC_rbatt value 3. Use the BMS data registers (0xB4 to 0xBF) to backup the generated FCC, temperature, charge cycles and charge increase. These backed-up values are restored during boot. While at it, add the logic to readjust the FCC after a new FCC is generated. Change-Id: I604e4031061af2b94a90e2a3a9bc7b0b4f0144f3 Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>