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

Commit 07c51443 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi Committed by Gerrit - the friendly Code Review server
Browse files

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



There is a case where of-thermal invokes thermal zone re-evaluation
for a zone even if it is disabled during sensor violation. It may
lead to thermal zone throttling even if that thermal zone is disabled.

Update of-thermal to re-evaluate thermal zone only if it is in
enabled state.

Change-Id: I0764d4719668231d27b4e264c46e5593653d90b3
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent 9c25b460
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);
		}
	}
}

/*