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.
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 17 Apr 2016 22:05:55 -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)
- val = fan->max_rpm;
- fan->unmanaged_rpm = val;
+ if (OF_getprop(node, "unmanage-value", &val, sizeof val) <= 0 &&
+ OF_getprop(node, "safe-value", &val, sizeof val) <= 0)
+ val = fan->min_rpm;
+ 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);