Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #579 from BitSyncom/master
Browse files Browse the repository at this point in the history
Fix the detection on Avalon2. Parser the power good signal
  • Loading branch information
ckolivas committed Apr 19, 2014
2 parents a5e0fc0 + 2077365 commit 2704b63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions driver-avalon2.c
Expand Up @@ -193,8 +193,7 @@ static int decode_pkg(struct thr_info *thr, struct avalon2_ret *ar, uint8_t *pkg
if (thr) {
avalon2 = thr->cgpu;
info = avalon2->device_data;
} else // FIXME: Should this happen at all!?
return 0;
}

memcpy((uint8_t *)ar, pkg, AVA2_READ_SIZE);

Expand Down Expand Up @@ -263,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]);
Expand All @@ -273,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:
Expand Down Expand Up @@ -797,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;
}
Expand Down
1 change: 1 addition & 0 deletions driver-avalon2.h
Expand Up @@ -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;

Expand Down

0 comments on commit 2704b63

Please sign in to comment.