summaryrefslogtreecommitdiff
path: root/include/fan.h
diff options
context:
space:
mode:
authorTino Liu <tino.liu@quanta.corp-partner.google.com>2018-06-21 19:16:08 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-07-04 02:01:53 -0700
commita84165968ca78fe7d783e522f79dd01abc6303fd (patch)
tree3a81a56a7c69e92fac4fb61e2dfc6e1452ea0c7e /include/fan.h
parentfec3c3c7ec17aaa92332b3128ce3afd352585bed (diff)
downloadchrome-ec-a84165968ca78fe7d783e522f79dd01abc6303fd.tar.gz
NPCX/fan: Update rpm_actual in duty mode
For npcx, this patch makes rpm_actual updated at every hook_tick when fan is in duty mode (in addition to rpm mode). It also sets fan_status to LOCKED if rpm_actual > 0. BUG=b:110451144 BRANCH=master TEST=After `fanduty <percent>`, `faninfo` can see actual rpm being updated. Verify that `fanduty` doesn't impact `fanset`. Change-Id: I3685ca2b8e51d5dd12974c83656c88fecae1932c Signed-off-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1111477 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vincent Wang <vwang@chromium.org>
Diffstat (limited to 'include/fan.h')
-rw-r--r--include/fan.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/fan.h b/include/fan.h
index 86c2822f80..5a2e010e18 100644
--- a/include/fan.h
+++ b/include/fan.h
@@ -88,7 +88,23 @@ int fan_get_rpm_target(int ch);
/* Is the fan stalled when it shouldn't be? */
int fan_is_stalled(int ch);
-/* How is the automatic RPM control doing? */
+/**
+ * STOPPED means not spinning.
+ *
+ * When setting fan rpm, some implementations in chip layer (npcx and it83xx)
+ * is to adjust fan pwm duty steps by steps. In this period, fan_status will
+ * be marked as CHANGING. After change is done, fan_status will become LOCKED.
+ *
+ * In the period of changing pwm duty, if it's trying to increase/decrease duty
+ * even when duty is already in upper/lower bound. Then this action won't work,
+ * and fan_status will be marked as FRUSTRATED.
+ *
+ * For other implementations in chip layer (mchp and mec1322), there is no
+ * changing period. So they don't have CHANGING status.
+ * Just return status as LOCKED in normal spinning case, return STOPPED when
+ * not spinning, return FRUSTRATED when the related flags (which is read from
+ * chip's register) is set.
+ */
enum fan_status {
FAN_STATUS_STOPPED = 0,
FAN_STATUS_CHANGING = 1,