git: fc3eca391341 - main - powerpmac_thermal: Improve thermal regulation on G5 quad models

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Sat, 12 Sep 2026 02:12:04 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=fc3eca391341f1d354340ef41e059c0fce6afa8e

commit fc3eca391341f1d354340ef41e059c0fce6afa8e
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2025-03-10 03:10:49 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2026-09-12 02:05:06 +0000

    powerpmac_thermal: Improve thermal regulation on G5 quad models
    
    Add a new "high temp" threshold below the max temp, in order to ramp the
    fans (or pump for liquid cooled quads) sooner, and avoid the maximum
    temperature.  From the PR, this makes older G5 quads louder, but usable,
    instead of hitting max temperature and forcing a thermal shutdown.
    
    PR:             209202
    Submitted by:   gmbroome (PR)
---
 sys/powerpc/powermac/powermac_thermal.c | 6 +++---
 sys/powerpc/powermac/powermac_thermal.h | 2 +-
 sys/powerpc/powermac/smu.c              | 5 +++--
 sys/powerpc/powermac/smusat.c           | 5 +++--
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/sys/powerpc/powermac/powermac_thermal.c b/sys/powerpc/powermac/powermac_thermal.c
index a7e66cc2b80d..39490dca9cd4 100644
--- a/sys/powerpc/powermac/powermac_thermal.c
+++ b/sys/powerpc/powermac/powermac_thermal.c
@@ -42,7 +42,7 @@
 #include "powermac_thermal.h"
 
 /* A 10 second timer for spinning down fans. */
-#define FAN_HYSTERESIS_TIMER	10
+#define FAN_HYSTERESIS_TIMER	30
 
 static void fan_management_proc(void);
 static void pmac_therm_manage_fans(void);
@@ -142,10 +142,10 @@ pmac_therm_manage_fans(void)
 		average_excess = max_excess_zone = 0;
 		SLIST_FOREACH(sensor, &sensors, entries) {
 			temp = imin(sensor->last_val,
-			    sensor->sensor->max_temp);
+			    sensor->sensor->high_temp);
 			frac_excess = (temp -
 			    sensor->sensor->target_temp)*100 /
-			    (sensor->sensor->max_temp - temp + 1);
+			    (sensor->sensor->high_temp - temp + 1);
 			if (frac_excess < 0)
 				frac_excess = 0;
 			if (sensor->sensor->zone == fan->fan->zone) {
diff --git a/sys/powerpc/powermac/powermac_thermal.h b/sys/powerpc/powermac/powermac_thermal.h
index 96c6a8adfffe..4374416f7519 100644
--- a/sys/powerpc/powermac/powermac_thermal.h
+++ b/sys/powerpc/powermac/powermac_thermal.h
@@ -42,7 +42,7 @@ struct pmac_fan {
 };
 
 struct pmac_therm {
-	int target_temp, max_temp;	/* Tenths of a degree K */
+	int target_temp, high_temp, max_temp;	/* Tenths of a degree K */
 
 	char name[32];
 	int zone;
diff --git a/sys/powerpc/powermac/smu.c b/sys/powerpc/powermac/smu.c
index 8107ef8ef790..9025ec75ada4 100644
--- a/sys/powerpc/powermac/smu.c
+++ b/sys/powerpc/powermac/smu.c
@@ -1244,8 +1244,9 @@ smu_attach_sensors(device_t dev, phandle_t sensroot)
 
 		if (sens->type == SMU_TEMP_SENSOR) {
 			/* Make up some numbers */
-			sens->therm.target_temp = 500 + 2731; /* 50 C */
-			sens->therm.max_temp = 900 + 2731; /* 90 C */
+			sens->therm.target_temp = 400 + 2732; /* 40 C */
+			sens->therm.high_temp = 750 + 2732; /* 75 C */
+			sens->therm.max_temp = 950 + 2732; /* 95 C */
 
 			sens->therm.read =
 			    (int (*)(struct pmac_therm *))smu_sensor_read;
diff --git a/sys/powerpc/powermac/smusat.c b/sys/powerpc/powermac/smusat.c
index 5639daa28501..7e9d7889e79d 100644
--- a/sys/powerpc/powermac/smusat.c
+++ b/sys/powerpc/powermac/smusat.c
@@ -181,8 +181,9 @@ smusat_attach(device_t dev)
 
 		if (sens->type == SMU_TEMP_SENSOR) {
 			/* Make up some numbers */
-			sens->therm.target_temp = 500 + 2731; /* 50 C */
-			sens->therm.max_temp = 900 + 2731; /* 90 C */
+			sens->therm.target_temp = 400 + 2732; /* 40 C */
+			sens->therm.high_temp = 750 + 2732; /* 75 C */
+			sens->therm.max_temp = 950 + 2732; /* 95 C */
 			sens->therm.read =
 			    (int (*)(struct pmac_therm *))smusat_sensor_read;
 			pmac_thermal_sensor_register(&sens->therm);