summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2020-02-04 16:29:01 +1100
committerCommit Bot <commit-bot@chromium.org>2020-02-05 11:37:32 +0000
commit69cb58587af634dea9bd349fbc4c35ba639e2f3f (patch)
tree5ab36ecd30eaa7dadb1c84d510c4c30d6b5ea466
parent91c0e7272f8b0838057f8b83df1d970635185bb6 (diff)
downloadchrome-ec-69cb58587af634dea9bd349fbc4c35ba639e2f3f.tar.gz
ec fan: Ensure AP is on before starting fan.
The HOOK_CHIPSET_RESET hook is called both on AP shutdown and startup, so do not start fan unless the AP is being turned on. BRANCH=none BUG=b:146583266 TEST=Verified on puff Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I2c5ae87245e260718c3fa9a979d0a1c3a0c0dd00 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1977066 Tested-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org>
-rw-r--r--board/host/chipset.c5
-rw-r--r--common/fan.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/board/host/chipset.c b/board/host/chipset.c
index 0104fa2ff0..0b52432e72 100644
--- a/board/host/chipset.c
+++ b/board/host/chipset.c
@@ -36,6 +36,11 @@ test_mockable int chipset_in_state(int state_mask)
return state_mask & chipset_state;
}
+test_mockable int chipset_in_or_transitioning_to_state(int state_mask)
+{
+ return state_mask & chipset_state;
+}
+
void test_chipset_on(void)
{
if (chipset_in_state(CHIPSET_STATE_ON))
diff --git a/common/fan.c b/common/fan.c
index c91fa1b318..669ddc519d 100644
--- a/common/fan.c
+++ b/common/fan.c
@@ -6,6 +6,7 @@
/* Basic Chrome OS fan control */
#include "assert.h"
+#include "chipset.h"
#include "common.h"
#include "console.h"
#include "fan.h"
@@ -606,7 +607,11 @@ static void pwm_fan_start(void)
* Upon booting to S0, if needed AP will disable/throttle it using
* host commands.
*/
- pwm_fan_control(1);
+ if (chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON))
+ pwm_fan_control(1);
}
+/* On Fizz, CHIPSET_RESUME isn't triggered when AP warm resets.
+ * So we hook CHIPSET_RESET instead.
+ */
DECLARE_HOOK(HOOK_CHIPSET_RESET, pwm_fan_start, HOOK_PRIO_FIRST);
DECLARE_HOOK(HOOK_CHIPSET_RESUME, pwm_fan_start, HOOK_PRIO_DEFAULT);