From 5c184565afddbec361100b198721a42bb95a7adb Mon Sep 17 00:00:00 2001 From: Dino Li Date: Wed, 17 Feb 2016 13:37:42 +0800 Subject: [PATCH] chip: it83xx: disable fan control timer if all fans are off Before the change was made, the fan control timer keeps running even all of the fans are off. reproduce the problem: 1. fanset 3333 2. fanset 0 fan is disabled but fan control timer keeps running. Signed-off-by: Dino Li BRANCH=none BUG=none TEST=1. fanset 3333 2. fanset 0 both fan and timer are off. Change-Id: Id38f3a4c64bbb36e8b32baefd285dbb0bf14e47e Reviewed-on: https://chromium-review.googlesource.com/327870 Commit-Ready: Dino Li Tested-by: Dino Li Reviewed-by: Vincent Palatin --- chip/it83xx/fan.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chip/it83xx/fan.c b/chip/it83xx/fan.c index 8f11b29e23..4d2efc8731 100644 --- a/chip/it83xx/fan.c +++ b/chip/it83xx/fan.c @@ -132,9 +132,6 @@ void fan_set_enabled(int ch, int enabled) fan_info_data[tach_ch].rpm_actual = 0; fan_info_data[tach_ch].fan_sts = FAN_STATUS_STOPPED; } - /* disable timer interrupt if all fan off. */ - if (fan_all_disabled()) - ext_timer_stop(FAN_CTRL_EXT_TIMER, 1); } /* on/off */ @@ -144,6 +141,12 @@ void fan_set_enabled(int ch, int enabled) } pwm_enable(ch, enabled); + + if (!enabled) { + /* disable timer interrupt if all fan off. */ + if (fan_all_disabled()) + ext_timer_stop(FAN_CTRL_EXT_TIMER, 1); + } } int fan_get_enabled(int ch)