summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2018-08-16 11:21:51 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-17 11:18:10 -0700
commitf39214def22517df6e51bed5770185f4eeef1a5f (patch)
treed4e5870e89029b7cbbaba558e6dd4182223b2e83
parent9f416261999e120ca16a7bdcc5a508aa1452de49 (diff)
downloadchrome-ec-f39214def22517df6e51bed5770185f4eeef1a5f.tar.gz
cheza: Support battery cutoff
BRANCH=none BUG=b:112611441 TEST=verified on Cheza rev1, battery enters ship mode through 'cutoff' ec command and then wakes up through AC attach Change-Id: I1cd2083d3f01da3f60af312d5af9af0d3bab15df Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1178477 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
-rw-r--r--board/cheza/battery.c18
-rw-r--r--board/cheza/board.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/board/cheza/battery.c b/board/cheza/battery.c
index cc302a3e1a..69b4eff28a 100644
--- a/board/cheza/battery.c
+++ b/board/cheza/battery.c
@@ -6,6 +6,11 @@
*/
#include "battery.h"
+#include "battery_smart.h"
+
+/* Shutdown mode parameter to write to manufacturer access register */
+#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
+#define SB_SHUTDOWN_DATA 0x0010
/* Battery info for rev-0 */
static const struct battery_info info = {
@@ -26,3 +31,16 @@ const struct battery_info *battery_get_info(void)
{
return &info;
}
+
+int board_cut_off_battery(void)
+{
+ int rv;
+
+ /* Ship mode command must be sent twice to take effect */
+ rv = sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA);
+
+ if (rv != EC_SUCCESS)
+ return rv;
+
+ return sb_write(SB_SHIP_MODE_REG, SB_SHUTDOWN_DATA);
+}
diff --git a/board/cheza/board.h b/board/cheza/board.h
index 811dfba33a..9ab1fef92c 100644
--- a/board/cheza/board.h
+++ b/board/cheza/board.h
@@ -55,6 +55,7 @@
#define CONFIG_EXTPOWER_GPIO
/* Battery */
+#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BATT_PRES_ODL
#define CONFIG_BATTERY_SMART