diff --git a/src/board/system76/common/fan.c b/src/board/system76/common/fan.c index f833dfed3..531cdc464 100644 --- a/src/board/system76/common/fan.c +++ b/src/board/system76/common/fan.c @@ -95,14 +95,18 @@ void fan_event(void) { fan1_pwm_target = 0; fan1_pwm_actual = 0; } else if (fan1_pwm_actual < fan1_pwm_target) { - // TODO :Check against board-defined maximum if (fan1_pwm_actual < CTR0) { fan1_pwm_actual++; + if (fan1_pwm_actual < FAN1.pwm_min) { + fan1_pwm_actual = FAN1.pwm_min; + } } } else if (fan1_pwm_actual > fan1_pwm_target) { - // TODO: Check against board-defined minimum if (fan1_pwm_actual > 0) { fan1_pwm_actual--; + if (fan1_pwm_actual < FAN1.pwm_min) { + fan1_pwm_actual = 0; + } } } TRACE("FAN1 duty=%d\n", fan1_pwm_actual); @@ -119,14 +123,18 @@ void fan_event(void) { fan2_pwm_target = 0; fan2_pwm_actual = 0; } else if (fan2_pwm_actual < fan2_pwm_target) { - // TODO :Check against board-defined maximum if (fan2_pwm_actual < CTR0) { fan2_pwm_actual++; + if (fan2_pwm_actual < FAN2.pwm_min) { + fan2_pwm_actual = FAN2.pwm_min; + } } } else if (fan2_pwm_actual > fan2_pwm_target) { - // TODO: Check against board-defined minimum if (fan2_pwm_actual > 0) { fan2_pwm_actual--; + if (fan2_pwm_actual < FAN2.pwm_min) { + fan2_pwm_actual = 0; + } } } TRACE("FAN2 duty=%d\n", fan2_pwm_actual); diff --git a/src/board/system76/common/include/board/fan.h b/src/board/system76/common/include/board/fan.h index 99c98cbd4..9906577c0 100644 --- a/src/board/system76/common/include/board/fan.h +++ b/src/board/system76/common/include/board/fan.h @@ -18,6 +18,7 @@ struct FanPoint { struct Fan { const struct FanPoint *const points; const uint8_t points_size; + const uint8_t pwm_min; }; extern const struct Fan __code FAN1; diff --git a/src/board/system76/darp10-b/fan.c b/src/board/system76/darp10-b/fan.c index b2d31a6f2..9acd52bbe 100644 --- a/src/board/system76/darp10-b/fan.c +++ b/src/board/system76/darp10-b/fan.c @@ -17,6 +17,7 @@ static const struct FanPoint __code FAN1_POINTS[] = { const struct Fan __code FAN1 = { .points = FAN1_POINTS, .points_size = ARRAY_SIZE(FAN1_POINTS), + .pwm_min = PWM_DUTY(27), }; static const struct FanPoint __code FAN2_POINTS[] = { @@ -33,4 +34,5 @@ static const struct FanPoint __code FAN2_POINTS[] = { const struct Fan __code FAN2 = { .points = FAN2_POINTS, .points_size = ARRAY_SIZE(FAN2_POINTS), + .pwm_min = PWM_DUTY(27), }; diff --git a/src/board/system76/gaze17-3050/fan.c b/src/board/system76/gaze17-3050/fan.c index a5a8920c0..e4a3a9d66 100644 --- a/src/board/system76/gaze17-3050/fan.c +++ b/src/board/system76/gaze17-3050/fan.c @@ -16,6 +16,7 @@ static const struct FanPoint __code FAN1_POINTS[] = { const struct Fan __code FAN1 = { .points = FAN1_POINTS, .points_size = ARRAY_SIZE(FAN1_POINTS), + .pwm_min = PWM_DUTY(20), }; static const struct FanPoint __code FAN2_POINTS[] = { @@ -31,4 +32,5 @@ static const struct FanPoint __code FAN2_POINTS[] = { const struct Fan __code FAN2 = { .points = FAN2_POINTS, .points_size = ARRAY_SIZE(FAN2_POINTS), + .pwm_min = PWM_DUTY(20), }; diff --git a/src/board/system76/oryp11/fan.c b/src/board/system76/oryp11/fan.c index c3411b8d0..17c3fae60 100644 --- a/src/board/system76/oryp11/fan.c +++ b/src/board/system76/oryp11/fan.c @@ -16,6 +16,7 @@ static const struct FanPoint __code FAN1_POINTS[] = { const struct Fan __code FAN1 = { .points = FAN1_POINTS, .points_size = ARRAY_SIZE(FAN1_POINTS), + .pwm_min = PWM_DUTY(28), }; static const struct FanPoint __code FAN2_POINTS[] = { @@ -31,4 +32,5 @@ static const struct FanPoint __code FAN2_POINTS[] = { const struct Fan __code FAN2 = { .points = FAN2_POINTS, .points_size = ARRAY_SIZE(FAN2_POINTS), + .pwm_min = PWM_DUTY(28), }; diff --git a/src/board/system76/oryp6/fan.c b/src/board/system76/oryp6/fan.c index 6c293aebb..6c3e06b69 100644 --- a/src/board/system76/oryp6/fan.c +++ b/src/board/system76/oryp6/fan.c @@ -16,6 +16,7 @@ static const struct FanPoint __code FAN1_POINTS[] = { const struct Fan __code FAN1 = { .points = FAN1_POINTS, .points_size = ARRAY_SIZE(FAN1_POINTS), + .pwm_min = PWM_DUTY(25), }; static const struct FanPoint __code FAN2_POINTS[] = { @@ -31,4 +32,5 @@ static const struct FanPoint __code FAN2_POINTS[] = { const struct Fan __code FAN2 = { .points = FAN2_POINTS, .points_size = ARRAY_SIZE(FAN2_POINTS), + .pwm_min = PWM_DUTY(25), }; diff --git a/src/board/system76/oryp7/fan.c b/src/board/system76/oryp7/fan.c index 6c293aebb..6c3e06b69 100644 --- a/src/board/system76/oryp7/fan.c +++ b/src/board/system76/oryp7/fan.c @@ -16,6 +16,7 @@ static const struct FanPoint __code FAN1_POINTS[] = { const struct Fan __code FAN1 = { .points = FAN1_POINTS, .points_size = ARRAY_SIZE(FAN1_POINTS), + .pwm_min = PWM_DUTY(25), }; static const struct FanPoint __code FAN2_POINTS[] = { @@ -31,4 +32,5 @@ static const struct FanPoint __code FAN2_POINTS[] = { const struct Fan __code FAN2 = { .points = FAN2_POINTS, .points_size = ARRAY_SIZE(FAN2_POINTS), + .pwm_min = PWM_DUTY(25), }; diff --git a/src/board/system76/oryp8/fan.c b/src/board/system76/oryp8/fan.c index 6c293aebb..6c3e06b69 100644 --- a/src/board/system76/oryp8/fan.c +++ b/src/board/system76/oryp8/fan.c @@ -16,6 +16,7 @@ static const struct FanPoint __code FAN1_POINTS[] = { const struct Fan __code FAN1 = { .points = FAN1_POINTS, .points_size = ARRAY_SIZE(FAN1_POINTS), + .pwm_min = PWM_DUTY(25), }; static const struct FanPoint __code FAN2_POINTS[] = { @@ -31,4 +32,5 @@ static const struct FanPoint __code FAN2_POINTS[] = { const struct Fan __code FAN2 = { .points = FAN2_POINTS, .points_size = ARRAY_SIZE(FAN2_POINTS), + .pwm_min = PWM_DUTY(25), }; diff --git a/src/board/system76/serw13/fan.c b/src/board/system76/serw13/fan.c index bcee5409a..6bc93dfe6 100644 --- a/src/board/system76/serw13/fan.c +++ b/src/board/system76/serw13/fan.c @@ -15,6 +15,7 @@ static const struct FanPoint __code FAN1_POINTS[] = { const struct Fan __code FAN1 = { .points = FAN1_POINTS, .points_size = ARRAY_SIZE(FAN1_POINTS), + .pwm_min = PWM_DUTY(28), }; static const struct FanPoint __code FAN2_POINTS[] = { @@ -29,4 +30,5 @@ static const struct FanPoint __code FAN2_POINTS[] = { const struct Fan __code FAN2 = { .points = FAN2_POINTS, .points_size = ARRAY_SIZE(FAN2_POINTS), + .pwm_min = PWM_DUTY(28), };