Avalon2: Parser the power good signal
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
diff --git a/driver-avalon2.c b/driver-avalon2.c
index 85fa6a1..5261054 100644
--- a/driver-avalon2.c
+++ b/driver-avalon2.c
@@ -262,6 +262,7 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
memcpy(&(info->get_voltage[modular_id]), ar->data + 12, 4);
memcpy(&(info->local_work[modular_id]), ar->data + 16, 4);
memcpy(&(info->hw_work[modular_id]), ar->data + 20, 4);
+ memcpy(&(info->power_good[modular_id]), ar->data + 24, 4);
info->get_frequency[modular_id] = be32toh(info->get_frequency[modular_id]);
info->get_voltage[modular_id] = be32toh(info->get_voltage[modular_id]);
@@ -272,6 +273,8 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
info->hw_works[modular_id] += info->hw_work[modular_id];
info->get_voltage[modular_id] = decode_voltage(info->get_voltage[modular_id]);
+ info->power_good[modular_id] = info->power_good[modular_id] >> 24;
+
avalon2->temp = get_temp_max(info);
break;
case AVA2_P_ACKDETECT:
@@ -796,6 +799,11 @@ static struct api_data *avalon2_api_stats(struct cgpu_info *cgpu)
sprintf(buf, "Frequency%d", i + 1);
root = api_add_int(root, buf, &(info->get_frequency[i]), false);
}
+ for (i = 0; i < AVA2_DEFAULT_MODULARS; i++) {
+ sprintf(buf, "Power good %02x", i + 1);
+ root = api_add_int(root, buf, &(info->power_good[i]), false);
+ }
+
return root;
}
diff --git a/driver-avalon2.h b/driver-avalon2.h
index f89bab8..ca2e2df 100644
--- a/driver-avalon2.h
+++ b/driver-avalon2.h
@@ -86,6 +86,7 @@ struct avalon2_info {
int get_voltage[AVA2_DEFAULT_MODULARS];
int get_frequency[AVA2_DEFAULT_MODULARS];
+ int power_good[AVA2_DEFAULT_MODULARS];
int fan_pwm;