 -	opt_avalon2_fan_max = AVA2_PWM_MAX - val2 * AVA2_PWM_MAX / 100;
 +	opt_avalon2_fan_min = get_fan_pwm(val1);
 +	opt_avalon2_fan_max = get_fan_pwm(val2);
- 
- 	return NULL;
- }
++
++	return NULL;
++}
  
 +char *set_avalon2_fixed_speed(enum avalon2_fan_fixed *f)
 +{
 +	*f = FAN_FIXED;
-+	return NULL;
-+}
-+
- char *set_avalon2_freq(char *arg)
- {
- 	int val1, val2, ret;
-@@ -147,12 +160,24 @@ static int avalon2_init_pkg(struct avalon2_pkg *pkg, uint8_t type, uint8_t idx,
+ 	return NULL;
+ }
+ 
+@@ -147,12 +182,24 @@ static int avalon2_init_pkg(struct avalon2_pkg *pkg, uint8_t type, uint8_t idx,
  
  static int job_idcmp(uint8_t *job_id, char *pool_job_id)
  {

 		sprintf(buf, "ID%d MM Version", i + 1);
 		root = api_add_string(root, buf, &(info->mm_version[i]), false);
 	}
@@ -802,15 +930,15 @@ static struct api_data *avalon2_api_stats(struct cgpu_info *cgpu)
 	minerindex = 0;
 	minercount = 0;
 	for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {

 
 			while (avalon2_send_pkg(info->fd, &send_pkg, thr) != AVA2_SEND_OK)
 				;
@@ -684,9 +817,58 @@ static int polling(struct thr_info *thr)
 	return 0;
 }
 
