Provide an --avalon-freq command line to give a valid range of frequencies for avalon in auto mode.
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
diff --git a/ASIC-README b/ASIC-README
index 53a93fd..4b4267d 100644
--- a/ASIC-README
+++ b/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)
diff --git a/README b/README
index 2a3d457..b87890f 100644
--- a/README
+++ b/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)
diff --git a/cgminer.c b/cgminer.c
index e68f8f2..724521f 100644
--- a/cgminer.c
+++ b/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"),
diff --git a/driver-avalon.c b/driver-avalon.c
index f9dec0b..0e918d0 100644
--- a/driver-avalon.c
+++ b/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);
diff --git a/driver-avalon.h b/driver-avalon.h
index 4ab16d9..171f61d 100644
--- a/driver-avalon.h
+++ b/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 */