summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-11-03 10:09:47 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-18 09:10:42 +0000
commit45b4eda8771ad03777a03326207075dce57f13e3 (patch)
treee9fed5dc35f59827885fa6a99ef4656bdf5725a5 /board
parent2ff6a30c47142db02be4b52ab42f2dd4da5aeb59 (diff)
downloadchrome-ec-45b4eda8771ad03777a03326207075dce57f13e3.tar.gz
Zinger: honor disable_sleep()
Extend the Zinger runtime to take into account the disable_sleep() issued by the USB protocol stack and avoid going into deep-sleep while connected. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=none TEST=connect Zinger to a PD power sink (Twinkie) and monitor the stop mode entry/exit on a GPIO. Change-Id: I04e35fdd65f3be3da7a4304dc1a92e6268930888 Reviewed-on: https://chromium-review.googlesource.com/230340 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/zinger/board.h1
-rw-r--r--board/zinger/runtime.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/board/zinger/board.h b/board/zinger/board.h
index df642890a7..89a44f370f 100644
--- a/board/zinger/board.h
+++ b/board/zinger/board.h
@@ -32,6 +32,7 @@
#undef CONFIG_COMMON_PANIC_OUTPUT
#undef CONFIG_COMMON_RUNTIME
#undef CONFIG_COMMON_TIMER
+#define CONFIG_LOW_POWER_IDLE
#undef CONFIG_CONSOLE_CMDHELP
#undef CONFIG_DEBUG_ASSERT
#undef CONFIG_DEBUG_EXCEPTIONS
diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c
index d07139dbaf..4dda979d46 100644
--- a/board/zinger/runtime.c
+++ b/board/zinger/runtime.c
@@ -9,11 +9,13 @@
#include "cpu.h"
#include "debug.h"
#include "registers.h"
+#include "system.h"
#include "task.h"
#include "timer.h"
#include "util.h"
volatile uint32_t last_event;
+uint32_t sleep_mask;
timestamp_t get_time(void)
{
@@ -139,7 +141,8 @@ uint32_t task_wait_event(int timeout_us)
if (timeout_us < 0) {
asm volatile ("wfi");
} else if (timeout_us <=
- (STOP_MODE_LATENCY + SET_RTC_MATCH_DELAY)) {
+ (STOP_MODE_LATENCY + SET_RTC_MATCH_DELAY) ||
+ !DEEP_SLEEP_ALLOWED) {
STM32_TIM32_CCR1(2) = STM32_TIM32_CNT(2) + timeout_us;
STM32_TIM_SR(2) = 0; /* clear match flag */
STM32_TIM_DIER(2) = 2; /* match interrupt */