Пример #1
0
static void pm112_new_control(struct wf_control *ct)
{
	int i, max_exhaust;

	if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {
		if (wf_get_control(ct) == 0)
			cpufreq_clamp = ct;
	}

	for (i = 0; i < NR_CPU_FANS; ++i) {
		if (!strcmp(ct->name, cpu_fan_names[i])) {
			if (cpu_fans[i] == NULL && wf_get_control(ct) == 0)
				cpu_fans[i] = ct;
			break;
		}
	}
	if (i >= NR_CPU_FANS) {
		/* not a CPU fan, try the others */
		if (!strcmp(ct->name, "backside-fan")) {
			if (backside_fan == NULL && wf_get_control(ct) == 0)
				backside_fan = ct;
		} else if (!strcmp(ct->name, "slots-fan")) {
			if (slots_fan == NULL && wf_get_control(ct) == 0)
				slots_fan = ct;
		} else if (!strcmp(ct->name, "drive-bay-fan")) {
			if (drive_bay_fan == NULL && wf_get_control(ct) == 0)
				drive_bay_fan = ct;
		}
		return;
	}

	for (i = 0; i < CPU_FANS_REQD; ++i)
		if (cpu_fans[i] == NULL)
			return;

	/* work out pump scaling factors */
	max_exhaust = cpu_fans[0]->ops->get_max(cpu_fans[0]);
	for (i = FIRST_PUMP; i <= LAST_PUMP; ++i)
		if ((ct = cpu_fans[i]) != NULL)
			cpu_fan_scale[i] =
				ct->ops->get_max(ct) * 100 / max_exhaust;

	have_all_controls = 1;
}
static void wf_smu_new_control(struct wf_control *ct)
{
    if (wf_smu_all_controls_ok)
        return;

    if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) {
        if (wf_get_control(ct) == 0)
            fan_cpu_main = ct;
    }

    if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) {
        if (wf_get_control(ct) == 0)
            fan_cpu_second = ct;
    }

    if (fan_cpu_third == NULL && !strcmp(ct->name, "cpu-front-fan-0")) {
        if (wf_get_control(ct) == 0)
            fan_cpu_third = ct;
    }

    if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) {
        if (wf_get_control(ct) == 0)
            cpufreq_clamp = ct;
    }

    if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) {
        if (wf_get_control(ct) == 0)
            fan_hd = ct;
    }

    if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) {
        if (wf_get_control(ct) == 0)
            fan_slots = ct;
    }

    if (fan_cpu_main && (fan_cpu_second || fan_cpu_third) && fan_hd &&
            fan_slots && cpufreq_clamp)
        wf_smu_all_controls_ok = 1;
}