Browse Source

Provide an --avalon-freq command line to give a valid range of frequencies for avalon in auto mode.

Con Kolivas 12 years ago
parent
commit
065b6a5e36
5 changed files with 36 additions and 4 deletions
  1. 1 0
      ASIC-README
  2. 2 0
      README
  3. 3 0
      cgminer.c
  4. 27 4
      driver-avalon.c
  5. 3 0
      driver-avalon.h

+ 1 - 0
ASIC-README

@@ -87,6 +87,7 @@ Avalon 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)
 

+ 2 - 0
README

@@ -234,6 +234,8 @@ ASIC and FPGA mining boards (BFL ASIC, BitForce, Icarus, ModMiner, Ztex)
 only options:
 
 --avalon-auto       Adjust avalon overclock frequency dynamically for best hashrate
+--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-cutoff <arg> Set avalon overheat cut off temperature (default: 60)
 --avalon-options <arg> Set avalon options baud:miners:asic:timeout:freq
 --avalon-temp <arg> Set avalon target temperature (default: 50)

+ 3 - 0
cgminer.c

@@ -1066,6 +1066,9 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITH_ARG("--avalon-fan",
 		     set_avalon_fan, NULL, NULL,
 		     "Set fanspeed percentage for avalon, single value or range (default: 20-100)"),
+	OPT_WITH_ARG("--avalon-freq",
+		     set_avalon_freq, NULL, NULL,
+		     "Set frequency range for avalon-auto, single value or range"),
 	OPT_WITH_ARG("--avalon-options",
 		     set_avalon_options, NULL, NULL,
 		     "Set avalon options baud:miners:asic:timeout:freq"),

+ 27 - 4
driver-avalon.c

@@ -44,6 +44,8 @@ int opt_avalon_temp = AVALON_TEMP_TARGET;
 int opt_avalon_overheat = AVALON_TEMP_OVERHEAT;
 int opt_avalon_fan_min = AVALON_DEFAULT_FAN_MIN;
 int opt_avalon_fan_max = AVALON_DEFAULT_FAN_MAX;
+int opt_avalon_freq_min = AVALON_MIN_FREQUENCY;
+int opt_avalon_freq_max = AVALON_MAX_FREQUENCY;
 bool opt_avalon_auto;
 
 static int option_offset = -1;
@@ -469,6 +471,27 @@ char *set_avalon_fan(char *arg)
 	return NULL;
 }
 
+char *set_avalon_freq(char *arg)
+{
+	int val1, val2, ret;
+
+	ret = sscanf(arg, "%d-%d", &val1, &val2);
+	if (ret < 1)
+		return "No values passed to avalon-freq";
+	if (ret == 1)
+		val2 = val1;
+
+	if (val1 < AVALON_MIN_FREQUENCY || val1 > AVALON_MAX_FREQUENCY ||
+	    val2 < AVALON_MIN_FREQUENCY || val2 > AVALON_MAX_FREQUENCY ||
+	    val2 < val1)
+		return "Invalid value passed to avalon-freq";
+
+	opt_avalon_freq_min = val1;
+	opt_avalon_freq_max = val2;
+
+	return NULL;
+}
+
 static void avalon_idle(struct cgpu_info *avalon, struct avalon_info *info)
 {
 	int i;
@@ -841,8 +864,8 @@ static void avalon_set_timeout(struct avalon_info *info)
 static void avalon_inc_freq(struct avalon_info *info)
 {
 	info->frequency += 2;
-	if (info->frequency > AVALON_MAX_FREQUENCY)
-		info->frequency = AVALON_MAX_FREQUENCY;
+	if (info->frequency > opt_avalon_freq_max)
+		info->frequency = opt_avalon_freq_max;
 	avalon_set_timeout(info);
 	applog(LOG_NOTICE, "Avalon increasing frequency to %d, timeout %d",
 	       info->frequency, info->timeout);
@@ -851,8 +874,8 @@ static void avalon_inc_freq(struct avalon_info *info)
 static void avalon_dec_freq(struct avalon_info *info)
 {
 	info->frequency -= 1;
-	if (info->frequency < AVALON_MIN_FREQUENCY)
-		info->frequency = AVALON_MIN_FREQUENCY;
+	if (info->frequency < opt_avalon_freq_min)
+		info->frequency = opt_avalon_freq_min;
 	avalon_set_timeout(info);
 	applog(LOG_NOTICE, "Avalon decreasing frequency to %d, timeout %d",
 	       info->frequency, info->timeout);

+ 3 - 0
driver-avalon.h

@@ -158,8 +158,11 @@ extern int opt_avalon_temp;
 extern int opt_avalon_overheat;
 extern int opt_avalon_fan_min;
 extern int opt_avalon_fan_max;
+extern int opt_avalon_freq_min;
+extern int opt_avalon_freq_max;
 extern bool opt_avalon_auto;
 extern char *set_avalon_fan(char *arg);
+extern char *set_avalon_freq(char *arg);
 
 #endif /* USE_AVALON */
 #endif	/* AVALON_H */