diff --git a/ASIC-README b/ASIC-README index 53a93fd6..4b4267d7 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 Set avalon overheat cut off temperature (default: 60) --avalon-fan Set fanspeed percentage for avalon, single value or range (default: 20-100) +--avalon-freq Set frequency range for avalon-auto, single value or range --avalon-options Set avalon options baud:miners:asic:timeout:freq --avalon-temp Set avalon target temperature (default: 50) diff --git a/README b/README index 2a3d457e..b87890f9 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 Set fanspeed percentage for avalon, single value or range (default: 20-100) +--avalon-freq Set frequency range for avalon-auto, single value or range --avalon-cutoff Set avalon overheat cut off temperature (default: 60) --avalon-options Set avalon options baud:miners:asic:timeout:freq --avalon-temp Set avalon target temperature (default: 50) diff --git a/cgminer.c b/cgminer.c index e68f8f22..724521f0 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 f9dec0b6..0e918d06 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 4ab16d93..171f61dc 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 */