Skip to content

Commit

Permalink
Sync fans based on temp instead of duty
Browse files Browse the repository at this point in the history
Fans may be different sizes, placed in asymmetrical positions, or have
different amounts of venting through the chassis. These characteristics
affect the ability for each fan, separately, to dissipate heat and
generate noise.

Replace syncing fans to the highest duty calculated for each fan, based
on separate thermal sensors, to using the highest reported temperature
across all sensors to calculate each fan's duty for that highest
temperature.

In other words: The old behavior synced fans based on the *output* value
(duty), while this new behavior syncs fans based on the *input* value
(temperature).

This allows tuning fans separately to better manage total system
thermals and mitigate noise.

Signed-off-by: Tim Crawford <[email protected]>
  • Loading branch information
crawfxrd authored and jackpot51 committed Aug 15, 2024
1 parent 2925376 commit 710b479
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 6 additions & 9 deletions src/board/system76/common/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,15 @@ static uint8_t fan_get_duty(const struct Fan *const fan, int16_t temp) {
}

void fan_update_duty(void) {
#if defined(FAN2_PWM) && !CONFIG_HAVE_DGPU
int16_t dgpu_temp = peci_temp;
#if CONFIG_HAVE_DGPU
int16_t sys_temp = MAX(peci_temp, dgpu_temp);
#else
int16_t sys_temp = peci_temp;
#endif

uint8_t fan1_duty = fan_get_duty(&FAN1, peci_temp);
uint8_t fan1_duty = fan_get_duty(&FAN1, sys_temp);
#ifdef FAN2_PWM
uint8_t fan2_duty = fan_get_duty(&FAN2, dgpu_temp);

#if SYNC_FANS != 0
fan1_duty = MAX(fan1_duty, fan2_duty);
fan2_duty = MAX(fan1_duty, fan2_duty);
#endif // SYNC_FANS
uint8_t fan2_duty = fan_get_duty(&FAN2, sys_temp);
#endif // FAN2_PWM

// set FAN1 duty
Expand Down
4 changes: 0 additions & 4 deletions src/board/system76/common/include/board/fan.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
#define SMOOTH_FANS 1 // default to fan smoothing
#endif

#ifndef SYNC_FANS
#define SYNC_FANS 1 // default to syncing fan speeds
#endif

#if SMOOTH_FANS != 0
#ifndef SMOOTH_FANS_UP
#define SMOOTH_FANS_UP 45 // default to ~11 seconds for full ramp-up
Expand Down

0 comments on commit 710b479

Please sign in to comment.