Skip to content

Commit

Permalink
Require boards to declare fan points
Browse files Browse the repository at this point in the history
Thermal properties of each model differ and they should not rely on an
arbitrary, unoptimized set of fan points.

It is one thing to copy the points from the previous generation for a
model, as a lot of the time the chassis design is nearly identical, but
it should be always be explicit.

Signed-off-by: Tim Crawford <[email protected]>
  • Loading branch information
crawfxrd committed Jul 8, 2024
1 parent b03dc89 commit c1c7363
Show file tree
Hide file tree
Showing 42 changed files with 282 additions and 138 deletions.
10 changes: 5 additions & 5 deletions src/board/system76/addw1/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=180 \
-DPOWER_LIMIT_DC=45

# Custom fan curve
# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(60, 40), \
Expand All @@ -43,10 +47,6 @@ CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(80, 100), \
"

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

CFLAGS += -DFAN2_PWM=DCR4
CFLAGS += -DBOARD_FAN2_POINTS="\
FAN_POINT(60, 40), \
Expand Down
10 changes: 5 additions & 5 deletions src/board/system76/addw2/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=180 \
-DPOWER_LIMIT_DC=45

# Custom fan curve
# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(60, 40), \
Expand All @@ -43,10 +47,6 @@ CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(80, 100), \
"

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

CFLAGS += -DFAN2_PWM=DCR4
CFLAGS += -DBOARD_FAN2_POINTS="\
FAN_POINT(60, 40), \
Expand Down
10 changes: 5 additions & 5 deletions src/board/system76/addw3/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=280 \
-DPOWER_LIMIT_DC=55

# Custom fan curve
# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_HEATUP=5
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
Expand All @@ -54,10 +58,6 @@ CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(80, 100), \
"

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

CFLAGS += -DFAN2_PWM=DCR4
CFLAGS += -DBOARD_FAN2_HEATUP=5
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
Expand Down
10 changes: 5 additions & 5 deletions src/board/system76/addw4/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ CFLAGS += \
-DPOWER_LIMIT_AC=230 \
-DPOWER_LIMIT_DC=45

# Custom fan curve
# Enable DGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_HEATUP=5
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
Expand All @@ -52,10 +56,6 @@ CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(90, 100), \
"

# Enable DGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

CFLAGS += -DFAN2_PWM=DCR4
CFLAGS += -DBOARD_FAN2_HEATUP=5
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
Expand Down
10 changes: 5 additions & 5 deletions src/board/system76/bonw14/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=180 \
-DPOWER_LIMIT_DC=45

# Custom fan curve
# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(60, 40), \
Expand All @@ -43,10 +47,6 @@ CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(80, 100), \
"

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

CFLAGS += -DFAN2_PWM=DCR4
CFLAGS += -DBOARD_FAN2_POINTS="\
FAN_POINT(60, 40), \
Expand Down
10 changes: 5 additions & 5 deletions src/board/system76/bonw15/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=330 \
-DPOWER_LIMIT_DC=55

# Custom fan curve
# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_HEATUP=5
CFLAGS += -DBOARD_FAN1_COOLDOWN=20
Expand All @@ -59,10 +63,6 @@ CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(80, 100), \
"

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

CFLAGS += -DFAN2_PWM=DCR4
CFLAGS += -DBOARD_FAN2_HEATUP=5
CFLAGS += -DBOARD_FAN2_COOLDOWN=20
Expand Down
28 changes: 10 additions & 18 deletions src/board/system76/common/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,15 @@ static uint8_t FAN1_HEATUP[BOARD_FAN1_HEATUP] = { 0 };
static uint8_t FAN1_COOLDOWN[BOARD_FAN1_COOLDOWN] = { 0 };

