summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2013-10-17 10:26:10 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-21 19:25:06 +0000
commitb0494f87da3e838fb08f1583c368bee0fc32fb21 (patch)
tree2a6cdf3b5229d1addebbe48d810772d2b897ded6
parent21db824efefde9237db0f92e6145a10bbdd47b53 (diff)
downloadchrome-ec-b0494f87da3e838fb08f1583c368bee0fc32fb21.tar.gz
spring: do not start CPU when battery is self cut-off
When the battery self cuts off due to a cell under-voltage, the battery discharging FET is disabled but the gas gauge still advertise available capacity. The patch specifically detects that case and prevents the main CPU from running since the battery is doing any power buffering until the DSG FET is enabled. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=chrome-os-partner:22807 TEST=On spring, with two good battery (one somewhat charged, the other discharged) successfully starts the machine plugged on Spring charger. With a self cut-off battery, see the EC preventing the CPU start-up and the system staying stable and charging the battery. Change-Id: I1eec1a6f061bbf3b6e4ca996cecbe1ad76c0f29d Reviewed-on: https://chromium-review.googlesource.com/173570 Reviewed-by: Puneet Kumar <puneetster@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/pmu_tps65090_charger.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c
index f5f9409cb0..4d24c5bef3 100644
--- a/common/pmu_tps65090_charger.c
+++ b/common/pmu_tps65090_charger.c
@@ -408,6 +408,28 @@ int charge_keep_power_off(void)
{
int charge;
+#ifdef CONFIG_BATTERY_SPRING
+ int blk_opstatus;
+ int ret;
+ /*
+ * bq30z55 specific: reads OperationStatus register
+ * and checks the status of the discharging FET (DSG FET)
+ * if it is disabled, we cannot use the battery as a buffer
+ * whatever charge level it is returning.
+ */
+ ret = sb_write(SB_MANUFACTURER_ACCESS, 0x54 /* OperationStatus */);
+ ret |= sb_read(SB_MANUFACTURER_DATA, &blk_opstatus);
+ /* DSG FET status is <bit 1> of OperationStatus register
+ * but this register is accessed using an SMBUS block transfer
+ * so the first byte is the size of the transfer rather than
+ * the first byte of data.
+ * if we can access OperationStatus register AND DSG FET is disabled,
+ * we stay off.
+ */
+ if (!ret && !(blk_opstatus & (1 << (1 + 8))))
+ return 1;
+#endif
+
if (BATTERY_AP_OFF_LEVEL == 0)
return 0;