summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-05-24 15:08:04 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-06-01 17:44:20 -0700
commit9734ec2d6bd5310f2bbaafded2f5fd9a69496333 (patch)
tree8857465099ffd6e8624604eedff28b6775599cae /include
parentf30bb2839f0cd22efe0468680daf66e45a3ce862 (diff)
downloadchrome-ec-9734ec2d6bd5310f2bbaafded2f5fd9a69496333.tar.gz
battery: Move fuel gauge code to common
Move fuel gauge code to common to avoid duplication in octopus and grunt baseboards. BUG=b:79704826,b:74018100 BRANCH=none TEST=make -j buildall Change-Id: I58a615c9ed7906cb19b49c2baa36aaa619838cf1 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1072637 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/battery_fuel_gauge.h45
-rw-r--r--include/config.h7
2 files changed, 52 insertions, 0 deletions
diff --git a/include/battery_fuel_gauge.h b/include/battery_fuel_gauge.h
new file mode 100644
index 0000000000..8de72d7d4e
--- /dev/null
+++ b/include/battery_fuel_gauge.h
@@ -0,0 +1,45 @@
+/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Battery fuel gauge parameters
+ */
+
+#ifndef __CROS_EC_BATTERY_FUEL_GAUGE_H
+#define __CROS_EC_BATTERY_FUEL_GAUGE_H
+
+#include "battery.h"
+
+/* Number of writes needed to invoke battery cutoff command */
+#define SHIP_MODE_WRITES 2
+
+struct ship_mode_info {
+ const uint8_t reg_addr;
+ const uint16_t reg_data[SHIP_MODE_WRITES];
+};
+
+struct fet_info {
+ const int mfgacc_support;
+ const uint8_t reg_addr;
+ const uint16_t reg_mask;
+ const uint16_t disconnect_val;
+};
+
+struct fuel_gauge_info {
+ const char *manuf_name;
+ const char *device_name;
+ const uint8_t override_nil;
+ const struct ship_mode_info ship_mode;
+ const struct fet_info fet;
+};
+
+struct board_batt_params {
+ const struct fuel_gauge_info fuel_gauge;
+ const struct battery_info batt_info;
+};
+
+/* Forward declare board specific data used by common code */
+extern const struct board_batt_params board_battery_info[];
+extern const enum battery_type DEFAULT_BATTERY_TYPE;
+
+#endif /* __CROS_EC_BATTERY_FUEL_GAUGE_H */
diff --git a/include/config.h b/include/config.h
index e7ca893b80..aa99222954 100644
--- a/include/config.h
+++ b/include/config.h
@@ -303,6 +303,13 @@
#undef CONFIG_BATTERY_DEVICE_CHEMISTRY
/*
+ * If defined, the board must supply fuel gauge and battery information for
+ * each supported battery. This information is then used for battery cut off
+ * and to check the charge/discharge FET status.
+ */
+#undef CONFIG_BATTERY_FUEL_GAUGE
+
+/*
* Critical battery shutdown timeout (seconds)
*
* If the battery is at extremely low charge (and discharging) or extremely