summaryrefslogtreecommitdiff
path: root/common/system_common.c
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2013-10-07 12:23:35 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-15 00:27:14 +0000
commitc5b90d7e77511e45f2c0021c1a0bc18b09310933 (patch)
treeaf3ab9f0b74cb239808cca51c681be840d32a107 /common/system_common.c
parent193f2298bd1a078f1ac07aacf9dc50132cbb39d3 (diff)
downloadchrome-ec-c5b90d7e77511e45f2c0021c1a0bc18b09310933.tar.gz
lm4: Add a low power idle task.stabilize-4825.B
First implementation of a low power idle task for the LM4 chip. The low power mode is selected by defining CONFIG_LOW_POWER_IDLE in a board.h file. This commit turns it on for Peppy, Slippy, and Falco only because those are the only boards tested. When using the low power idle task, the chip goes in to deep sleep when it can. Deep sleep disables clocks to most peripherals and puts the onboard flash and RAM into a low power mode. The chip is woken out of deep sleep using the RTC in the hibernate module. Increased the idle task stack size to handle more involved idle task. In board.c, the array of GPIO info can be used to select which GPIO points can wake up the EC from deep sleep. Currenlty selected are the power button, lid open, AC present, PCH_SLP_S3, and PCH_SLP_S5. Additionally the port with the KB scan row GPIO point is also enabled to wake up the EC from deep sleep. Signed-off-by: Alec Berg <alecaberg@chromium.org> BUG=None BRANCH=none TEST=Passes all unit tests. Runs on slippy, peppy, and falco with no noticeable side affects. Verified that the power consumed by the EC is lower when in S3, S5 and G3 by scoping the sense resistor powering the chip. Change-Id: I83fa9a159a4b79201b99f2c32678dc4fc8921726 Reviewed-on: https://chromium-review.googlesource.com/172183 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org> Tested-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common/system_common.c')
-rw-r--r--common/system_common.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/common/system_common.c b/common/system_common.c
index 55ea35d20d..81182ef987 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -4,7 +4,6 @@
*/
/* System module for Chrome EC : common functions */
-
#include "clock.h"
#include "common.h"
#include "console.h"
@@ -82,6 +81,9 @@ static int disable_jump; /* Disable ALL jumps if system is locked */
static int force_locked; /* Force system locked even if WP isn't enabled */
static enum ec_reboot_cmd reboot_at_shutdown;
+/* On-going actions preventing going into deep-sleep mode */
+uint32_t sleep_mask;
+
int system_is_locked(void)
{
if (force_locked)
@@ -770,6 +772,34 @@ DECLARE_CONSOLE_COMMAND(syslock, command_system_lock,
"Lock the system, even if WP is disabled",
NULL);
+#ifdef CONFIG_LOW_POWER_IDLE
+/**
+ * Modify and print the sleep mask which controls access to deep sleep
+ * mode in the idle task.
+ */
+static int command_sleepmask(int argc, char **argv)
+{
+ int off;
+
+ if (argc >= 2) {
+ off = strtoi(argv[1], NULL, 10);
+
+ if (off)
+ disable_sleep(SLEEP_MASK_FORCE);
+ else
+ enable_sleep(SLEEP_MASK_FORCE);
+ }
+
+ ccprintf("sleep mask: %08x\n", sleep_mask);
+
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(sleepmask, command_sleepmask,
+ "[<sleep_mask>]",
+ "Display/force sleep mask",
+ NULL);
+#endif
+
/*****************************************************************************/
/* Host commands */