Browse Source

Only set the speed once, but set it only if fanspeed get says the card is ok and ready.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
3c38adc9ce
  1. 37
      adl.c

37
adl.c

@ -730,39 +730,6 @@ static void get_fanrange(int gpu, int *imin, int *imax) @@ -730,39 +730,6 @@ static void get_fanrange(int gpu, int *imin, int *imax)
*imax = ga->lpFanSpeedInfo.iMaxPercent;
}
/* This is overkill, but the safest way to set the fan is to round it up to
* very coarse multiples of 100, 50, 20, 10, 5 in case the card does not
* support finer values */
static int __set_fanspeed(int gpu, int iFanSpeed)
{
struct gpu_adl *ga = &gpus[gpu].adl;
int speed;
applog(LOG_INFO, "Setting fanspeed to %d", iFanSpeed);
speed = iFanSpeed + 99;
speed -= speed % 100;
ga->lpFanSpeedValue.iFanSpeed = speed;
ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
speed = iFanSpeed + 49;
speed -= speed % 50;
ga->lpFanSpeedValue.iFanSpeed = speed;
ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
speed = iFanSpeed + 19;
speed -= speed % 20;
ga->lpFanSpeedValue.iFanSpeed = speed;
ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
speed = iFanSpeed + 9;
speed -= speed % 10;
ga->lpFanSpeedValue.iFanSpeed = speed;
ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
speed = iFanSpeed + 4;
speed -= speed % 5;
ga->lpFanSpeedValue.iFanSpeed = speed;
ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
ga->lpFanSpeedValue.iFanSpeed = iFanSpeed;
return ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
}
static int set_fanspeed(int gpu, int iFanSpeed)
{
struct gpu_adl *ga;
@ -787,7 +754,7 @@ static int set_fanspeed(int gpu, int iFanSpeed) @@ -787,7 +754,7 @@ static int set_fanspeed(int gpu, int iFanSpeed)
lock_adl();
if (ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue) != ADL_OK) {
if (opt_debug)
applog(LOG_DEBUG, "GPU %d doesn't support fanspeed get", gpu);
applog(LOG_DEBUG, "GPU %d call to fanspeed get failed", gpu);
goto out;
}
if (!(ga->lpFanSpeedInfo.iFlags & ADL_DL_FANCTRL_SUPPORTS_PERCENT_WRITE)) {
@ -801,7 +768,7 @@ static int set_fanspeed(int gpu, int iFanSpeed) @@ -801,7 +768,7 @@ static int set_fanspeed(int gpu, int iFanSpeed)
ga->lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
}
ret = __set_fanspeed(gpu, iFanSpeed);
ret = ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
ga->managed = true;
out:
unlock_adl();

Loading…
Cancel
Save