// Fan curve with temperature in degrees C, duty cycle in percent
static struct FanPoint __code FAN1_POINTS[] = {
#ifdef BOARD_FAN1_POINTS
BOARD_FAN1_POINTS
static const struct FanPoint __code FAN1_POINTS[] = {
#ifndef BOARD_FAN1_POINTS
#error Board must declare fan points
#else
FAN_POINT(70, 40),
FAN_POINT(75, 50),
FAN_POINT(80, 60),
FAN_POINT(85, 65),
FAN_POINT(90, 65),
BOARD_FAN1_POINTS
#endif
};

static struct Fan __code FAN1 = {
static const struct Fan __code FAN1 = {
.points = FAN1_POINTS,
.points_size = ARRAY_SIZE(FAN1_POINTS),
.heatup = FAN1_HEATUP,
Expand All @@ -79,19 +75,15 @@ static uint8_t FAN2_HEATUP[BOARD_FAN2_HEATUP] = { 0 };
static uint8_t FAN2_COOLDOWN[BOARD_FAN2_COOLDOWN] = { 0 };

// Fan curve with temperature in degrees C, duty cycle in percent
static struct FanPoint __code FAN2_POINTS[] = {
#ifdef BOARD_FAN2_POINTS
BOARD_FAN2_POINTS
static const struct FanPoint __code FAN2_POINTS[] = {
#ifndef BOARD_FAN2_POINTS
#error Board must declare fan points
#else
FAN_POINT(70, 40),
FAN_POINT(75, 50),
FAN_POINT(80, 60),
FAN_POINT(85, 65),
FAN_POINT(90, 65),
BOARD_FAN2_POINTS
#endif
};

static struct Fan __code FAN2 = {
static const struct Fan __code FAN2 = {
.points = FAN2_POINTS,
.points_size = ARRAY_SIZE(FAN2_POINTS),
.heatup = FAN2_HEATUP,
Expand Down
16 changes: 16 additions & 0 deletions src/board/system76/darp10-b/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,24 @@ CFLAGS += \
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

CFLAGS += -DFAN2_PWM=DCR3
CFLAGS += -DBOARD_FAN2_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add common code
include src/board/system76/common/common.mk
16 changes: 16 additions & 0 deletions src/board/system76/darp10/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,24 @@ CFLAGS += \
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

CFLAGS += -DFAN2_PWM=DCR3
CFLAGS += -DBOARD_FAN2_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add common code
include src/board/system76/common/common.mk
8 changes: 8 additions & 0 deletions src/board/system76/darp5/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
8 changes: 8 additions & 0 deletions src/board/system76/darp6/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
8 changes: 8 additions & 0 deletions src/board/system76/darp7/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
8 changes: 8 additions & 0 deletions src/board/system76/darp8/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
8 changes: 8 additions & 0 deletions src/board/system76/darp9/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
8 changes: 8 additions & 0 deletions src/board/system76/galp3-c/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=40 \
-DPOWER_LIMIT_DC=28

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
8 changes: 8 additions & 0 deletions src/board/system76/galp4/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=40 \
-DPOWER_LIMIT_DC=28

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
10 changes: 5 additions & 5 deletions src/board/system76/galp5/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Custom fan curve
# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 25), \
Expand All @@ -49,10 +53,6 @@ CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(88, 100), \
"

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CFLAGS += -DI2C_DGPU=I2C_1

CFLAGS += -DFAN2_PWM=DCR4
CFLAGS += -DBOARD_FAN2_POINTS="\
FAN_POINT(70, 25), \
Expand Down
8 changes: 8 additions & 0 deletions src/board/system76/galp6/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ CFLAGS+=\
-DPOWER_LIMIT_AC=65 \
-DPOWER_LIMIT_DC=45

# Fan configs
CFLAGS += -DFAN1_PWM=DCR2
CFLAGS += -DBOARD_FAN1_POINTS="\
FAN_POINT(70, 40), \
FAN_POINT(75, 50), \
FAN_POINT(80, 60), \
FAN_POINT(85, 65), \
FAN_POINT(90, 65), \
"

# Add system76 common code
include src/board/system76/common/common.mk
Loading

0 comments on commit c1c7363

Please sign in to comment.