mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
g: change default idle behavior based on bus obfuscation availability
Set the default idle action based on whether bus obfuscation is enabled.
BUG=none
BRANCH=none
TEST=verify the idle default is sleep on b1 boards and wfi on b2.
Verify that both types of chips go to sleep and resume
successfully.
Change-Id: Ib5a11c4060aa411ff36c06c7fcadf0bf4c223bf1
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410167
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "console.h"
|
||||
#include "hooks.h"
|
||||
#include "hwtimer.h"
|
||||
#include "init_chip.h"
|
||||
#include "rdd.h"
|
||||
#include "registers.h"
|
||||
#include "system.h"
|
||||
@@ -14,6 +15,8 @@
|
||||
#include "timer.h"
|
||||
#include "util.h"
|
||||
|
||||
#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
|
||||
|
||||
/* What to do when we're just waiting */
|
||||
static enum {
|
||||
DONT_KNOW,
|
||||
@@ -23,13 +26,10 @@ static enum {
|
||||
NUM_CHOICES
|
||||
} idle_action;
|
||||
|
||||
/*
|
||||
* TODO(crosbug.com/p/59641): Set the default action to sleep when the new
|
||||
* boards come in.
|
||||
*/
|
||||
#define IDLE_DEFAULT IDLE_WFI
|
||||
#define EVENT_MIN 500
|
||||
|
||||
static int idle_default;
|
||||
|
||||
static const char const *idle_name[] = {
|
||||
"invalid",
|
||||
"wfi",
|
||||
@@ -166,7 +166,7 @@ void clock_refresh_console_in_use(void)
|
||||
|
||||
void disable_deep_sleep(void)
|
||||
{
|
||||
idle_action = IDLE_DEFAULT;
|
||||
idle_action = idle_default;
|
||||
}
|
||||
DECLARE_HOOK(HOOK_CHIPSET_RESUME, disable_deep_sleep, HOOK_PRIO_DEFAULT);
|
||||
|
||||
@@ -176,6 +176,22 @@ void enable_deep_sleep(void)
|
||||
}
|
||||
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, enable_deep_sleep, HOOK_PRIO_DEFAULT);
|
||||
|
||||
static void idle_init(void)
|
||||
{
|
||||
/*
|
||||
* If bus obfuscation is enabled disable sleep.
|
||||
*/
|
||||
if ((GR_FUSE(OBFUSCATION_EN) == 5) ||
|
||||
(GR_FUSE(FW_DEFINED_BROM_APPLYSEC) & (1 << 3)) ||
|
||||
(runlevel_is_high() && GREAD(GLOBALSEC, OBFS_SW_EN))) {
|
||||
CPRINTS("bus obfuscation enabled disabling sleep");
|
||||
idle_default = IDLE_WFI;
|
||||
} else {
|
||||
idle_default = IDLE_SLEEP;
|
||||
}
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, idle_init, HOOK_PRIO_DEFAULT - 1);
|
||||
|
||||
/* Custom idle task, executed when no tasks are ready to be scheduled. */
|
||||
void __idle(void)
|
||||
{
|
||||
@@ -190,7 +206,7 @@ void __idle(void)
|
||||
* this and set the idle_action.
|
||||
*/
|
||||
if (!idle_action)
|
||||
idle_action = IDLE_DEFAULT;
|
||||
idle_action = idle_default;
|
||||
|
||||
/* Disable sleep until 3 minutes after init */
|
||||
delay_sleep_by(3 * MINUTE);
|
||||
|
||||
Reference in New Issue
Block a user