summaryrefslogtreecommitdiff
path: root/board/glados_pd
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-09-28 15:13:25 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-05 20:31:18 -0700
commit6a686e6043e50d699250eaf1222357fa4f66c517 (patch)
treed49490ee567c84781a156e3e8ff11bb53f577eac /board/glados_pd
parent1870b30a634db0f9299877380083c8b42561adbf (diff)
downloadchrome-ec-6a686e6043e50d699250eaf1222357fa4f66c517.tar.gz
glados / glados_pd: Hibernate the PD when the EC hibernates
When the PD received status that the EC is going to hibernate, have the PD go to hibernate. The wake pin will toggle from low (hibernate state) to high (default state) when the EC leaves hibernate or resets. BUG=chrome-os-partner:45010 TEST=Manual on glados with subsequent commit. Run 'hibernate' on EC console, verify that both EC and PD go to hibernate. Plug zinger and verify that both EC and PD wake, AP boots, and battery begins charging. BRANCH=None Change-Id: I653aea87480437da742b6e203858f194833db553 Reviewed-on: https://chromium-review.googlesource.com/302713 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/glados_pd')
-rw-r--r--board/glados_pd/board.c13
-rw-r--r--board/glados_pd/board.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/board/glados_pd/board.c b/board/glados_pd/board.c
index 38c3668b15..d1f4568842 100644
--- a/board/glados_pd/board.c
+++ b/board/glados_pd/board.c
@@ -104,6 +104,14 @@ void tcpc_alert_clear(int port)
pd_send_ec_int();
}
+static void system_hibernate_deferred(void)
+{
+ ccprintf("EC requested hibernate\n");
+ cflush();
+ system_hibernate(0, 0);
+}
+DECLARE_DEFERRED(system_hibernate_deferred);
+
/****************************************************************************/
/* Console commands */
static int command_ec_int(int argc, char **argv)
@@ -121,6 +129,7 @@ DECLARE_CONSOLE_COMMAND(ecint, command_ec_int,
static int ec_status_host_cmd(struct host_cmd_handler_args *args)
{
+ const struct ec_params_pd_status *p = args->params;
struct ec_response_pd_status *r = args->response;
/*
@@ -130,6 +139,10 @@ static int ec_status_host_cmd(struct host_cmd_handler_args *args)
r->status = ec_int_status;
args->response_size = sizeof(*r);
+ /* Have the PD follow the EC into hibernate. */
+ if (p->status & EC_STATUS_HIBERNATING)
+ hook_call_deferred(system_hibernate_deferred, 0);
+
/*
* If the source of the EC int line was HOST_EVENT, it has
* been acknowledged so can always clear HOST_EVENT bit
diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h
index c810c0adfe..508594839c 100644
--- a/board/glados_pd/board.h
+++ b/board/glados_pd/board.h
@@ -35,6 +35,8 @@
#undef CONFIG_CONSOLE_HISTORY
#define CONFIG_CONSOLE_HISTORY 2
#define CONFIG_FORCE_CONSOLE_RESUME
+#define CONFIG_HIBERNATE
+#define CONFIG_HIBERNATE_WAKEUP_PINS STM32_PWR_CSR_EWUP2
#undef CONFIG_HOSTCMD_EVENTS
#define CONFIG_HW_CRC
#define CONFIG_I2C