summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-09-28 15:07:11 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-05 20:31:18 -0700
commit1870b30a634db0f9299877380083c8b42561adbf (patch)
treede90cfff562dae9c75a8d334233e3a4144ac77e3 /chip
parent5d82dbc4910fcbcfceb8911864790c146a461684 (diff)
downloadchrome-ec-1870b30a634db0f9299877380083c8b42561adbf.tar.gz
pd: Allow EC to request PD hibernate via host command
On some systems, we may wish to have the PD follow the EC into hibernate. Add a status field to EC_CMD_PD_EXCHANGE_STATUS to support this. 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: I0476bc8a47ffb0fe113dccda9d4f8074105c1c84 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/302712 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/mec1322/system.c7
-rw-r--r--chip/stm32/system.c8
2 files changed, 15 insertions, 0 deletions
diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c
index fe68777241..071cb96e80 100644
--- a/chip/mec1322/system.c
+++ b/chip/mec1322/system.c
@@ -281,6 +281,13 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds)
uint32_t nvic_status[3];
char *backup_gpio_ctl;
+#ifdef CONFIG_HOSTCMD_PD
+ /* Inform the PD MCU that we are going to hibernate. */
+ host_command_pd_request_hibernate();
+ /* Wait to ensure exchange with PD before hibernating. */
+ msleep(100);
+#endif
+
cflush();
/* Disable interrupts */
diff --git a/chip/stm32/system.c b/chip/stm32/system.c
index 5e486ea20b..b1daf1ce4c 100644
--- a/chip/stm32/system.c
+++ b/chip/stm32/system.c
@@ -9,6 +9,7 @@
#include "console.h"
#include "cpu.h"
#include "flash.h"
+#include "host_command.h"
#include "registers.h"
#include "panic.h"
#include "system.h"
@@ -104,6 +105,13 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds)
void system_hibernate(uint32_t seconds, uint32_t microseconds)
{
+#ifdef CONFIG_HOSTCMD_PD
+ /* Inform the PD MCU that we are going to hibernate. */
+ host_command_pd_request_hibernate();
+ /* Wait to ensure exchange with PD before hibernating. */
+ msleep(100);
+#endif
+
/* Flush console before hibernating */
cflush();
/* chip specific standby mode */