On Mon, Apr 18, 2016 at 10:31:27AM +0200, Martin Pieuchot wrote:

> On 18/04/16(Mon) 00:22, Marcus Glocker wrote:
> > On Sun, Apr 17, 2016 at 11:33:18PM +0200, Olivier Cherrier wrote:
> > 
> > > With this diff, the fans go at their maximun speed and stay like that:
> > >   $ sysctl hw.sensors
> > >   hw.sensors.smu0.temp0=31.75 degC (CPU T-Diode)
> > >   hw.sensors.smu0.fan0=4018 RPM (System Fan)
> > >   hw.sensors.smu0.fan1=4018 RPM (CPU fan)
> > >   hw.sensors.smu0.fan2=4018 RPM (Hard Drive)
> > >   hw.sensors.smu0.volt0=11.88 VDC (CPU Voltage)
> > >   hw.sensors.smu0.current0=0.59 A (CPU Current)
> > >   hw.sensors.lmtemp0.temp0=31.00 degC
> > > 
> > > In this version (the patch you sent), nothing is responsible of setting 
> > > the
> > > fan speeds according to the temp; isn't it ?
> > 
> > Yes, I was just looking after adjusting the setting of the initial fan
> > speed to something more silent than currently :-)  The fan control based
> > on the temperature would be the next step, like you and mpi@ already
> > provided some diffs.  I'll try to test them soon as well.
> > 
> > On your machine there is no average value at all.  Just min-value and
> > max-value.  If the average value can't be figured out I personally would
> > prefer trying to set the initial fan speed to min-value then.
> 
> Looking at all the G5 device-trees I found, the value of "unmanage-value"
> always match the "max-value" of the same node.  So I'd suggest using
> that.
> 
> Note that there's some code in FreeBSD to do proper sensor management
> via i2c, porting that might be a more complete solution.

I agree there should be a solution which manages the fan speed like
the FreeBSD driver does.  I had a quick look at it, but it doesn't
seem so easy to port since it uses e.g. a thermal framework (running
as a kthread) which we have not in place yet.

For the time beeing can we at least also take care about those machines
which have the 'safe-value' set?  This diff doesn't change the current
behaviour but fixes at least the initial fan speed of those machines.


Index: 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
--- smu.c       4 Jun 2015 18:01:44 -0000       1.27
+++ smu.c       3 May 2016 17:32:23 -0000
@@ -280,9 +280,12 @@ 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)
-                       val = fan->max_rpm;
-               fan->unmanaged_rpm = val;
+               if (OF_getprop(node, "unmanage-value", &val, sizeof val) > 0)
+                       fan->unmanaged_rpm = val;
+               else if (OF_getprop(node, "safe-value", &val, sizeof val) > 0)
+                       fan->unmanaged_rpm = val;
+               else
+                       fan->unmanaged_rpm = fan->max_rpm;
 
                if (OF_getprop(node, "location", loc, sizeof loc) <= 0)
                        strlcpy(loc, "Unknown", sizeof loc);

Reply via email to