summaryrefslogtreecommitdiff
path: root/include/battery.h
diff options
context:
space:
mode:
authorJonathan Brandmeyer <jbrandmeyer@chromium.org>2018-08-03 13:24:06 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-08-08 04:29:20 -0700
commitb80693e94e6e9aa0a382c39c20efba6f2c7403a9 (patch)
treeb44a8b48858906c6f8a3875b6a69d7c2b6908ddc /include/battery.h
parent5d2cdcab232748095d1efeb4e5c0fc23b13adb67 (diff)
downloadchrome-ec-b80693e94e6e9aa0a382c39c20efba6f2c7403a9.tar.gz
battery: Optionally prevent boot at low SOC with cell imbalance.
Measure the cell imbalance with method dispatch to a per-battery method, such that families with a plurality of configurable batteries can support them all. By default, cell imbalance is taken to be 'zero' in case we don't support that battery's management IC. Provide a driver for reading cell voltages for the TI BQ4050 family. This IC is quite popular, but by no means universal. BUG=b:111214767 BRANCH=none TEST=Boot on Careena with a custom debug print statement, showing that we can measure the typical battery voltages during and after the boot at the battery status polling interval. Change-Id: I235389b252ac9c373aa9706dbd1066f7c0bbce71 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1162663 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'include/battery.h')
-rw-r--r--include/battery.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/battery.h b/include/battery.h
index a97745b794..2ba56e1c9d 100644
--- a/include/battery.h
+++ b/include/battery.h
@@ -117,6 +117,7 @@ int battery_get_avg_voltage(void); /* in mV */
#define BATT_FLAG_BAD_REMAINING_CAPACITY 0x00000100
#define BATT_FLAG_BAD_FULL_CAPACITY 0x00000200
#define BATT_FLAG_BAD_STATUS 0x00000400
+#define BATT_FLAG_IMBALANCED_CELL 0x00000800
/* All of the above BATT_FLAG_BAD_* bits */
#define BATT_FLAG_BAD_ANY 0x000007fc
@@ -328,6 +329,12 @@ int battery_device_chemistry(char *dest, int size);
int battery_manufacturer_date(int *year, int *month, int *day);
/**
+ * Report the absolute difference between the highest and lowest cell voltage in
+ * the battery pack, in millivolts. On error or unimplemented, returns '0'.
+ */
+int battery_imbalance_mv(void);
+
+/**
* Call board-specific cut-off function.
*
* @return EC_RES_INVALID_COMMAND if the battery doesn't support.