Browse Source

Set BFLSC fan speed coarsely to keep it under 60 or auto as per specs saying it tries to stay below 60.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
630e7d7658
  1. 26
      driver-bflsc.c
  2. 4
      usbutils.c
  3. 2
      usbutils.h

26
driver-bflsc.c

@ -116,6 +116,7 @@ struct bflsc_info { @@ -116,6 +116,7 @@ struct bflsc_info {
bool shutdown;
bool flash_led;
bool not_first_work; // allow ignoring the first nonce error
bool fanauto;
};
#define BFLSC_XLINKHDR '@'
@ -1799,6 +1800,29 @@ static int64_t bflsc_scanwork(struct thr_info *thr) @@ -1799,6 +1800,29 @@ static int64_t bflsc_scanwork(struct thr_info *thr)
return ret;
}
static void bflsc_set_fanspeed(struct cgpu_info *bflsc)
{
struct bflsc_info *sc_info = (struct bflsc_info *)bflsc->device_data;
int amount, err;
if ((bflsc->temp <= 60 && sc_info->fanauto) ||
(bflsc->temp > 60 && !sc_info->fanauto))
return;
mutex_lock(&bflsc->device_mutex);
if (bflsc->temp > 60) {
write_to_dev(bflsc, 0, BFLSC_FAN4, BFLSC_FAN4_LEN, &amount,
C_SETFAN);
sc_info->fanauto = false;
} else {
write_to_dev(bflsc, 0, BFLSC_FANAUTO, BFLSC_FANOUT_LEN,
&amount, C_SETFAN);
sc_info->fanauto = true;
}
getok(bflsc, C_FANREPLY, &err, &amount);
mutex_unlock(&bflsc->device_mutex);
}
static bool bflsc_get_stats(struct cgpu_info *bflsc)
{
struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_data);
@ -1821,6 +1845,8 @@ static bool bflsc_get_stats(struct cgpu_info *bflsc) @@ -1821,6 +1845,8 @@ static bool bflsc_get_stats(struct cgpu_info *bflsc)
nmsleep(BFLSC_TEMP_SLEEPMS);
}
bflsc_set_fanspeed(bflsc);
return allok;
}

4
usbutils.c

@ -517,6 +517,8 @@ static const char *C_SENDTESTWORK_S = "SendTestWork"; @@ -517,6 +517,8 @@ static const char *C_SENDTESTWORK_S = "SendTestWork";
static const char *C_LATENCY_S = "SetLatency";
static const char *C_SETLINE_S = "SetLine";
static const char *C_VENDOR_S = "Vendor";
static const char *C_SETFAN_S = "SetFan";
static const char *C_FANREPLY_S = "GetFan";
static const char *C_AVALON_TASK_S = "AvalonTask";
static const char *C_AVALON_READ_S = "AvalonRead";
static const char *C_GET_AVALON_READY_S = "AvalonReady";
@ -1002,6 +1004,8 @@ static void cgusb_check_init() @@ -1002,6 +1004,8 @@ static void cgusb_check_init()
usb_commands[C_LATENCY] = C_LATENCY_S;
usb_commands[C_SETLINE] = C_SETLINE_S;
usb_commands[C_VENDOR] = C_VENDOR_S;
usb_commands[C_SETFAN] = C_SETFAN_S;
usb_commands[C_FANREPLY] = C_FANREPLY_S;
usb_commands[C_AVALON_TASK] = C_AVALON_TASK_S;
usb_commands[C_AVALON_READ] = C_AVALON_READ_S;
usb_commands[C_GET_AVALON_READY] = C_GET_AVALON_READY_S;

2
usbutils.h

@ -240,6 +240,8 @@ enum usb_cmds { @@ -240,6 +240,8 @@ enum usb_cmds {
C_LATENCY,
C_SETLINE,
C_VENDOR,
C_SETFAN,
C_FANREPLY,
C_AVALON_TASK,
C_AVALON_READ,
C_GET_AVALON_READY,

Loading…
Cancel
Save