summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2018-06-11 17:35:50 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-06-19 03:48:53 -0700
commite06db69a273d4fc220ea3707c2286d1f626424ef (patch)
treea438c538046c329501c90cd41f6e4c0dd2550215
parenta201157d9cc06d4d9245c175850da2ff56d0e402 (diff)
downloadchrome-ec-e06db69a273d4fc220ea3707c2286d1f626424ef.tar.gz
atlas: power down system at PMIC on hibernate
this turns off most of the power rails at the PMIC in response to a system hibernate request. BUG=b:110237370 BRANCH=none TEST=verified both the AP and EC power down Change-Id: Ica830e15dfd2f80a3392afe29a079faa5e4d6ec9 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1096485 Commit-Ready: Caveh Jalali <caveh@google.com> Tested-by: Caveh Jalali <caveh@google.com> Reviewed-by: Caveh Jalali <caveh@google.com>
-rw-r--r--board/atlas/board.c27
-rw-r--r--board/atlas/board.h1
2 files changed, 27 insertions, 1 deletions
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 2ffd4540c7..0d122f022e 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -15,10 +15,10 @@
#include "console.h"
#include "driver/accelgyro_bmi160.h"
#include "driver/als_opt3001.h"
+#include "driver/pmic_bd99992gw.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
#include "driver/tcpm/tcpm.h"
-#include "driver/temp_sensor/bd99992gw.h"
#include "espi.h"
#include "extpower.h"
#include "gpio.h"
@@ -36,6 +36,7 @@
#include "spi.h"
#include "switch.h"
#include "system.h"
+#include "system_chip.h"
#include "task.h"
#include "temp_sensor.h"
#include "timer.h"
@@ -406,6 +407,30 @@ static void board_pmic_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_DEFAULT);
+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 Atlas, 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,
+ BD99992GW_REG_SDWNCTRL, BD99992GW_SDWNCTRL_SWDN);
+
+ /* Wait for power to be cut. */
+ while (1)
+ ;
+}
+
/* Initialize board. */
static void board_init(void)
{
diff --git a/board/atlas/board.h b/board/atlas/board.h
index 33bf5b5bc2..13782dfb49 100644
--- a/board/atlas/board.h
+++ b/board/atlas/board.h
@@ -148,6 +148,7 @@
#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define CONFIG_HIBERNATE_PSL /* Enable PSL pins for wakeup */
/* I2C ports */
#define I2C_PORT_POWER NPCX_I2C_PORT0_0 /* pmic/charger */