Skip to content

Commit 22daaf6

Browse files
authored
lotus: add slow response fan solution (#864)
* lotus: add slow response fan solution Signed-off-by: LeoCX_Tsai <[email protected]> * lotus: use fan.dtsi rpm_deviation remove margin rpm deviation, use fan node rpm_deviation Signed-off-by: LeoCX_Tsai <[email protected]> --------- Signed-off-by: LeoCX_Tsai <[email protected]>
1 parent 423d189 commit 22daaf6

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

zephyr/program/lotus/lotus/project.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CONFIG_PLATFORM_EC_GPU_POWER_CONTROL=y
1212

1313
# Fan
1414
CONFIG_PLATFORM_EC_NUM_FANS=2
15+
CONFIG_PLATFORM_EC_FAN_BYPASS_SLOW_RESPONSE=y
1516

1617
#TypeC support
1718
CONFIG_PLATFORM_EC_USBC=n

zephyr/shim/include/config_chip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
739739
#endif
740740

741741
#undef CONFIG_FAN_BYPASS_SLOW_RESPONSE
742-
#ifdef PLATFORM_EC_FAN_BYPASS_SLOW_RESPONSE
742+
#ifdef CONFIG_PLATFORM_EC_FAN_BYPASS_SLOW_RESPONSE
743743
#define CONFIG_FAN_BYPASS_SLOW_RESPONSE
744744
#endif
745745

zephyr/shim/src/fan.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,19 @@ enum fan_status fan_smart_control(int ch)
202202
/* Record previous rpm */
203203
data->rpm_pre = rpm_actual;
204204

205-
/* Adjust PWM duty */
206-
rpm_diff = rpm_target - rpm_actual;
205+
/*
206+
* A specific type of fan needs a longer time to output the TACH
207+
* signal to EC after EC outputs the PWM signal to the fan.
208+
* During this period, the driver will read two consecutive RPM = 0.
209+
* In this case, don't step the PWM duty too aggressively.
210+
*/
211+
if (data->rpm_pre == 0 && rpm_actual == 0 &&
212+
IS_ENABLED(CONFIG_PLATFORM_EC_FAN_BYPASS_SLOW_RESPONSE)) {
213+
rpm_diff = (rpm_target * deviation / 100) + 1;
214+
} else {
215+
rpm_diff = rpm_target - rpm_actual;
216+
}
217+
207218
duty = fan_get_duty(ch);
208219
if (duty == 0 && rpm_target == 0) {
209220
return FAN_STATUS_STOPPED;

0 commit comments

Comments
 (0)