summaryrefslogtreecommitdiff
path: root/board/nocturne/board.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2018-05-14 23:51:59 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-22 15:54:05 -0700
commitfc8b1ab52c6f5d556f91a3b8f4ce6a8ef437ae70 (patch)
tree86f16b34b3bf51502560fc9ae5d17b603ed8c078 /board/nocturne/board.c
parentad8a61232105e028fea1e7c6ee420e05fcd98637 (diff)
downloadchrome-ec-fc8b1ab52c6f5d556f91a3b8f4ce6a8ef437ae70.tar.gz
nocturne: Fix EC hibernate.
This commit adds the appropriate hibernate flags to the hibernate wake pins. It additionally, adds a board specific hibernate function which sets up the PSL pins for wake as well as writing to the ROP PMIC to disable all the power rails. BUG=b:79713379 BRANCH=poppy TEST=Enter `hibernate` on EC console, verify that system can wake from AC insertion, power button press, and lid switch. Change-Id: I5b197c3c4d54cfc9c0b00c19815faa019f8b8cae Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/1067892 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Diffstat (limited to 'board/nocturne/board.c')
-rw-r--r--board/nocturne/board.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 0c812f71ca..180314ee7d 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -31,6 +31,7 @@
#include "pwm_chip.h"
#include "registers.h"
#include "system.h"
+#include "system_chip.h"
#include "switch.h"
#include "task.h"
#include "tcpci.h"
@@ -323,6 +324,29 @@ int board_get_version(void)
return board_version;
}
+void board_hibernate(void)
+{
+ int p;
+
+ /* Configure PSL pins */
+ for (p = 0; p < hibernate_wake_pins_used; p++)
+ system_config_psl_mode(hibernate_wake_pins[p]);
+
+ /*
+ * Enter PSL mode. Note that on Nocturne, simply enabling PSL mode does
+ * not cut the EC's power. Therefore, we'll need to cut off power via
+ * the ROP PMIC afterwards.
+ */
+ system_enter_psl_mode();
+
+ /* Cut off DSW power via the ROP PMIC. */
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x1);
+
+ /* Wait for power to be cut. */
+ while (1)
+ ;
+}
+
static void board_init(void)
{
/* Enable sensor interrupts. */