diff options
author | Philip Chen <philipchen@google.com> | 2018-05-24 12:01:24 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-30 01:02:36 -0700 |
commit | 0de5b8ed695a420728ec7b606b218284b0241006 (patch) | |
tree | 5b9c1d87e035bb2a5494de75fcb1e5fb878a847f /include/system.h | |
parent | 628c9a924cfde28b2c77707bd71e04cafdf7dc9c (diff) | |
download | chrome-ec-0de5b8ed695a420728ec7b606b218284b0241006.tar.gz |
system: Enable/Disable low power idle in run time
We have enable_sleep()/disable_sleep() to enable/disable
EC deep sleep mode in runtime.
Here we introduce similar interfaces to enable/disable
EC idle (sleep) mode.
BUG=b:78792296
BRANCH=scarlet
TEST=Confirm idle mode is enabled/disabled when
enable_idle() and disable_idle() are called.
Change-Id: I2484f08a066523441064968da99c47de9342ecf0
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1072370
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
(cherry picked from commit c6b6626cdccef04b0ff203aaed0d84dbdcecf8b7)
Reviewed-on: https://chromium-review.googlesource.com/1076708
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Diffstat (limited to 'include/system.h')
-rw-r--r-- | include/system.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/system.h b/include/system.h index acc3f71471..9b58203c5c 100644 --- a/include/system.h +++ b/include/system.h @@ -479,6 +479,30 @@ static inline void disable_sleep(uint32_t mask) atomic_or(&sleep_mask, mask); } +#ifdef CONFIG_LOW_POWER_IDLE_LIMITED +/* + * If this variable is nonzero, all levels of idle modes are disabled. + * Do NOT access it directly. Use idle_is_disabled() to read it and + * enable_idle()/disable_idle() to write it. + */ +extern uint32_t idle_disabled; + +static inline uint32_t idle_is_disabled(void) +{ + return idle_disabled; +} + +static inline void disable_idle(void) +{ + atomic_or(&idle_disabled, 1); +} + +static inline void enable_idle(void) +{ + atomic_clear(&idle_disabled, 1); +} +#endif + /* The following three functions are not available on all chips. */ /** * Postpone sleeping for at least this long, regardless of sleep_mask. |