Hello. It's been about 6 months since I tweaked adt(4) to control
the temperature target that the cooling system uses to regulate
itself, following the source code of G4FanControl which may be found
around online.

This makes it possible to power the fans on earlier and thus improve
thermals and, hopefully, lifespan of the system which -given these
macppc machines are quite old and increasingly rare- I would argue
is worth preserving. I myself find it quite comfortable at 46 degC

Perhaps it would be better to add a sysctl to control the temperature
target? This diff is a fully functional proof of concept I guess,
would really appreciate your thoughts.

All the best

Index: dev/i2c/adt7460.c
===================================================================
RCS file: /cvs/src/sys/dev/i2c/adt7460.c,v
retrieving revision 1.22
diff -u -p -r1.22 adt7460.c
--- dev/i2c/adt7460.c   6 Apr 2022 18:59:28 -0000       1.22
+++ dev/i2c/adt7460.c   23 Nov 2023 16:23:48 -0000
@@ -34,6 +34,9 @@
 #define ADT7460_REM1_TEMP      0x25
 #define ADT7460_LOCAL_TEMP     0x26
 #define ADT7460_REM2_TEMP      0x27
+#define ADT7460_REM1_TEMP_TRG  0x68
+#define ADT7460_LOCAL_TEMP_TRG 0x67
+#define ADT7460_REM2_TEMP_TRG  0x69
 #define ADT7460_TACH1L         0x28
 #define ADT7460_TACH1H         0x29
 #define ADT7460_TACH2L         0x2a
@@ -193,6 +196,16 @@ adt_attach(struct device *parent, struct
                    sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
                        iic_release_bus(sc->sc_tag, 0);
                        printf(": cannot set control register\n");
+                       return;
+               }
+       }
+
+       for (cmd = ADT7460_LOCAL_TEMP_TRG; cmd <= ADT7460_REM2_TEMP_TRG; cmd++){
+               data = 46; /* temperature target in deg C*/
+               if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
+                   sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
+                       iic_release_bus(sc->sc_tag, 0);
+                       printf(": cannot set temperature target register\n");
                        return;
                }
        }

Reply via email to