Commit d71e9f91f4619ba531d7baa0540bee0d332b8db6

Con Kolivas 2013-08-09T06:43:25

Add a --bflsc-overheat command which allows you to set the throttling temperature for BFLSC devices or disable it.

diff --git a/ASIC-README b/ASIC-README
index 4e6c12f..6e744e5 100644
--- a/ASIC-README
+++ b/ASIC-README
@@ -73,6 +73,17 @@ After this you can either manually restart udev and re-login, or more easily
 just reboot.
 
 
+ASIC SPECIFIC COMMANDS
+
+--avalon-auto       Adjust avalon overclock frequency dynamically for best hashrate
+--avalon-cutoff <arg> Set avalon overheat cut off temperature (default: 60)
+--avalon-fan <arg> Set fanspeed percentage for avalon, single value or range (default: 20-100)
+--avalon-freq <arg> Set frequency range for avalon-auto, single value or range
+--avalon-options <arg> Set avalon options baud:miners:asic:timeout:freq
+--avalon-temp <arg> Set avalon target temperature (default: 50)
+--bflsc-overheat <arg> Set overheat temperature where BFLSC devices throttle, 0 to disable (default: 90)
+
+
 AVALON DEVICES
 
 Currently all known Avalon devices come with their own operating system and
@@ -178,6 +189,15 @@ ambient temp / highest device temp  lowest detected ASIC cooling fan RPM.
 
 Use the API for more detailed information than this.
 
+
+BFLSC Devices
+
+--bflsc-overheat <arg> Set overheat temperature where BFLSC devices throttle, 0 to disable (default: 90)
+
+This will allow you to change or disable the default temperature where cgminer
+throttles BFLSC devices by allowing them to temporarily go idle.
+
+
 ---
 
 This code is provided entirely free of charge by the programmer in his spare
diff --git a/cgminer.c b/cgminer.c
index f6b2ccc..ef2f331 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -579,6 +579,13 @@ static char *set_int_0_to_100(const char *arg, int *i)
 }
 #endif
 
+#ifdef USE_BFLSC
+static char *set_int_0_to_200(const char *arg, int *i)
+{
+	return set_int_range(arg, i, 0, 200);
+}
+#endif
+
 static char *set_int_1_to_10(const char *arg, int *i)
 {
 	return set_int_range(arg, i, 1, 10);
@@ -958,6 +965,11 @@ static struct opt_table opt_config_table[] = {
 			opt_set_bool, &opt_bfl_noncerange,
 			"Use nonce range on bitforce devices if supported"),
 #endif
+#ifdef USE_BFLSC
+	OPT_WITH_ARG("--bflsc-overheat",
+		     set_int_0_to_200, opt_show_intval, &opt_bflsc_overheat,
+		     "Set overheat temperature where BFLSC devices throttle, 0 to disable"),
+#endif
 #ifdef HAVE_CURSES
 	OPT_WITHOUT_ARG("--compact",
 			opt_set_bool, &opt_compact,
diff --git a/driver-bflsc.c b/driver-bflsc.c
index 5fe68a0..5eca2a8 100644
--- a/driver-bflsc.c
+++ b/driver-bflsc.c
@@ -28,6 +28,8 @@
 #include "usbutils.h"
 #include "driver-bflsc.h"
 
+int opt_bflsc_overheat = BFLSC_TEMP_OVERHEAT;
+
 static const char *blank = "";
 
 struct device_drv bflsc_drv;
@@ -537,7 +539,7 @@ static void __bflsc_initialise(struct cgpu_info *bflsc)
 		bflsc->drv->name, bflsc->device_id, err);
 
 	if (!bflsc->cutofftemp)
-		bflsc->cutofftemp = 90;
+		bflsc->cutofftemp = opt_bflsc_overheat;
 }
 
 static void bflsc_initialise(struct cgpu_info *bflsc)
diff --git a/driver-bflsc.h b/driver-bflsc.h
index e949424..2b3e053 100644
--- a/driver-bflsc.h
+++ b/driver-bflsc.h
@@ -342,6 +342,7 @@ struct SaveString {
 #define BFLSC_QUE_WATERMARK_V2 32
 #define BFLSC_QUE_LOW_V2 8
 
+#define BFLSC_TEMP_OVERHEAT 90
 // Must drop this far below cutoff before resuming work
 #define BFLSC_TEMP_RECOVER 5
 
@@ -353,4 +354,6 @@ struct SaveString {
 // Keep trying up to this many us
 #define REINIT_TIME_MAX 3000000
 
+int opt_bflsc_overheat;
+
 #endif /* BFLSC_H */