Esempio n. 1
0
static int omap_cpu_thermal_manager(struct list_head *cooling_list, int temp)
{
	int cpu_temp;

	omap_gov->sensor_temp = temp;
	cpu_temp = convert_omap_sensor_temp_to_hotspot_temp(temp);

	pr_info("%s:sensor %d avg sensor %d pcb %d, delta %d hot spot %d\n",
			__func__, temp, omap_gov->avg_cpu_sensor_temp,
			omap_gov->pcb_temp, omap_gov->absolute_delta,
			cpu_temp);

	if (cpu_temp >= OMAP_FATAL_TEMP) {
		omap_fatal_zone(cpu_temp);
		return FATAL_ZONE;
	} else if (cpu_temp >= OMAP_PANIC_TEMP) {
		omap_panic_zone(cooling_list, cpu_temp);
		return PANIC_ZONE;
	} else if (cpu_temp < (OMAP_PANIC_TEMP - HYSTERESIS_VALUE)) {
		if (cpu_temp >= OMAP_ALERT_TEMP) {
			omap_alert_zone(cooling_list, cpu_temp);
			return ALERT_ZONE;
		} else if (cpu_temp < (OMAP_ALERT_TEMP - HYSTERESIS_VALUE)) {
			if (cpu_temp >= OMAP_MONITOR_TEMP) {
				omap_monitor_zone(cooling_list, cpu_temp);
				return MONITOR_ZONE;
			} else {
				/*
				 * this includes the case where :
				 * (OMAP_MONITOR_TEMP - HYSTERESIS_VALUE) <= T
				 * && T < OMAP_MONITOR_TEMP
				 */
				omap_safe_zone(cooling_list, cpu_temp);
				return SAFE_ZONE;
			}
		} else {
			/*
			 * this includes the case where :
			 * (OMAP_ALERT_TEMP - HYSTERESIS_VALUE) <= T
			 * && T < OMAP_ALERT_TEMP
			 */
			omap_monitor_zone(cooling_list, cpu_temp);
			return MONITOR_ZONE;
		}
	} else {
		/*
		 * this includes the case where :
		 * (OMAP_PANIC_TEMP - HYSTERESIS_VALUE) <= T < OMAP_PANIC_TEMP
		 */
		omap_alert_zone(cooling_list, cpu_temp);
		return ALERT_ZONE;
	}

	return NO_ACTION;
}
static int omap_cpu_thermal_manager(struct list_head *cooling_list, int temp)
{
	int cpu_temp;

	cpu_temp = convert_omap_sensor_temp_to_hotspot_temp(temp);
#if 0
	pr_info("%s: triggered with these temp: temp %d cpu_temp %d\n",
						__func__, temp, cpu_temp);
#endif
	if (cpu_temp >= OMAP_FATAL_TEMP) {
		omap_fatal_zone(cpu_temp);
		return FATAL_ZONE;
	} else if (cpu_temp >= OMAP_PANIC_TEMP) {
		omap_panic_zone(cooling_list, cpu_temp);
		return PANIC_ZONE;
	} else if (cpu_temp < (OMAP_PANIC_TEMP - HYSTERESIS_VALUE)) {
		if (cpu_temp >= OMAP_ALERT_TEMP) {
			omap_alert_zone(cooling_list, cpu_temp);
			return ALERT_ZONE;
		} else if (cpu_temp < (OMAP_ALERT_TEMP - HYSTERESIS_VALUE)) {
			if (cpu_temp >= OMAP_MONITOR_TEMP) {
				omap_monitor_zone(cooling_list, cpu_temp);
				return MONITOR_ZONE;
			} else {
				/*
				 * this includes the case where :
				 * (OMAP_MONITOR_TEMP - HYSTERESIS_VALUE) <= T
				 * && T < OMAP_MONITOR_TEMP
				 */
				omap_safe_zone(cooling_list, cpu_temp);
				return SAFE_ZONE;
			}
		} else {
			/*
			 * this includes the case where :
			 * (OMAP_ALERT_TEMP - HYSTERESIS_VALUE) <= T < OMAP_ALERT_TEMP
			 */
			omap_monitor_zone(cooling_list, cpu_temp);
			return MONITOR_ZONE;
		}
	} else {
		/*
		 * this includes the case where :
		 * (OMAP_PANIC_TEMP - HYSTERESIS_VALUE) <= T < OMAP_PANIC_TEMP
		 */
		omap_alert_zone(cooling_list, cpu_temp);
		return ALERT_ZONE;
	}

	return NO_ACTION;

}
static int omap_cpu_thermal_manager(struct list_head *cooling_list, int temp)
{
	int cpu_temp, zone = NO_ACTION;
	bool set_cooling_level = true;

	omap_gov->sensor_temp = temp;
	cpu_temp = convert_omap_sensor_temp_to_hotspot_temp(temp);

	if (cpu_temp >= OMAP_FATAL_TEMP) {
		omap_fatal_zone(cpu_temp);
		return FATAL_ZONE;
	} else if (cpu_temp >= OMAP_PANIC_TEMP) {
		int temp_upper;

		omap_gov->panic_zone_reached++;
		temp_upper = (((OMAP_FATAL_TEMP - OMAP_PANIC_TEMP) / 4) *
				omap_gov->panic_zone_reached) + OMAP_PANIC_TEMP;
		if (temp_upper >= OMAP_FATAL_TEMP)
			temp_upper = OMAP_FATAL_TEMP;
		omap_thermal_zones[PANIC_ZONE - 1].temp_upper = temp_upper;
		zone = PANIC_ZONE;
	} else if (cpu_temp < (OMAP_PANIC_TEMP - HYSTERESIS_VALUE)) {
		if (cpu_temp >= OMAP_ALERT_TEMP) {
			set_cooling_level = omap_gov->panic_zone_reached == 0;
			zone = ALERT_ZONE;
		} else if (cpu_temp < (OMAP_ALERT_TEMP - HYSTERESIS_VALUE)) {
			if (cpu_temp >= OMAP_MONITOR_TEMP) {
				omap_gov->panic_zone_reached = 0;
				zone = MONITOR_ZONE;
			} else {
				/*
				 * this includes the case where :
				 * (OMAP_MONITOR_TEMP - HYSTERESIS_VALUE) <= T
				 * && T < OMAP_MONITOR_TEMP
				 */
				omap_gov->panic_zone_reached = 0;
				zone = SAFE_ZONE;
			}
		} else {
			/*
			 * this includes the case where :
			 * (OMAP_ALERT_TEMP - HYSTERESIS_VALUE) <= T
			 * && T < OMAP_ALERT_TEMP
			 */
			omap_gov->panic_zone_reached = 0;
			zone = MONITOR_ZONE;
		}
	} else {
		/*
		 * this includes the case where :
		 * (OMAP_PANIC_TEMP - HYSTERESIS_VALUE) <= T < OMAP_PANIC_TEMP
		 */
		set_cooling_level = omap_gov->panic_zone_reached == 0;
		zone = ALERT_ZONE;
	}

	if (zone != NO_ACTION) {
		struct omap_thermal_zone *therm_zone;

		therm_zone = &omap_thermal_zones[zone - 1];
		if (omap_gov->panic_zone_reached)
			start_panic_guard();
		else
			cancel_delayed_work(&omap_gov->decrease_mpu_freq_work);

		if ((omap_gov->prev_zone != zone) || (zone == PANIC_ZONE)) {
			pr_info("%s:sensor %d avg sensor %d pcb ",
				 __func__, temp,
				 omap_gov->avg_cpu_sensor_temp);
			pr_info("%d, delta %d hot spot %d\n",
				 omap_gov->pcb_temp, omap_gov->absolute_delta,
				 cpu_temp);
			pr_info("%s: hot spot temp %d - going into %s zone\n",
				__func__, cpu_temp, therm_zone->name);
			omap_gov->prev_zone = zone;
		}
		omap_enter_zone(therm_zone, set_cooling_level,
				cooling_list, cpu_temp);
	}

	omap_gov->zone_info = zone;

	return zone;
}