Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2938623 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: thermal: of-thermal: notify thermal zone only if it is enabled"

parents 44c3d4ae 07c51443
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -733,6 +733,7 @@ static void handle_thermal_trip(struct device *dev,
	int idx = 0;
	struct __sensor_param *sens_param = NULL;
	bool notify = false;
	unsigned long tz_status_mask = 0;

	idx = find_sensor_index(dev, data);
	if (idx < 0)
@@ -749,6 +750,7 @@ static void handle_thermal_trip(struct device *dev,
			thermal_zone_device_update(zone,
				THERMAL_EVENT_UNSPECIFIED);
		} else {
			set_bit(idx, &tz_status_mask);
			if (!of_thermal_is_trips_triggered(zone, trip_temp))
				continue;
			notify = true;
@@ -761,9 +763,15 @@ static void handle_thermal_trip(struct device *dev,
	 * It is better to notify at least one thermal zone if trip is violated
	 * for none.
	 */
	if (temp_valid && !notify)
		thermal_zone_device_update_temp(tzd, THERMAL_EVENT_UNSPECIFIED,
				trip_temp);
	if (temp_valid && !notify) {
		idx = find_first_bit(&tz_status_mask, sens_param->tz_cnt);
		if (idx < sens_param->tz_cnt) {
			data = sens_param->tz_list[idx];
			zone = data->tzd;
			thermal_zone_device_update_temp(zone,
				THERMAL_EVENT_UNSPECIFIED, trip_temp);
		}
	}
}

/*