Always send the bxf device a clockspeed after parsing the temperature in case the device has changed the clockspeed itself without notification.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 30f8647..b790ff3 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -389,6 +389,7 @@ static bool bxf_send_clock(struct cgpu_info *bitfury, struct bitfury_info *info,
static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info, char *buf)
{
+ uint8_t clockspeed = BXF_CLOCK_DEFAULT;
int decitemp;
if (!sscanf(&buf[5], "%d", &decitemp)) {
@@ -411,7 +412,7 @@ static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info,
goto out;
applog(LOG_WARNING, "%s %d: Hit overheat temperature of %d, throttling!",
bitfury->drv->name, bitfury->device_id, decitemp);
- bxf_send_clock(bitfury, info, BXF_CLOCK_MIN);
+ clockspeed = BXF_CLOCK_MIN;
goto out;
}
if (decitemp > info->temp_target) {
@@ -421,7 +422,7 @@ static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info,
goto out;
applog(LOG_INFO, "%s %d: Temp %d over target and not falling, decreasing clock",
bitfury->drv->name, bitfury->device_id, decitemp);
- bxf_send_clock(bitfury, info, info->clocks - 1);
+ clockspeed = info->clocks - 1;
goto out;
}
if (decitemp <= info->temp_target && decitemp >= info->temp_target - BXF_TEMP_HYSTERESIS) {
@@ -432,7 +433,7 @@ static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info,
goto out;
applog(LOG_DEBUG, "%s %d: Temp %d in target and rising, decreasing clock",
bitfury->drv->name, bitfury->device_id, decitemp);
- bxf_send_clock(bitfury, info, info->clocks - 1);
+ clockspeed = info->clocks - 1;
goto out;
}
/* implies: decitemp < info->last_decitemp */
@@ -440,7 +441,7 @@ static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info,
goto out;
applog(LOG_DEBUG, "%s %d: Temp %d in target and falling, increasing clock",
bitfury->drv->name, bitfury->device_id, decitemp);
- bxf_send_clock(bitfury, info, info->clocks + 1);
+ clockspeed = info->clocks + 1;
goto out;
}
/* implies: decitemp < info->temp_target - BXF_TEMP_HYSTERESIS */
@@ -448,8 +449,9 @@ static void parse_bxf_temp(struct cgpu_info *bitfury, struct bitfury_info *info,
goto out;
applog(LOG_DEBUG, "%s %d: Temp %d below target, increasing clock",
bitfury->drv->name, bitfury->device_id, decitemp);
- bxf_send_clock(bitfury, info, info->clocks + 1);
+ clockspeed = info->clocks + 1;
out:
+ bxf_send_clock(bitfury, info, clockspeed);
info->last_decitemp = decitemp;
}