static void mb6047_hwm_init(void) { device_t dev; struct resource *res; size_t i; static const struct { u8 bnk; u8 idx; u8 dat; } hwmtab[] = { { 0x00, 0x5d, 0x05 }, /* CPUTIN diode */ { 0x04, 0x55, 0x32 }, /* CPUTIN offset */ { 0x00, 0x4e, 0x00 }, /* reset bank */ }; dev = dev_find_slot_pnp(0x2e, W83627THG_HWM); if (dev == NULL) return; res = find_resource(dev, PNP_IDX_IO0); if (res == NULL) return; printk(BIOS_INFO, "setting up hardware monitor at 0x%04x\n", (unsigned int)res->base); /* Init hardware monitor. */ for (i = 0; i < ARRAY_SIZE(hwmtab); i++) { hwm_write(res->base, hwmtab[i].bnk, hwmtab[i].idx, hwmtab[i].dat); } }
static void hwm_bank(u8 bank) { hwm_write(0x4e, bank); }
static void hwm_setup(void) { int cpufan_control = 0, sysfan_control = 0; int cpufan_speed = 0, sysfan_speed = 0; int cpufan_temperature = 0, sysfan_temperature = 0; if (get_option(&cpufan_control, "cpufan_cruise_control") != CB_SUCCESS) cpufan_control = FAN_CRUISE_CONTROL_DISABLED; if (get_option(&cpufan_speed, "cpufan_speed") != CB_SUCCESS) cpufan_speed = FAN_SPEED_5625; //if (get_option(&cpufan_temperature, "cpufan_temperature") != CB_SUCCESS) // cpufan_temperature = FAN_TEMPERATURE_30DEGC; if (get_option(&sysfan_control, "sysfan_cruise_control") != CB_SUCCESS) sysfan_control = FAN_CRUISE_CONTROL_DISABLED; if (get_option(&sysfan_speed, "sysfan_speed") != CB_SUCCESS) sysfan_speed = FAN_SPEED_5625; //if (get_option(&sysfan_temperature, "sysfan_temperature") != CB_SUCCESS) // sysfan_temperature = FAN_TEMPERATURE_30DEGC; // hwm_write(0x31, 0x20); // AVCC high limit // hwm_write(0x34, 0x06); // VIN2 low limit hwm_bank(0); hwm_write(0x59, 0x20); // Diode Selection hwm_write(0x5d, 0x0f); // All Sensors Diode, not Thermistor hwm_bank(4); hwm_write(0x54, 0xf1); // SYSTIN temperature offset hwm_write(0x55, 0x19); // CPUTIN temperature offset hwm_write(0x56, 0xfc); // AUXTIN temperature offset hwm_bank(0x80); // Default u8 fan_config = 0; // 00 FANOUT is Manual Mode // 01 FANOUT is Thermal Cruise Mode // 10 FANOUT is Fan Speed Cruise Mode switch (cpufan_control) { case FAN_CRUISE_CONTROL_SPEED: fan_config |= (2 << 4); break; case FAN_CRUISE_CONTROL_THERMAL: fan_config |= (1 << 4); break; } switch (sysfan_control) { case FAN_CRUISE_CONTROL_SPEED: fan_config |= (2 << 2); break; case FAN_CRUISE_CONTROL_THERMAL: fan_config |= (1 << 2); break; } // This register must be written first hwm_write(0x04, fan_config); switch (cpufan_control) { case FAN_CRUISE_CONTROL_SPEED: printk(BIOS_DEBUG, "Fan Cruise Control setting CPU fan to %d RPM\n", fan_speeds[cpufan_speed].fan_speed); hwm_write(0x06, fan_speeds[cpufan_speed].fan_in); // CPUFANIN target speed break; case FAN_CRUISE_CONTROL_THERMAL: printk(BIOS_DEBUG, "Fan Cruise Control setting CPU fan to activation at %d deg C/%d deg F\n", temperatures[cpufan_temperature].deg_celsius, temperatures[cpufan_temperature].deg_fahrenheit); hwm_write(0x06, temperatures[cpufan_temperature].deg_celsius); // CPUFANIN target temperature break; } switch (sysfan_control) { case FAN_CRUISE_CONTROL_SPEED: printk(BIOS_DEBUG, "Fan Cruise Control setting system fan to %d RPM\n", fan_speeds[sysfan_speed].fan_speed); hwm_write(0x05, fan_speeds[sysfan_speed].fan_in); // SYSFANIN target speed break; case FAN_CRUISE_CONTROL_THERMAL: printk(BIOS_DEBUG, "Fan Cruise Control setting system fan to activation at %d deg C/%d deg F\n", temperatures[sysfan_temperature].deg_celsius, temperatures[sysfan_temperature].deg_fahrenheit); hwm_write(0x05, temperatures[sysfan_temperature].deg_celsius); // SYSFANIN target temperature break; } hwm_write(0x0e, 0x02); // Fan Output Step Down Time hwm_write(0x0f, 0x02); // Fan Output Step Up Time hwm_write(0x47, 0xaf); // FAN divisor register hwm_write(0x4b, 0x84); // AUXFANIN speed divisor hwm_write(0x40, 0x01); // Init, but no SMI# }