drivers: thermal: Add post suspend evaluate flag to thermal zone devicetree

Thermal core framework subscribes for suspend/resume notification.
On resume notification it re-evaluates each thermal zone for
temperature and cooling state update. Most of the qcom targets,
large number of thermal zones are enabled for different mitigations.
Re-evaluating each thermal zone during resume leads to multiple issues
including delay in back to back suspend resume scenario, power penalty
for frequent wake up due to re-setting trip threshold especially
during cold temperature usecases. But almost all qcom target TSENS and
ADC sensor interrupts are wakeup capable. More over all internal
cooling devices are platform cooling devices and no impact for cooling
states during suspend. With such sensor and cooling device support,
thermal core resume re-evaluation for each thermal zone is redundant
and it can be ignored to avoid issues mentioned above.

Add wake-capable-sensor property to thermal zone devicetree node to
denote that these sensors are wakeup capable. If a thermal zone has
this property defined, thermal framework ignores resume re-evaluation
and can service the threshold notification during the suspend/resume
path.

Change-Id: I07edf80ad29009378af4c70e750d01bde6f30806
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 2f1258a..72c40bd 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -81,6 +81,7 @@
  * @slope: slope of the temperature adjustment curve
  * @offset: offset of the temperature adjustment curve
  * @default_disable: Keep the thermal zone disabled by default
+ * @is_wakeable: Ignore post suspend thermal zone re-evaluation
  * @tzd: thermal zone device pointer for this sensor
  * @ntrips: number of trip points
  * @trips: an array of trip points (0..ntrips - 1)
@@ -98,6 +99,7 @@
 	int offset;
 	struct thermal_zone_device *tzd;
 	bool default_disable;
+	bool is_wakeable;
 
 	/* trip data */
 	int ntrips;
@@ -512,6 +514,13 @@
 	return -EINVAL;
 }
 
+static bool of_thermal_is_wakeable(struct thermal_zone_device *tz)
+{
+	struct __thermal_zone *data = tz->devdata;
+
+	return data->is_wakeable;
+}
+
 static int of_thermal_aggregate_trip_types(struct thermal_zone_device *tz,
 		unsigned int trip_type_mask, int *low, int *high)
 {
@@ -637,6 +646,8 @@
 
 	.bind = of_thermal_bind,
 	.unbind = of_thermal_unbind,
+
+	.is_wakeable = of_thermal_is_wakeable,
 };
 
 static struct thermal_zone_of_device_ops of_virt_ops = {
@@ -1252,6 +1263,9 @@
 
 	tz->default_disable = of_property_read_bool(np,
 					"disable-thermal-zone");
+
+	tz->is_wakeable = of_property_read_bool(np,
+					"wake-capable-sensor");
 	/*
 	 * REVIST: for now, the thermal framework supports only
 	 * one sensor per thermal zone. Thus, we are considering