chip: it83xx: disable sleep while fan control loop ongoing

This change is required for support 'CONFIG_LOW_POWER_S0'.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. fanset 5555, EC enter doze mode only and fan control is functional.
     2. fanset 0, EC will enter deep doze mode properly.

Change-Id: I3780b12ef54713258769616bfed0155c865c0725
Reviewed-on: https://chromium-review.googlesource.com/338750
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Dino Li
2016-04-13 13:29:44 +08:00
committed by chrome-bot
parent e353ab0363
commit 0374c599af
2 changed files with 10 additions and 11 deletions

View File

@@ -176,11 +176,6 @@ BUILD_ASSERT(ARRAY_SIZE(pnpcfg_settings) == EC2I_SETTING_COUNT);
/* Initialize board. */
static void board_init(void)
{
/*
* Default no low power idle for EVB,
* use console command "sleepmask" to enable it if necessary.
*/
disable_sleep(SLEEP_MASK_FORCE_NO_DSLEEP);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);

View File

@@ -9,13 +9,14 @@
#include "fan.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
#include "util.h"
#include "pwm.h"
#include "task.h"
#include "math_util.h"
#include "hwtimer_chip.h"
#include "math_util.h"
#include "pwm.h"
#include "pwm_chip.h"
#include "registers.h"
#include "system.h"
#include "task.h"
#include "util.h"
#define TACH_EC_FREQ 8000000
#define FAN_CTRL_BASED_MS 10
@@ -118,6 +119,7 @@ void fan_set_enabled(int ch, int enabled)
if (tach_ch < TACH_CH_COUNT)
fan_info_data[tach_ch].fan_sts = FAN_STATUS_CHANGING;
disable_sleep(SLEEP_MASK_FAN);
/* enable timer interrupt for fan control */
ext_timer_start(FAN_CTRL_EXT_TIMER, 1);
/* disable */
@@ -140,8 +142,10 @@ void fan_set_enabled(int ch, int enabled)
if (!enabled) {
/* disable timer interrupt if all fan off. */
if (fan_all_disabled())
if (fan_all_disabled()) {
ext_timer_stop(FAN_CTRL_EXT_TIMER, 1);
enable_sleep(SLEEP_MASK_FAN);
}
}
}