From ce214e127088cef6882a7d047c80363598773d33 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 1 Jul 2013 15:10:56 +1000 Subject: [PATCH] Decrease avalon frequency in auto mode if we are unable to maintain the temperature in the optimal range. --- driver-avalon.c | 26 +++++++++++++++++--------- driver-avalon.h | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/driver-avalon.c b/driver-avalon.c index c3b3aa7a..eee6d3a3 100644 --- a/driver-avalon.c +++ b/driver-avalon.c @@ -885,15 +885,19 @@ static void *avalon_send_tasks(void *userdata) if (opt_avalon_auto && info->auto_queued >= AVALON_AUTO_CYCLE) { mutex_lock(&info->lock); - if (info->auto_nonces >= (AVALON_AUTO_CYCLE * 19 / 20) && - info->auto_nonces <= (AVALON_AUTO_CYCLE * 21 / 20)) { - int total = info->auto_nonces + info->auto_hw; - - /* Try to keep hw errors ~1% */ - if (info->auto_hw * 200 < total) - avalon_inc_freq(info); - else if (info->auto_hw * 100 > total) - avalon_dec_freq(info); + if (!info->optimal) { + applog(LOG_WARNING, "AVA%i: Above optimal temperature, throttling", + avalon->device_id); + avalon_dec_freq(info); + } else if (info->auto_nonces >= (AVALON_AUTO_CYCLE * 19 / 20) && + info->auto_nonces <= (AVALON_AUTO_CYCLE * 21 / 20)) { + int total = info->auto_nonces + info->auto_hw; + + /* Try to keep hw errors ~1% */ + if (info->auto_hw * 200 < total) + avalon_inc_freq(info); + else if (info->auto_hw * 100 > total) + avalon_dec_freq(info); } avalon_reset_auto(info); mutex_unlock(&info->lock); @@ -1083,6 +1087,10 @@ static inline void adjust_fan(struct avalon_info *info) temp_drop(info, temp_new); } info->temp_old = temp_new; + if (info->temp_old <= opt_avalon_temp) + info->optimal = true; + else + info->optimal = false; } static void avalon_update_temps(struct cgpu_info *avalon, struct avalon_info *info, diff --git a/driver-avalon.h b/driver-avalon.h index 9454f246..4ab16d93 100644 --- a/driver-avalon.h +++ b/driver-avalon.h @@ -134,6 +134,7 @@ struct avalon_info { bool idle; bool reset; bool overheat; + bool optimal; }; #define AVALON_WRITE_SIZE (sizeof(struct avalon_task))