コード例 #1
0
static void wf_smu_new_sensor(struct wf_sensor *sr)
{
    if (wf_smu_all_sensors_ok)
        return;

    if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) {
        if (wf_get_sensor(sr) == 0)
            sensor_cpu_power = sr;
    }

    if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) {
        if (wf_get_sensor(sr) == 0)
            sensor_cpu_temp = sr;
    }

    if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) {
        if (wf_get_sensor(sr) == 0)
            sensor_hd_temp = sr;
    }

    if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) {
        if (wf_get_sensor(sr) == 0)
            sensor_slots_power = sr;
    }

    if (sensor_cpu_power && sensor_cpu_temp &&
            sensor_hd_temp && sensor_slots_power)
        wf_smu_all_sensors_ok = 1;
}
コード例 #2
0
static void pm112_new_sensor(struct wf_sensor *sr)
{
	unsigned int i;

	if (!strncmp(sr->name, "cpu-temp-", 9)) {
		i = sr->name[9] - '0';
		if (sr->name[10] == 0 && i < NR_CORES &&
		    sens_cpu_temp[i] == NULL && wf_get_sensor(sr) == 0)
			sens_cpu_temp[i] = sr;

	} else if (!strncmp(sr->name, "cpu-power-", 10)) {
		i = sr->name[10] - '0';
		if (sr->name[11] == 0 && i < NR_CORES &&
		    sens_cpu_power[i] == NULL && wf_get_sensor(sr) == 0)
			sens_cpu_power[i] = sr;
	} else if (!strcmp(sr->name, "hd-temp")) {
		if (hd_temp == NULL && wf_get_sensor(sr) == 0)
			hd_temp = sr;
	} else if (!strcmp(sr->name, "slots-power")) {
		if (slots_power == NULL && wf_get_sensor(sr) == 0)
			slots_power = sr;
	} else if (!strcmp(sr->name, "backside-temp")) {
		if (u4_temp == NULL && wf_get_sensor(sr) == 0)
			u4_temp = sr;
	} else
		return;

	/* check if we have all the sensors we need */
	for (i = 0; i < nr_cores; ++i)
		if (sens_cpu_temp[i] == NULL || sens_cpu_power[i] == NULL)
			return;

	have_all_sensors = 1;
}