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

Commit 964f4843 authored by Wei Wang's avatar Wei Wang Committed by Zhang Rui
Browse files

Thermal: do not clear passive state during system sleep



commit ff140fea ("Thermal: handle thermal zone device properly
during system sleep") added PM hook to call thermal zone reset during
sleep. However resetting thermal zone will also clear the passive state
and thus cancel the polling queue which leads the passive cooling device
state not being cleared properly after sleep.

thermal_pm_notify => thermal_zone_device_reset set passive to 0
thermal_zone_trip_update will skip update passive as `old_target ==
instance->target'.
monitor_thermal_zone => thermal_zone_device_set_polling will cancel
tz->poll_queue, so the cooling device state will not be changed
afterwards.

Reported-by: default avatarKame Wang <kamewang@google.com>
Signed-off-by: default avatarWei Wang <wvw@google.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 5be52fcc
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -451,16 +451,20 @@ static void update_temperature(struct thermal_zone_device *tz)
			tz->last_temperature, tz->temperature);
			tz->last_temperature, tz->temperature);
}
}


static void thermal_zone_device_reset(struct thermal_zone_device *tz)
static void thermal_zone_device_init(struct thermal_zone_device *tz)
{
{
	struct thermal_instance *pos;
	struct thermal_instance *pos;

	tz->temperature = THERMAL_TEMP_INVALID;
	tz->temperature = THERMAL_TEMP_INVALID;
	tz->passive = 0;
	list_for_each_entry(pos, &tz->thermal_instances, tz_node)
	list_for_each_entry(pos, &tz->thermal_instances, tz_node)
		pos->initialized = false;
		pos->initialized = false;
}
}


static void thermal_zone_device_reset(struct thermal_zone_device *tz)
{
	tz->passive = 0;
	thermal_zone_device_init(tz);
}

void thermal_zone_device_update(struct thermal_zone_device *tz,
void thermal_zone_device_update(struct thermal_zone_device *tz,
				enum thermal_notify_event event)
				enum thermal_notify_event event)
{
{
@@ -1502,7 +1506,7 @@ static int thermal_pm_notify(struct notifier_block *nb,
	case PM_POST_SUSPEND:
	case PM_POST_SUSPEND:
		atomic_set(&in_suspend, 0);
		atomic_set(&in_suspend, 0);
		list_for_each_entry(tz, &thermal_tz_list, node) {
		list_for_each_entry(tz, &thermal_tz_list, node) {
			thermal_zone_device_reset(tz);
			thermal_zone_device_init(tz);
			thermal_zone_device_update(tz,
			thermal_zone_device_update(tz,
						   THERMAL_EVENT_UNSPECIFIED);
						   THERMAL_EVENT_UNSPECIFIED);
		}
		}