summaryrefslogtreecommitdiff
path: root/common/system_common.c
diff options
context:
space:
mode:
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 */