summaryrefslogtreecommitdiff
path: root/include/battery.h
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-11-01 09:53:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-11-08 00:48:02 -0800
commit0275d7360271f2fad2740f0c56cf0c83bf3a24d8 (patch)
tree4232506b512da11d3207dd626d7fe29297ad9fd1 /include/battery.h
parent55a33c46ffac1f1ed781fa8be6150a4303d26542 (diff)
downloadchrome-ec-0275d7360271f2fad2740f0c56cf0c83bf3a24d8.tar.gz
Battery: Compensate remaining charge to match full capacity
If remaining charge is more than x% of the full capacity, the remaining charge is raised to the full capacity before it's reported to the rest of the system. Some batteries don't update full capacity timely or don't update it at all. On such systems, compensation is required to guarantee the remaining charge will be equal to the full capacity eventually. On some systems, Rohm charger generates audio noise when the battery is fully charged and AC is plugged. A workaround is to do charge- discharge cycles between 93 and 100%. On such systems, compensation was also applied to mask this cycle from users. This used to be done in ACPI, thus, all software components except EC was able to see the compensated charge. This patch is moving the logic to EC. With this and the following changes, EC can see what the rest of the system sees, thus, can control LEDs synchronously (to the display percentage). Another rationale of this move is EC can perform more granular and precise compensation than ACPI since it has more knowledge about the battery and the charger. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> CQ-DEPEND=CL:1320195 BUG=b:109954565,b:80270446 BRANCH=none TEST=Verify charge LED changes to white (full) on Sona synchronously to the display percentage. TEST=Verify charge LED changes to blinking white (low) on Sona within 30 seconds synchronously to the display percentage. Change-Id: I4e3f70efa39e62c91cb8894b603c551cd23511aa Reviewed-on: https://chromium-review.googlesource.com/1312204 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'include/battery.h')
-rw-r--r--include/battery.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/battery.h b/include/battery.h
index 96eb1ea705..38d7dd32aa 100644
--- a/include/battery.h
+++ b/include/battery.h
@@ -403,4 +403,28 @@ void battery_memmap_set_index(enum battery_index index);
extern struct i2c_stress_test_dev battery_i2c_stress_test_dev;
#endif
+/*
+ * If remaining charge is more than x% of the full capacity, the
+ * remaining charge is raised to the full capacity before it's
+ * reported to the rest of the system.
+ *
+ * Some batteries don't update full capacity timely or don't update it
+ * at all. On such systems, compensation is required to guarantee
+ * the remaining charge will be equal to the full capacity eventually.
+ *
+ * On some systems, Rohm charger generates audio noise when the battery
+ * is fully charged and AC is plugged. A workaround is to do charge-
+ * discharge cycles between 93 and 100%. On such systems, compensation
+ * was also applied to mask this cycle from users.
+ *
+ * This used to be done in ACPI, thus, all software components except EC
+ * was seeing the compensated charge. Now we do it in EC. It has more
+ * knowledge on the charger and the battery. So, it can perform more
+ * granular and precise compensation.
+ *
+ * TODO: Currently, this is applied only to smart battery. Apply it to other
+ * battery drivers as needed.
+ */
+void battery_compensate_params(struct batt_params *batt);
+
#endif /* __CROS_EC_BATTERY_H */