summaryrefslogtreecommitdiff
path: root/include/battery_smart.h
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2014-07-18 17:09:37 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-23 02:29:59 +0000
commitb9677a48c81cc3b5074c532902076ff4ac64fe03 (patch)
treef3b3b0adb850d70d320ab142e88129cf09a369c0 /include/battery_smart.h
parent4eee9fe42688e77c6c845a3904adb531a75f569a (diff)
downloadchrome-ec-b9677a48c81cc3b5074c532902076ff4ac64fe03.tar.gz
samus: Kick battery out of disconnect state when AC is attached
The Samus battery can be placed into a disconnect state by asserting a disconnect input signal. In this state, the battery will not function until a charging current is applied. This patch adds detection of the disconnect state. If a battery in disconnect state is found, a current is force-applied to the battery to kick it out of disconnect. BRANCH=None TEST=Manual on Samus. 1. Put battery into disconnect state 2. Pull AC, then reattach AC 3. Verify "found battery in disconnect state" is seen on the EC console. 4. Pull AC and verify that EC console is still accessable Also verify that battery gets out of reset state: 1. Pull AC 2. Issue "i2cxfer w16 0 0x16 0x0 0x12" command on EC console 3. Re-attach AC 4. Pull AC and verify that EC console is still accessable BUG=chrome-os-partner:29465 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ib4268887fb483094ac4e641749200268160d3014 Reviewed-on: https://chromium-review.googlesource.com/209013 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org> Tested-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/battery_smart.h')
-rw-r--r--include/battery_smart.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/battery_smart.h b/include/battery_smart.h
index 3e031b8f60..428608e5f4 100644
--- a/include/battery_smart.h
+++ b/include/battery_smart.h
@@ -56,6 +56,8 @@
#define SB_DEVICE_NAME 0x21
#define SB_DEVICE_CHEMISTRY 0x22
#define SB_MANUFACTURER_DATA 0x23
+/* Extention of smart battery spec, may not be supported on all platforms */
+#define SB_ALT_MANUFACTURER_ACCESS 0x44
/* Battery mode */
#define MODE_INTERNAL_CHARGE_CONTROLLER (1 << 0)
@@ -127,6 +129,14 @@
#define INFO_CHARGER_SPEC(INFO) ((INFO) & 0xf)
#define INFO_SELECTOR_SUPPORT(INFO) (((INFO) >> 4) & 1)
+/* Manufacturer Access parameters */
+#define PARAM_SAFETY_STATUS 0x51
+#define PARAM_OPERATION_STATUS 0x54
+/* Operation status masks -- 6 byte reply */
+/* reply[3] */
+#define BATTERY_DISCHARGING_DISABLED 0x20
+#define BATTERY_CHARGING_DISABLED 0x40
+
/* Read from charger */
int sbc_read(int cmd, int *param);
@@ -136,6 +146,10 @@ int sbc_write(int cmd, int param);
/* Read from battery */
int sb_read(int cmd, int *param);
+/* Read sequence from battery */
+int sb_read_string(int port, int slave_addr, int offset, uint8_t *data,
+ int len);
+
/* Write to battery */
int sb_write(int cmd, int param);