Browse Source

Allow the avalon fanspeed range to be passed as parameter on the command line, default to 20-100%

nfactor-troky
Con Kolivas 12 years ago
parent
commit
f142a4de23
  1. 1
      ASIC-README
  2. 3
      cgminer.c
  3. 33
      driver-avalon.c
  4. 6
      driver-avalon.h

1
ASIC-README

@ -86,6 +86,7 @@ Avalon commands: @@ -86,6 +86,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-options <arg> Set avalon options baud:miners:asic:timeout:freq
--avalon-temp <arg> Set avalon target temperature (default: 50)

3
cgminer.c

@ -1063,6 +1063,9 @@ static struct opt_table opt_config_table[] = { @@ -1063,6 +1063,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--avalon-cutoff",
set_int_0_to_100, opt_show_intval, &opt_avalon_overheat,
"Set avalon overheat cut off temperature"),
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-options",
set_avalon_options, NULL, NULL,
"Set avalon options baud:miners:asic:timeout:freq"),

33
driver-avalon.c

@ -42,6 +42,8 @@ @@ -42,6 +42,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;
bool opt_avalon_auto;
static int option_offset = -1;
@ -448,6 +450,25 @@ static bool get_options(int this_option_offset, int *baud, int *miner_count, @@ -448,6 +450,25 @@ static bool get_options(int this_option_offset, int *baud, int *miner_count,
return true;
}
char *set_avalon_fan(char *arg)
{
int val1, val2, ret;
ret = sscanf(arg, "%d-%d", &val1, &val2);
if (ret < 1)
return "No values passed to avalon-fan";
if (ret == 1)
val2 = val1;
if (val1 < 0 || val1 > 100 || val2 < 0 || val2 > 100 || val2 < val1)
return "Invalid value passed to avalon-fan";
opt_avalon_fan_min = val1 * AVALON_PWM_MAX / 100;
opt_avalon_fan_max = val2 * AVALON_PWM_MAX / 100;
return NULL;
}
static void avalon_idle(struct cgpu_info *avalon, struct avalon_info *info)
{
int i;
@ -1011,7 +1032,7 @@ static inline void record_temp_fan(struct avalon_info *info, struct avalon_resul @@ -1011,7 +1032,7 @@ static inline void record_temp_fan(struct avalon_info *info, struct avalon_resul
static void temp_rise(struct avalon_info *info, int temp)
{
if (temp >= opt_avalon_temp + AVALON_TEMP_HYSTERESIS * 3) {
info->fan_pwm = AVALON_DEFAULT_FAN_MAX_PWM;
info->fan_pwm = AVALON_PWM_MAX;
return;
}
if (temp >= opt_avalon_temp + AVALON_TEMP_HYSTERESIS * 2)
@ -1023,14 +1044,14 @@ static void temp_rise(struct avalon_info *info, int temp) @@ -1023,14 +1044,14 @@ static void temp_rise(struct avalon_info *info, int temp)
else
return;
if (info->fan_pwm > AVALON_DEFAULT_FAN_MAX_PWM)
info->fan_pwm = AVALON_DEFAULT_FAN_MAX_PWM;
if (info->fan_pwm > opt_avalon_fan_max)
info->fan_pwm = opt_avalon_fan_max;
}
static void temp_drop(struct avalon_info *info, int temp)
{
if (temp <= opt_avalon_temp - AVALON_TEMP_HYSTERESIS * 3) {
info->fan_pwm = AVALON_DEFAULT_FAN_MIN_PWM;
info->fan_pwm = opt_avalon_fan_min;
return;
}
if (temp <= opt_avalon_temp - AVALON_TEMP_HYSTERESIS * 2)
@ -1040,8 +1061,8 @@ static void temp_drop(struct avalon_info *info, int temp) @@ -1040,8 +1061,8 @@ static void temp_drop(struct avalon_info *info, int temp)
else if (temp < opt_avalon_temp)
info->fan_pwm -= 1;
if (info->fan_pwm < AVALON_DEFAULT_FAN_MIN_PWM)
info->fan_pwm = AVALON_DEFAULT_FAN_MIN_PWM;
if (info->fan_pwm < opt_avalon_fan_min)
info->fan_pwm = opt_avalon_fan_min;
}
static inline void adjust_fan(struct avalon_info *info)

6
driver-avalon.h

@ -23,6 +23,9 @@ @@ -23,6 +23,9 @@
#define AVALON_RESET_PITCH (300*1000*1000)
#define AVALON_FAN_FACTOR 120
#define AVALON_PWM_MAX 0xA0
#define AVALON_DEFAULT_FAN_MIN 20
#define AVALON_DEFAULT_FAN_MAX 100
#define AVALON_DEFAULT_FAN_MAX_PWM 0xA0 /* 100% */
#define AVALON_DEFAULT_FAN_MIN_PWM 0x20 /* 20% */
@ -152,7 +155,10 @@ ASSERT1(sizeof(uint32_t) == 4); @@ -152,7 +155,10 @@ ASSERT1(sizeof(uint32_t) == 4);
extern struct avalon_info **avalon_info;
extern int opt_avalon_temp;
extern int opt_avalon_overheat;
extern int opt_avalon_fan_min;
extern int opt_avalon_fan_max;
extern bool opt_avalon_auto;
extern char *set_avalon_fan(char *arg);
#endif /* USE_AVALON */
#endif /* AVALON_H */

Loading…
Cancel
Save