struct thermal_instance *instance;
bool throttle = false;
int old_target;
+ int hyst_temp;
trend = get_tz_trend(tz, trip_id);
- if (tz->temperature >= trip->temperature) {
- throttle = true;
- trace_thermal_zone_trip(tz, trip_id, trip->type);
- }
+ hyst_temp = trip->temperature - trip->hysteresis;
- dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n",
- trip_id, trip->type, trip->temperature, trend, throttle);
+ dev_dbg(&tz->device,
+ "Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n",
+ trip_id, trip->type, trip->temperature, hyst_temp, trend, throttle);
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
if (instance->trip != trip)
continue;
old_target = instance->target;
+ throttle = false;
+ /*
+ * Lower the mitigation only if the temperature
+ * goes below the hysteresis temperature.
+ */
+ if (tz->temperature >= trip->temperature ||
+ (tz->temperature >= hyst_temp &&
+ old_target == instance->upper)) {
+ throttle = true;
+ trace_thermal_zone_trip(tz, trip_id, trip->type);
+ }
+
instance->target = get_target_state(instance, trend, throttle);
dev_dbg(&instance->cdev->device, "old_target=%d, target=%d\n",
old_target, (int)instance->target);