[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: powerbook fan behaviour, therm_adt7467






Georg C. Kaindl wrote:
hi,

  
As long as you make sure there's some code to switch the fans to full
speed at some threshold you should be safe. The module needs some more
tweaking anyway - it's written for iBook where there's a CPU and GPU fan
but the PowerBook seems to have just two exhaust fans, and the sensors
don't sit on the CPU and GPU, exactly (the 'GPU' sensor really measures
the power supply temp). For me, the 'GPU' limit needs to be reduced or
both fans need to be synced to identical speed to keep the machine from
crashing too often. Depending on your sensor and fan locations, you might
benefit from similar tweaks (list the fan node in the OF device tree,
mine's at uni-north/i2c/fan).
    
hmm, I'm a bit puzzled right now: according to the given location in the OF 
device tree, I have only one fan in my 12" powerbook, located at the "REAR 
MAIN ENCLOSURE"...

anyways, if you have 2 exhaust fans, it would make sense to set the limit to 
min(cpu_limit, gpu_limit) for both of them... however, if I'm not mistaken, a 
temporary workaround for this would be to tamper with lines 46,47 in 
therm_adt746x.c and recompile the module (line 47 seeming to be the more 
relevant one).

  
Making the fan start out slower and gradually increasing the speed would
be just a minor add-on :-)
    
message received, I'll look into that... it would probably be nice to have 
another module parameter like "fan_step" and "limit_override", so that when 
the temperature reaches "limit", the fan speed is set to fan_speed and then 
gets increased by fan_step every one or two degrees until limit_override is 
reached which would in turn set the fan to full speed.

does anybody know how OS X handles the fan speed i.e. at which temperatures 
does it start the fan(s), what increments does it use and when does it go to 
full speed?

regards,
Georg Kaindl


  
Why not something like this?

int minTemp 50;  //min temperature the fan can cool too
int maxTemp 60; //the max temperate when the fan turns on 100%
int tempStep = 5; 
//The temperature difference required for the fan to increase or
//decrease speed    

int currentStep = minTemp; //currentStep starts out at minTemp or fan speed 0%

//If the current temperature is atleast a step below the currentStep, decrease the
//currentStep by one which slows the fan speed down one.  If the current temperature
//is greater then the currentStep then set the currentStep to the newStep.
void setCurrentStep(int currentTemp) {
    int step = currentTemp / tempStep * tempStep; //force the current temp to fall on a step
    if(step < currentStep - tempStep) {
       currentStep--;
    }
    else if(step > currentStep) {
       if(step > maxTemp) step = maxTemp;  //so it doesn't try to run the fan at 150%
       currentStep = step;  //so it can jump multiple steps per call
    }
}

//set the current fan speed based on the current step.  min = 0% max = 100%
//and the fan speed scales linearly with the temperature. Increasing a certain
//percentage for each step above minTemp
double getFanSpeed() {
    return (currentStep - minTemp) / (maxTemp - minTemp);
}

So in this example the fan runs at 0% at [50-55)
50% at [55-60)
100% at [60-60+)

When the temp becomes 55 or more, the fan speed becomes 50%
Inorder for the fan to slow down from 50% the temperature must go below 50.
Likewise when the temp becomes 60 the fan speed becomes 100%
Inorder for the fan to slow down from 100% the temperature must go below 55.

You can make the fan speed changes less severe by changing the tempStep value.  But at a certain point you can set the value so low that the fan can start to undergo hysteresis.  Also when the fan does get to that point the changes in the fan speed will be small.  This is also mitigated by the example code using ints, which means the minimum step is 1 degree.

Also if the fan can't cool the computer below minTemp it won't turn off.
I didn't compile or test this code.
I didn't look at the therm_adt7467 code either.

Hope that makes sense and solves the problem. 

Mike Power

Reply to: