summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-07-24 06:59:29 +0800
committerChromeBot <chrome-bot@google.com>2013-07-24 15:10:47 -0700
commit76070804b0ebfa4e297d51ef01ed028d575e8e39 (patch)
tree3b94e3fb1070fc695dfb79a76f34ea48cb3fc50a
parent795f82ca36060268aa520867bd935ee88a0e1f44 (diff)
downloadchrome-ec-76070804b0ebfa4e297d51ef01ed028d575e8e39.tar.gz
spring: Drop 3.3V to lock TPSChrome into battery mode
For Spring, we need to work around a hardware issue that TPSChrome doesn't lock into battery mode when the charger is unplugged. This is done by slightly dropping 3.3V power rail before the EC hibernates. BUG=chrome-os-partner:21107 TEST=Power off and unplug charger. Wait until EC hibernates. Measure power and check 3.3V power rail. BRANCH=Spring Change-Id: I4d13ee039e9c71d8475ad5c480871c9db8a8495c Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63127 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/gaia_power.c1
-rw-r--r--common/pmu_tps65090.c22
-rw-r--r--include/pmu_tpschrome.h5
3 files changed, 28 insertions, 0 deletions
diff --git a/common/gaia_power.c b/common/gaia_power.c
index dd336c244e..a11990add4 100644
--- a/common/gaia_power.c
+++ b/common/gaia_power.c
@@ -149,6 +149,7 @@ static void check_hibernate_timer(void)
if (timestamp_expired(hibernate_time, NULL) &&
!board_get_ac()) {
CPRINTF("[%T hibernating]\n");
+ pmu_battery_mode();
system_hibernate(0, 0);
}
}
diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c
index e40a41754c..5cc33d415b 100644
--- a/common/pmu_tps65090.c
+++ b/common/pmu_tps65090.c
@@ -425,6 +425,28 @@ int pmu_enable_fet(int fet_id, int enable, int *power_good)
return EC_SUCCESS;
}
+void pmu_battery_mode(void)
+{
+ /*
+ * The timing is important here. If we drop 3.3V for too long, the
+ * EC browns out. Disable interrupt to prevent this.
+ */
+ interrupt_disable();
+
+ gpio_set_level(GPIO_PMIC_RESET, 1);
+
+ /*
+ * Delay for 20 us. This drops 3.3V power rail to ~2.4V, which is
+ * low enough to get TPS65090 to go into battery mode, but not as low
+ * as to brown out the EC.
+ */
+ udelay(20);
+
+ gpio_set_level(GPIO_PMIC_RESET, 0);
+
+ interrupt_enable();
+}
+
int pmu_adc_read(int adc_idx, int flags)
{
int ctrl;
diff --git a/include/pmu_tpschrome.h b/include/pmu_tpschrome.h
index acecb53f8e..03dde334c6 100644
--- a/include/pmu_tpschrome.h
+++ b/include/pmu_tpschrome.h
@@ -283,5 +283,10 @@ enum charging_state charge_get_state(void);
*/
int charge_keep_power_off(void);
+/**
+ * Drop 3.3V power rail a little bit to get TPSChrome locked into battery mode.
+ */
+void pmu_battery_mode(void);
+
#endif /* __CROS_EC_TPSCHROME_H */