static void pm112_tick(void)
{
	int i, last_failure;

	if (!started) {
		started = 1;
		printk(KERN_INFO "windfarm: CPUs control loops started.\n");
		for (i = 0; i < nr_cores; ++i) {
			if (create_cpu_loop(i) < 0) {
				failure_state = FAILURE_PERM;
				set_fail_state();
				break;
			}
		}
		DBG_LOTS("cpu_all_tmax=%d.%03d\n", FIX32TOPRINT(cpu_all_tmax));

#ifdef HACKED_OVERTEMP
		cpu_all_tmax = 60 << 16;
#endif
	}

	/* Permanent failure, bail out */
	if (failure_state & FAILURE_PERM)
		return;
	/* Clear all failure bits except low overtemp which will be eventually
	 * cleared by the control loop itself
	 */
	last_failure = failure_state;
	failure_state &= FAILURE_LOW_OVERTEMP;
	cpu_fans_tick();
	backside_fan_tick();
	slots_fan_tick();
	drive_bay_fan_tick();

	DBG_LOTS("last_failure: 0x%x, failure_state: %x\n",
		 last_failure, failure_state);

	/* Check for failures. Any failure causes cpufreq clamping */
	if (failure_state && last_failure == 0 && cpufreq_clamp)
		wf_control_set_max(cpufreq_clamp);
	if (failure_state == 0 && last_failure && cpufreq_clamp)
		wf_control_set_min(cpufreq_clamp);

	/* That's it for now, we might want to deal with other failures
	 * differently in the future though
	 */
}
static void wf_smu_tick(void)
{
    unsigned int last_failure = wf_smu_failure_state;
    unsigned int new_failure;

    if (!wf_smu_started) {
        DBG("wf: creating control loops !\n");
        wf_smu_create_drive_fans();
        wf_smu_create_slots_fans();
        wf_smu_create_cpu_fans();
        wf_smu_started = 1;
    }

    /* Skipping ticks */
    if (wf_smu_skipping && --wf_smu_skipping)
        return;

    wf_smu_failure_state = 0;
    if (wf_smu_drive_fans)
        wf_smu_drive_fans_tick(wf_smu_drive_fans);
    if (wf_smu_slots_fans)
        wf_smu_slots_fans_tick(wf_smu_slots_fans);
    if (wf_smu_cpu_fans)
        wf_smu_cpu_fans_tick(wf_smu_cpu_fans);

    wf_smu_readjust = 0;
    new_failure = wf_smu_failure_state & ~last_failure;

    /* If entering failure mode, clamp cpufreq and ramp all
     * fans to full speed.
     */
    if (wf_smu_failure_state && !last_failure) {
        if (cpufreq_clamp)
            wf_control_set_max(cpufreq_clamp);
        if (fan_cpu_main)
            wf_control_set_max(fan_cpu_main);
        if (fan_cpu_second)
            wf_control_set_max(fan_cpu_second);
        if (fan_cpu_third)
            wf_control_set_max(fan_cpu_third);
        if (fan_hd)
            wf_control_set_max(fan_hd);
        if (fan_slots)
            wf_control_set_max(fan_slots);
    }

    /* If leaving failure mode, unclamp cpufreq and readjust
     * all fans on next iteration
     */
    if (!wf_smu_failure_state && last_failure) {
        if (cpufreq_clamp)
            wf_control_set_min(cpufreq_clamp);
        wf_smu_readjust = 1;
    }

    /* Overtemp condition detected, notify and start skipping a couple
     * ticks to let the temperature go down
     */
    if (new_failure & FAILURE_OVERTEMP) {
        wf_set_overtemp();
        wf_smu_skipping = 2;
    }

    /* We only clear the overtemp condition if overtemp is cleared
     * _and_ no other failure is present. Since a sensor error will
     * clear the overtemp condition (can't measure temperature) at
     * the control loop levels, but we don't want to keep it clear
     * here in this case
     */
    if (new_failure == 0 && last_failure & FAILURE_OVERTEMP)
        wf_clear_overtemp();
}
Beispiel #3
0
static void wf_smu_tick(void)
{
	unsigned int last_failure = wf_smu_failure_state;
	unsigned int new_failure;

	if (!wf_smu_started) {
		DBG("wf: creating control loops !\n");
		wf_smu_create_drive_fans();
		wf_smu_create_slots_fans();
		wf_smu_create_cpu_fans();
		wf_smu_started = 1;
	}

	
	if (wf_smu_skipping && --wf_smu_skipping)
		return;

	wf_smu_failure_state = 0;
	if (wf_smu_drive_fans)
		wf_smu_drive_fans_tick(wf_smu_drive_fans);
	if (wf_smu_slots_fans)
		wf_smu_slots_fans_tick(wf_smu_slots_fans);
	if (wf_smu_cpu_fans)
		wf_smu_cpu_fans_tick(wf_smu_cpu_fans);

	wf_smu_readjust = 0;
	new_failure = wf_smu_failure_state & ~last_failure;

	
	if (wf_smu_failure_state && !last_failure) {
		if (cpufreq_clamp)
			wf_control_set_max(cpufreq_clamp);
		if (fan_cpu_main)
			wf_control_set_max(fan_cpu_main);
		if (fan_cpu_second)
			wf_control_set_max(fan_cpu_second);
		if (fan_cpu_third)
			wf_control_set_max(fan_cpu_third);
		if (fan_hd)
			wf_control_set_max(fan_hd);
		if (fan_slots)
			wf_control_set_max(fan_slots);
	}

	
	if (!wf_smu_failure_state && last_failure) {
		if (cpufreq_clamp)
			wf_control_set_min(cpufreq_clamp);
		wf_smu_readjust = 1;
	}

	
	if (new_failure & FAILURE_OVERTEMP) {
		wf_set_overtemp();
		wf_smu_skipping = 2;
	}

	
	if (new_failure == 0 && last_failure & FAILURE_OVERTEMP)
		wf_clear_overtemp();
}