Browse Source

Check last temperature we reached and don't change fan speed if it's already correcting.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
0ae3f71824
  1. 9
      adl.c
  2. 1
      miner.h

9
adl.c

@ -79,6 +79,7 @@ static int iNumberAdapters; @@ -79,6 +79,7 @@ static int iNumberAdapters;
static LPAdapterInfo lpInfo = NULL;
static int set_fanspeed(int gpu, int iFanSpeed);
static float __gpu_temp(struct gpu_adl *ga);
static inline void lock_adl(void)
{
@ -326,10 +327,11 @@ void init_adl(int nDevs) @@ -326,10 +327,11 @@ void init_adl(int nDevs)
ga->autoengine = true;
ga->managed = true;
}
ga->lasttemp = __gpu_temp(ga);
}
}
static inline float __gpu_temp(struct gpu_adl *ga)
static float __gpu_temp(struct gpu_adl *ga)
{
if (ADL_Overdrive5_Temperature_Get(ga->iAdapterIndex, 0, &ga->lpTemperature) != ADL_OK)
return -1;
@ -828,7 +830,7 @@ void gpu_autotune(int gpu, bool *enable) @@ -828,7 +830,7 @@ void gpu_autotune(int gpu, bool *enable)
if (temp > ga->overtemp && fanpercent < iMax) {
applog(LOG_WARNING, "Overheat detected on GPU %d, increasing fan to 100%", gpu);
newpercent = iMax;
} else if (temp > ga->targettemp && fanpercent < top) {
} else if (temp > ga->targettemp && fanpercent < top && temp >= ga->lasttemp) {
if (opt_debug)
applog(LOG_DEBUG, "Temperature over target, increasing fanspeed");
if (temp > ga->targettemp + opt_hysteresis)
@ -837,7 +839,7 @@ void gpu_autotune(int gpu, bool *enable) @@ -837,7 +839,7 @@ void gpu_autotune(int gpu, bool *enable)
newpercent = ga->targetfan + 5;
if (newpercent > top)
newpercent = top;
} else if (fanpercent > bot && temp < ga->targettemp - opt_hysteresis) {
} else if (fanpercent > bot && temp < ga->targettemp - opt_hysteresis && temp <= ga->lasttemp) {
if (opt_debug)
applog(LOG_DEBUG, "Temperature %d degrees below target, decreasing fanspeed", opt_hysteresis);
newpercent = ga->targetfan - 1;
@ -882,6 +884,7 @@ void gpu_autotune(int gpu, bool *enable) @@ -882,6 +884,7 @@ void gpu_autotune(int gpu, bool *enable)
set_engineclock(gpu, newengine);
}
}
ga->lasttemp = temp;
}
void set_defaultfan(int gpu)

1
miner.h

@ -179,6 +179,7 @@ struct gpu_adl { @@ -179,6 +179,7 @@ struct gpu_adl {
bool autoengine;
bool managed; /* Were the values ever changed on this card */
int lasttemp;
int targetfan;
int targettemp;
int overtemp;

Loading…
Cancel
Save