/* * If the temperature is higher than a trip point, * a. if the trend is THERMAL_TREND_RAISING, use higher cooling * state for this trip point * b. if the trend is THERMAL_TREND_DROPPING, use a lower cooling state * for this trip point, but keep the cooling state above the applicable * minimum * If the temperature is lower than a trip point, * a. if the trend is THERMAL_TREND_RAISING, do nothing * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling * state for this trip point, if the cooling state already * equals lower limit, deactivate the thermal instance
*/ staticunsignedlong get_target_state(struct thermal_instance *instance, enum thermal_trend trend, bool throttle)
{ struct thermal_cooling_device *cdev = instance->cdev; unsignedlong cur_state;
/* * We keep this instance the way it is by default. * Otherwise, we use the current state of the * cdev in use to determine the next_target.
*/
cdev->ops->get_cur_state(cdev, &cur_state);
dev_dbg(&cdev->device, "cur_state=%ld\n", cur_state);
if (!instance->initialized) { if (throttle) return clamp(cur_state + 1, instance->lower, instance->upper);
return THERMAL_NO_TARGET;
}
if (throttle) { if (trend == THERMAL_TREND_RAISING) return clamp(cur_state + 1, instance->lower, instance->upper);
/* * If the zone temperature is falling, the cooling level can * be reduced, but it should still be above the lower state of * the given thermal instance to pull the temperature further * down.
*/ if (trend == THERMAL_TREND_DROPPING) return clamp(cur_state - 1,
min(instance->lower + 1, instance->upper),
instance->upper);
} elseif (trend == THERMAL_TREND_DROPPING) { if (cur_state <= instance->lower) return THERMAL_NO_TARGET;
/* * If 'throttle' is false, no mitigation is necessary, so * request the lower state for this instance.
*/ return instance->lower;
}
/* * Throttling Logic: Use the trend of the thermal zone to throttle. * If the thermal zone is 'heating up', throttle all of the cooling * devices associated with each trip point by one step. If the zone * is 'cooling down', it brings back the performance of the devices * by one step.
*/
for_each_trip_desc(tz, td) { conststruct thermal_trip *trip = &td->trip;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.