Browse Source

add FAN speed factor

Xiangfu 13 years ago
parent
commit
661378a15b
2 changed files with 11 additions and 15 deletions
  1. 9 14
      driver-avalon.c
  2. 2 1
      driver-avalon.h

+ 9 - 14
driver-avalon.c

@@ -213,7 +213,7 @@ static int avalon_gets(int fd, uint8_t *buf, int read_count,
 			if (opt_debug) {
 			if (opt_debug) {
 				applog(LOG_WARNING,
 				applog(LOG_WARNING,
 				       "Avalon: No data in %.2f seconds",
 				       "Avalon: No data in %.2f seconds",
-				       (float)rc/(float)TIME_FACTOR);
+				       (float)rc/(float)AVALON_TIME_FACTOR);
 			}
 			}
 			return AVA_GETS_TIMEOUT;
 			return AVA_GETS_TIMEOUT;
 		}
 		}
@@ -222,7 +222,7 @@ static int avalon_gets(int fd, uint8_t *buf, int read_count,
 			if (opt_debug) {
 			if (opt_debug) {
 				applog(LOG_WARNING,
 				applog(LOG_WARNING,
 				       "Avalon: Work restart at %.2f seconds",
 				       "Avalon: Work restart at %.2f seconds",
-				       (float)(rc)/(float)TIME_FACTOR);
+				       (float)(rc)/(float)AVALON_TIME_FACTOR);
 			}
 			}
 			return AVA_GETS_RESTART;
 			return AVA_GETS_RESTART;
 		}
 		}
@@ -235,7 +235,7 @@ static int avalon_get_result(int fd, struct avalon_result *ar,
 	struct cgpu_info *avalon;
 	struct cgpu_info *avalon;
 	struct avalon_info *info;
 	struct avalon_info *info;
 	uint8_t result[AVALON_READ_SIZE];
 	uint8_t result[AVALON_READ_SIZE];
-	int ret, read_count = AVALON_RESET_FAULT_DECISECONDS * TIME_FACTOR;
+	int ret, read_count = AVALON_RESET_FAULT_DECISECONDS * AVALON_TIME_FACTOR;
 
 
 	if (likely(thr)) {
 	if (likely(thr)) {
 		avalon = thr->cgpu;
 		avalon = thr->cgpu;
@@ -328,11 +328,6 @@ static int avalon_reset(int fd, uint8_t timeout_p, uint8_t asic_num_p,
 	p.tv_nsec = AVALON_RESET_PITCH;
 	p.tv_nsec = AVALON_RESET_PITCH;
 	nanosleep(&p, NULL);
 	nanosleep(&p, NULL);
 
 
-	applog(LOG_WARNING,
-	       "Avalon reset: Fan1: %d, Fan2: %d, Fan3: %d\t"
-	       "Temp1: %d, Temp2: %d, Temp3: %d",
-	       ar->fan0, ar->fan1, ar->fan2, ar->temp0, ar->temp1, ar->temp2);
-
 	applog(LOG_WARNING, "Avalon: Reset succeeded");
 	applog(LOG_WARNING, "Avalon: Reset succeeded");
 	return 0;
 	return 0;
 }
 }
@@ -511,7 +506,7 @@ static bool avalon_detect_one(const char *devpath)
 	info->timeout = timeout;
 	info->timeout = timeout;
 
 
 	info->read_count = ((float)info->timeout * AVALON_HASH_TIME_FACTOR *
 	info->read_count = ((float)info->timeout * AVALON_HASH_TIME_FACTOR *
-			    TIME_FACTOR) / (float)info->miner_count;
+			    AVALON_TIME_FACTOR) / (float)info->miner_count;
 
 
 	return true;
 	return true;
 }
 }
@@ -702,9 +697,9 @@ static int64_t avalon_scanhash(struct thr_info *thr, struct work **work,
 			continue;
 			continue;
 		}
 		}
 		avalon->temp = (ar.temp0 + ar.temp1 + ar.temp2) / 3;
 		avalon->temp = (ar.temp0 + ar.temp1 + ar.temp2) / 3;
-		info->fan0 = ar.fan0;
-		info->fan1 = ar.fan1;
-		info->fan2 = ar.fan2;
+		info->fan0 = ar.fan0 * AVALON_FAN_FACTOR;
+		info->fan1 = ar.fan1 * AVALON_FAN_FACTOR;
+		info->fan2 = ar.fan2 * AVALON_FAN_FACTOR;
 
 
 		info->temp0 = ar.temp0;
 		info->temp0 = ar.temp0;
 		info->temp1 = ar.temp1;
 		info->temp1 = ar.temp1;
@@ -753,8 +748,8 @@ static int64_t avalon_scanhash(struct thr_info *thr, struct work **work,
 	avalon_free_work(thr, info->bulk0);
 	avalon_free_work(thr, info->bulk0);
 
 
 	applog(LOG_WARNING,
 	applog(LOG_WARNING,
-	       "Avalon: Fan1: %d, Fan2: %d, Fan3: %d\t"
-	       "Temp1: %d, Temp2: %d, Temp3: %d, TempMAX: %d",
+	       "Avalon: Fan1: %d/m, Fan2: %d/m, Fan3: %d/m\t"
+	       "Temp1: %dC, Temp2: %dC, Temp3: %dC, TempMAX: %dC",
 	       info->fan0, info->fan1, info->fan2,
 	       info->fan0, info->fan1, info->fan2,
 	       info->temp0, info->temp1, info->temp2, info->temp_max);
 	       info->temp0, info->temp1, info->temp2, info->temp_max);
 	/*
 	/*

+ 2 - 1
driver-avalon.h

@@ -10,7 +10,7 @@
 #ifndef AVALON_H
 #ifndef AVALON_H
 #define AVALON_H
 #define AVALON_H
 
 
-#define TIME_FACTOR 10
+#define AVALON_TIME_FACTOR 10
 #define AVALON_RESET_FAULT_DECISECONDS 1
 #define AVALON_RESET_FAULT_DECISECONDS 1
 #define AVALON_MINER_THREADS 1
 #define AVALON_MINER_THREADS 1
 
 
@@ -18,6 +18,7 @@
 #define AVALON_HASH_TIME_FACTOR	((float)1.67/0x32)
 #define AVALON_HASH_TIME_FACTOR	((float)1.67/0x32)
 #define AVALON_RESET_PITCH	(300*1000*1000)
 #define AVALON_RESET_PITCH	(300*1000*1000)
 
 
+#define AVALON_FAN_FACTOR 120
 #define AVALON_DEFAULT_FAN_PWM 0xc0
 #define AVALON_DEFAULT_FAN_PWM 0xc0
 #define AVALON_DEFAULT_TIMEOUT 0x32
 #define AVALON_DEFAULT_TIMEOUT 0x32
 #define AVALON_DEFAULT_MINER_NUM 0x20
 #define AVALON_DEFAULT_MINER_NUM 0x20