minion - silent option to disable chip temp control
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
diff --git a/driver-minion.c b/driver-minion.c
index 00b0169..e03f43b 100644
--- a/driver-minion.c
+++ b/driver-minion.c
@@ -179,6 +179,9 @@ static const char *min_temp_invalid = "?";
#define MINION_TEMP_CTL_MAX_VALUE (MINION_TEMP_CTL_MIN_VALUE + \
(MINION_TEMP_CTL_STEP * \
(MINION_TEMP_CTL_MAX - MINION_TEMP_CTL_MIN)))
+#define MINION_TEMP_DISABLE "disable"
+#define MINION_TEMP_CTL_DISABLE -1
+#define MINION_TEMP_CTL_DISABLE_VALUE 0x20
// CORE data size is DATA_SIZ
#define MINION_CORE_ENA0_31 0x10
@@ -1093,15 +1096,19 @@ static void init_chip(struct cgpu_info *minioncgpu, struct minion_info *minionin
// Set temp threshold
choice = minioninfo->init_temp[chip];
- if (choice < MINION_TEMP_CTL_MIN_VALUE || choice > MINION_TEMP_CTL_MAX_VALUE)
- choice = MINION_TEMP_CTL_DEF;
- choice -= MINION_TEMP_CTL_MIN_VALUE;
- choice /= MINION_TEMP_CTL_STEP;
- choice += MINION_TEMP_CTL_MIN;
- if (choice < MINION_TEMP_CTL_MIN)
- choice = MINION_TEMP_CTL_MIN;
- if (choice > MINION_TEMP_CTL_MAX)
- choice = MINION_TEMP_CTL_MAX;
+ if (choice == MINION_TEMP_CTL_DISABLE)
+ choice = MINION_TEMP_CTL_DISABLE_VALUE;
+ else {
+ if (choice < MINION_TEMP_CTL_MIN_VALUE || choice > MINION_TEMP_CTL_MAX_VALUE)
+ choice = MINION_TEMP_CTL_DEF;
+ choice -= MINION_TEMP_CTL_MIN_VALUE;
+ choice /= MINION_TEMP_CTL_STEP;
+ choice += MINION_TEMP_CTL_MIN;
+ if (choice < MINION_TEMP_CTL_MIN)
+ choice = MINION_TEMP_CTL_MIN;
+ if (choice > MINION_TEMP_CTL_MAX)
+ choice = MINION_TEMP_CTL_MAX;
+ }
data[0] = (uint8_t)choice;
data[1] = 0;
data[2] = 0;
@@ -1637,13 +1644,18 @@ static void minion_process_options(struct minion_info *minioninfo)
*(comma++) = '\0';
for (i = 0; i < MINION_CHIPS; i++) {
- if (temp && isdigit(*temp)) {
- last_temp = atoi(temp);
- last_temp -= (last_temp % MINION_TEMP_CTL_STEP);
- if (last_temp < MINION_TEMP_CTL_MIN_VALUE)
- last_temp = MINION_TEMP_CTL_MIN_VALUE;
- if (last_temp > MINION_TEMP_CTL_MAX_VALUE)
- last_temp = MINION_TEMP_CTL_MAX_VALUE;
+ if (temp) {
+ if (isdigit(*temp)) {
+ last_temp = atoi(temp);
+ last_temp -= (last_temp % MINION_TEMP_CTL_STEP);
+ if (last_temp < MINION_TEMP_CTL_MIN_VALUE)
+ last_temp = MINION_TEMP_CTL_MIN_VALUE;
+ if (last_temp > MINION_TEMP_CTL_MAX_VALUE)
+ last_temp = MINION_TEMP_CTL_MAX_VALUE;
+ } else {
+ if (strcasecmp(temp, MINION_TEMP_DISABLE) == 0)
+ last_temp = MINION_TEMP_CTL_DISABLE;
+ }
temp = comma;
if (comma) {
@@ -3274,7 +3286,7 @@ static struct api_data *minion_api_stats(struct cgpu_info *minioncgpu)
char data[2048];
char buf[32];
int i, to, j;
- int chip, max_chip, que_work, chip_work;
+ int chip, max_chip, que_work, chip_work, temp;
if (minioninfo->initialised == false)
return NULL;
@@ -3302,7 +3314,13 @@ static struct api_data *minion_api_stats(struct cgpu_info *minioncgpu)
snprintf(buf, sizeof(buf), "Chip %d FreqSent", chip);
root = api_add_hex32(root, buf, &(minioninfo->chip_status[chip].freqsent), true);
snprintf(buf, sizeof(buf), "Chip %d InitTemp", chip);
- root = api_add_int(root, buf, &(minioninfo->init_temp[chip]), true);
+ temp = minioninfo->init_temp[chip];
+ if (temp == MINION_TEMP_CTL_DISABLE)
+ root = api_add_string(root, buf, MINION_TEMP_DISABLE, true);
+ else {
+ snprintf(data, sizeof(data), "%d", temp);
+ root = api_add_string(root, buf, data, true);
+ }
snprintf(buf, sizeof(buf), "Chip %d TempSent", chip);
root = api_add_hex32(root, buf, &(minioninfo->chip_status[chip].tempsent), true);
snprintf(buf, sizeof(buf), "Chip %d IdleCount", chip);