summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Lin <CHLin56@nuvoton.com>2022-03-22 13:51:35 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-24 08:27:41 +0000
commit8c0ed26dbf75fa901f2b76198e01fb629e204f48 (patch)
tree4c8cab164195b725de65c562ed8a39b13d5647c1
parent2a10d7626b3424152b23a3beb5a4748eeea732d5 (diff)
downloadchrome-ec-8c0ed26dbf75fa901f2b76198e01fb629e204f48.tar.gz
fan: npcx: fine tune the fan control
The fan used on the Vell platform requires a longer response time than others. It needs about 1 second to output the TACH signal to EC after EC starts to toggle the PWM signal. During this period, the fan driver adjusts the PWM duty per 200 milli-seconds and has the chance to let the duty reach 100% with the original fan control mechanism. It makes the user feel the fan spins unsmoothly. To bypass it, this CL steps the PWM duty not too aggressively when two consecutive RPM reading is zero. BUG=b:225208265 BRANCH=none TEST=pass "make buildall" TEST=set RPM=3000 on VELL, the fan duty doesn't reach 100% afer 1 second. Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: Idc14c859576247759e9119abee5fdeb1f483331d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3539776 Tested-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com>
-rw-r--r--chip/npcx/fan.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/chip/npcx/fan.c b/chip/npcx/fan.c
index f0b3215ce0..5b56f33edf 100644
--- a/chip/npcx/fan.c
+++ b/chip/npcx/fan.c
@@ -293,11 +293,21 @@ enum fan_status fan_smart_control(int ch, int rpm_actual, int rpm_target)
return FAN_STATUS_CHANGING;
}
+ /*
+ * A specific type of fan needs a longer time to output the TACH
+ * signal to EC after EC outputs the PWM signal to the fan.
+ * During this period, the driver will read two consecutive RPM = 0.
+ * In this case, don't step the PWM duty too aggressively.
+ * See b:225208265 for more detail.
+ */
+ if (rpm_pre[ch] == 0 && rpm_actual == 0) {
+ rpm_diff = RPM_MARGIN(rpm_target) + 1;
+ } else {
+ rpm_diff = rpm_target - rpm_actual;
+ }
+
/* Record previous rpm */
rpm_pre[ch] = rpm_actual;
-
- /* Adjust PWM duty */
- rpm_diff = rpm_target - rpm_actual;
duty = fan_get_duty(ch);
if (duty == 0 && rpm_target == 0)
return FAN_STATUS_STOPPED;