Set bflsc cutoff temperature to 85 degrees and throttle 3 degrees below the cutoff temperature.
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/driver-bflsc.c b/driver-bflsc.c
index ea82951..9d812c2 100644
--- a/driver-bflsc.c
+++ b/driver-bflsc.c
@@ -1007,6 +1007,36 @@ static void bflsc_flash_led(struct cgpu_info *bflsc, int dev)
return;
}
+/* Flush and stop all work if the device reaches the thermal cutoff temp, or
+ * temporarily stop queueing work if it's in the throttling range. */
+static void bflsc_manage_temp(struct cgpu_info *bflsc, struct bflsc_dev *sc_dev,
+ int dev, float temp)
+{
+ bflsc->temp = temp;
+ if (bflsc->cutofftemp > 0) {
+ int cutoff = bflsc->cutofftemp;
+ int throttle = cutoff - BFLSC_TEMP_THROTTLE;
+ int recover = cutoff - BFLSC_TEMP_RECOVER;
+
+ if (sc_dev->overheat) {
+ if (temp < recover)
+ sc_dev->overheat = false;
+ } else if (temp > throttle) {
+ sc_dev->overheat = true;
+ if (temp > cutoff) {
+ applog(LOG_WARNING, "%s%i: temp (%.1f) hit thermal cutoff limit %d, stopping work!",
+ bflsc->drv->name, bflsc->device_id, temp, cutoff);
+ dev_error(bflsc, REASON_DEV_THERMAL_CUTOFF);
+ flush_one_dev(bflsc, dev);
+
+ } else {
+ applog(LOG_NOTICE, "%s%i: temp (%.1f) hit thermal throttle limit %d, throttling",
+ bflsc->drv->name, bflsc->device_id, temp, throttle);
+ }
+ }
+ }
+}
+
static bool bflsc_get_temp(struct cgpu_info *bflsc, int dev)
{
struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_data);
@@ -1200,20 +1230,7 @@ static bool bflsc_get_temp(struct cgpu_info *bflsc, int dev)
if (temp < temp2)
temp = temp2;
- bflsc->temp = temp;
-
- if (bflsc->cutofftemp > 0 && temp >= bflsc->cutofftemp) {
- applog(LOG_WARNING, "%s%i:%s temp (%.1f) hit thermal cutoff limit %d, stopping work!",
- bflsc->drv->name, bflsc->device_id, xlink,
- temp, bflsc->cutofftemp);
- dev_error(bflsc, REASON_DEV_THERMAL_CUTOFF);
- sc_dev->overheat = true;
- flush_one_dev(bflsc, dev);
- return false;
- }
-
- if (bflsc->cutofftemp > 0 && temp < (bflsc->cutofftemp - BFLSC_TEMP_RECOVER))
- sc_dev->overheat = false;
+ bflsc_manage_temp(bflsc, sc_dev, dev, temp);
}
return true;
diff --git a/driver-bflsc.h b/driver-bflsc.h
index b1d65fa..f3b5ea1 100644
--- a/driver-bflsc.h
+++ b/driver-bflsc.h
@@ -348,8 +348,10 @@ struct SaveString {
#define BFLSC_QUE_WATERMARK_V2 32
#define BFLSC_QUE_LOW_V2 16
-#define BFLSC_TEMP_OVERHEAT 90
-// Must drop this far below cutoff before resuming work
+#define BFLSC_TEMP_OVERHEAT 85
+// Will start throttling this much below overheat
+#define BFLSC_TEMP_THROTTLE 3
+// Must drop this far below overheat before resuming work
#define BFLSC_TEMP_RECOVER 5
// If initialisation fails the first time,