Commit 23685aa41e1df277a87dded2ca3121263c67b29e

Con Kolivas 2012-02-05T17:28:53

Continue auto-management of fan and engine speeds even if a device is disabled for safety reasons.

diff --git a/adl.c b/adl.c
index e2434e2..048b177 100644
--- a/adl.c
+++ b/adl.c
@@ -1066,9 +1066,10 @@ void gpu_autotune(int gpu, bool *enable)
 			if (opt_debug)
 				applog(LOG_DEBUG, "Temperature %d degrees over target, decreasing clock speed", opt_hysteresis);
 			newengine = engine - ga->lpOdParameters.sEngineClock.iStep;
-			/* Only try to tune engine speed if the current performance level is at max */
+			/* Only try to tune engine speed up if the current performance level is at max and this GPU is not
+			 * disabled */
 		} else if ((ga->lpActivity.iCurrentPerformanceLevel == ga->lpOdParameters.iNumberOfPerformanceLevels - 1) &&
-			   (temp < ga->targettemp && engine < ga->maxspeed)) {
+			   (temp < ga->targettemp && engine < ga->maxspeed) && *enable) {
 			if (opt_debug)
 				applog(LOG_DEBUG, "Temperature below target, increasing clock speed");
 			newengine = engine + ga->lpOdParameters.sEngineClock.iStep;
diff --git a/cgminer.c b/cgminer.c
index 04879b5..b86d857 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3690,7 +3690,7 @@ static void *watchdog_thread(void *userdata)
 			gpu = thr->cgpu->device_id;
 			enable = &cgpu->enabled;
 #ifdef HAVE_ADL
-			if (adl_active && gpus[gpu].has_adl && *enable)
+			if (adl_active && gpus[gpu].has_adl)
 				gpu_autotune(gpu, enable);
 			if (opt_debug && gpus[gpu].has_adl) {
 				int engineclock = 0, memclock = 0, activity = 0, fanspeed = 0, fanpercent = 0, powertune = 0;