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

Commit e8a9206c authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi
Browse files

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: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent 106b3660
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -175,6 +175,10 @@ Optional property:
			2000mW, while on a 10'' tablet is around
			4500mW.

- wake-capable-sensor:	Set to true if thermal zone sensor is wake up capable
  Type: bool		and cooling devices binded to this thermal zone are not
  Size: none		affected during suspend.

Note: The delay properties are bound to the maximum dT/dt (temperature
derivative over time) in two situations for a thermal zone:
(i)  - when passive cooling is activated (polling-delay-passive); and
+14 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ struct __sensor_param {
 * @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 @@ struct __thermal_zone {
	int offset;
	struct thermal_zone_device *tzd;
	bool default_disable;
	bool is_wakeable;

	/* trip data */
	int ntrips;
@@ -512,6 +514,13 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz,
	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 @@ static struct thermal_zone_device_ops of_thermal_ops = {

	.bind = of_thermal_bind,
	.unbind = of_thermal_unbind,

	.is_wakeable = of_thermal_is_wakeable,
};

static struct thermal_zone_of_device_ops of_virt_ops = {
@@ -1255,6 +1266,9 @@ __init *thermal_of_build_thermal_zone(struct device_node *np)

	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
+7 −2
Original line number Diff line number Diff line
@@ -492,7 +492,8 @@ void thermal_zone_device_update_temp(struct thermal_zone_device *tz,
{
	int count;

	if (atomic_read(&in_suspend))
	if (atomic_read(&in_suspend) && (!tz->ops->is_wakeable ||
		!(tz->ops->is_wakeable(tz))))
		return;

	trace_thermal_device_update(tz, event);
@@ -512,7 +513,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz,
{
	int count;

	if (atomic_read(&in_suspend))
	if (atomic_read(&in_suspend) && (!tz->ops->is_wakeable ||
		!(tz->ops->is_wakeable(tz))))
		return;

	if (!tz->ops->get_temp)
@@ -1601,6 +1603,9 @@ static int thermal_pm_notify(struct notifier_block *nb,
	case PM_POST_SUSPEND:
		atomic_set(&in_suspend, 0);
		list_for_each_entry(tz, &thermal_tz_list, node) {
			if (tz->ops->is_wakeable &&
				tz->ops->is_wakeable(tz))
				continue;
			thermal_zone_device_init(tz);
			thermal_zone_device_update(tz,
						   THERMAL_EVENT_UNSPECIFIED);
+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ struct thermal_zone_device_ops {
			  enum thermal_trend *);
	int (*notify) (struct thermal_zone_device *, int,
		       enum thermal_trip_type);
	bool (*is_wakeable)(struct thermal_zone_device *);
};

struct thermal_cooling_device_ops {