From 9c1e47be303fec4bb270014e48ff87af7d5bc0c6 Mon Sep 17 00:00:00 2001 From: Manaf Meethalavalappu Pallikunhi Date: Mon, 31 Aug 2020 22:18:52 +0530 Subject: [PATCH] drivers: thermal: notify at least one thermal zone if no trips are violated During any sensor threshold notification, the of-thermal framework checks whether any trip of each thermal zone for that sensor is violated or not. It requests thermal zone re-evaluation only for those thermal zones those trip is violated. If trips are violated for none of thermal zones due to some reason, then of-thermal ignores that sensor notification and it leads to no active trip threshold for that sensor forever. Notify and request thermal zone re-evaluation for at least one thermal zone for that sensor if trips are violated for none in of-thermal. It makes sure that for every sensor notification, thermal zone aggregate and set next active trip. Change-Id: If9955977fe32929d853815ddb9408385291b3c58 Signed-off-by: Manaf Meethalavalappu Pallikunhi --- drivers/thermal/of-thermal.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 0387a2f105ce..dc7b12954cd2 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -732,6 +732,7 @@ static void handle_thermal_trip(struct device *dev, struct __thermal_zone *data = tzd->devdata; int idx = 0; struct __sensor_param *sens_param = NULL; + bool notify = false; idx = find_sensor_index(dev, data); if (idx < 0) @@ -750,10 +751,19 @@ static void handle_thermal_trip(struct device *dev, } else { if (!of_thermal_is_trips_triggered(zone, trip_temp)) continue; + notify = true; thermal_zone_device_update_temp(zone, THERMAL_EVENT_UNSPECIFIED, trip_temp); } } + + /* + * 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); } /*