Loading drivers/thermal/of-thermal.c +42 −0 Original line number Diff line number Diff line Loading @@ -569,6 +569,46 @@ static int of_thermal_aggregate_trip_types(struct thermal_zone_device *tz, return 0; } static bool of_thermal_is_trips_triggered(struct thermal_zone_device *tz, int temp) { int tt, th, trip, last_temp; struct __thermal_zone *data = tz->devdata; bool triggered = false; mutex_lock(&tz->lock); last_temp = tz->last_temperature; for (trip = 0; trip < data->ntrips; trip++) { if (!tz->tzp->tracks_low) { tt = data->trips[trip].temperature; if (temp >= tt && last_temp < tt) { triggered = true; break; } th = tt - data->trips[trip].hysteresis; if (temp <= th && last_temp > th) { triggered = true; break; } } else { tt = data->trips[trip].temperature; if (temp <= tt && last_temp > tt) { triggered = true; break; } th = tt + data->trips[trip].hysteresis; if (temp >= th && last_temp < th) { triggered = true; break; } } } mutex_unlock(&tz->lock); return triggered; } /* * of_thermal_aggregate_trip - aggregate trip temperatures across sibling * thermal zones. Loading Loading @@ -605,6 +645,8 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, thermal_zone_device_update(zone, THERMAL_EVENT_UNSPECIFIED); } else { if (!of_thermal_is_trips_triggered(zone, trip_temp)) continue; thermal_zone_device_update_temp(zone, THERMAL_EVENT_UNSPECIFIED, trip_temp); } Loading Loading
drivers/thermal/of-thermal.c +42 −0 Original line number Diff line number Diff line Loading @@ -569,6 +569,46 @@ static int of_thermal_aggregate_trip_types(struct thermal_zone_device *tz, return 0; } static bool of_thermal_is_trips_triggered(struct thermal_zone_device *tz, int temp) { int tt, th, trip, last_temp; struct __thermal_zone *data = tz->devdata; bool triggered = false; mutex_lock(&tz->lock); last_temp = tz->last_temperature; for (trip = 0; trip < data->ntrips; trip++) { if (!tz->tzp->tracks_low) { tt = data->trips[trip].temperature; if (temp >= tt && last_temp < tt) { triggered = true; break; } th = tt - data->trips[trip].hysteresis; if (temp <= th && last_temp > th) { triggered = true; break; } } else { tt = data->trips[trip].temperature; if (temp <= tt && last_temp > tt) { triggered = true; break; } th = tt + data->trips[trip].hysteresis; if (temp >= th && last_temp < th) { triggered = true; break; } } } mutex_unlock(&tz->lock); return triggered; } /* * of_thermal_aggregate_trip - aggregate trip temperatures across sibling * thermal zones. Loading Loading @@ -605,6 +645,8 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, thermal_zone_device_update(zone, THERMAL_EVENT_UNSPECIFIED); } else { if (!of_thermal_is_trips_triggered(zone, trip_temp)) continue; thermal_zone_device_update_temp(zone, THERMAL_EVENT_UNSPECIFIED, trip_temp); } Loading