On Sat, Apr 16, 2016 at 09:56:21PM +0200, Olivier Cherrier wrote:

> And what about trying this ?
> 
> http://marc.info/?t=145428070600001&r=1&w=2
> 
> (It works well for the iMac G5).
> 
> Thanks,
> Best
> oc

Thanks for pointing this out.  But my issue here happens even one step
before, when the driver can't set the initial unmanage/safe/average
value because on my machine this property is called 'safe-value' instead
of 'unmanage-value'.  Could you send the eeprom -p of your machine as
well?  I wonder if the property there is called 'unmanage-value' or
'unmanaged-value'.

Anyway, taken in to account of the 'safe-value' property as well, the
below diff works perfectly fine in my case:

        $ sysctl -a | grep smu
        hw.sensors.smu0.temp0=33.87 degC (CPU T-Diode)
        hw.sensors.smu0.fan0=999 RPM (Rear Fan 0)
        hw.sensors.smu0.fan1=1002 RPM (Rear fan 1)
        hw.sensors.smu0.fan2=1002 RPM (Front Fan)
        hw.sensors.smu0.volt0=12.17 VDC (CPU Voltage)
        hw.sensors.smu0.power0=11.31 W (Slots Power)
        hw.sensors.smu0.current0=1.07 A (CPU Current)

This diff doesn't change the current behaviour but takes 'safe-value'
in to account.


Index: sys/arch/macppc/dev/smu.c
===================================================================
RCS file: /cvs/src/sys/arch/macppc/dev/smu.c,v
retrieving revision 1.27
diff -u -p -u -p -r1.27 smu.c
--- sys/arch/macppc/dev/smu.c   4 Jun 2015 18:01:44 -0000       1.27
+++ sys/arch/macppc/dev/smu.c   17 Apr 2016 05:08:16 -0000
@@ -43,7 +43,7 @@ struct smu_fan {
        u_int8_t        reg;
        u_int16_t       min_rpm;
        u_int16_t       max_rpm;
-       u_int16_t       unmanaged_rpm;
+       u_int16_t       avg_rpm;
        struct ksensor  sensor;
 };
 
@@ -280,16 +280,17 @@ smu_attach(struct device *parent, struct
                if (OF_getprop(node, "max-value", &val, sizeof val) <= 0)
                        val = 0xffff;
                fan->max_rpm = val;
-               if (OF_getprop(node, "unmanage-value", &val, sizeof val) <= 0)
+               if (OF_getprop(node, "unmanage-value", &val, sizeof val) <= 0 &&
+                   OF_getprop(node, "safe-value", &val, sizeof val) <= 0)
                        val = fan->max_rpm;
-               fan->unmanaged_rpm = val;
+               fan->avg_rpm = val;
 
                if (OF_getprop(node, "location", loc, sizeof loc) <= 0)
                        strlcpy(loc, "Unknown", sizeof loc);
                strlcpy(fan->sensor.desc, loc, sizeof sensor->sensor.desc);
 
-               /* Start running fans at their "unmanaged" speed. */
-               smu_fan_set_rpm(sc, fan, fan->unmanaged_rpm);
+               /* Start running fans at their "average" speed. */
+               smu_fan_set_rpm(sc, fan, fan->avg_rpm);
 
 #ifndef SMALL_KERNEL
                sensor_attach(&sc->sc_sensordev, &fan->sensor);

Reply via email to