thermal: core: skip update disabled thermal zones after suspend

It is unnecessary to update disabled thermal zones post suspend and
sometimes leads error/warning in bad behaved thermal drivers.

Bug: 129435616
Change-Id: If5d3bfe84879779ec1ee024c0cf388ea3b4be2ea
Signed-off-by: Wei Wang <wvw@google.com>
Signed-off-by: Sorayukii <sorayukii69@gmail.com>
This commit is contained in:
Wei Wang 2019-04-15 14:23:32 -07:00 • committed by Sorayukii
commit baef852a71

View file

@ -2611,6 +2611,7 @@ static int thermal_pm_notify(struct notifier_block *nb,
unsigned long mode, void *_unused)
{
struct thermal_zone_device *tz;
enum thermal_device_mode tz_mode;
switch (mode) {
case PM_HIBERNATION_PREPARE:
@ -2623,9 +2624,15 @@ 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))
tz_mode = THERMAL_DEVICE_ENABLED;
if (tz->ops->get_mode)
tz->ops->get_mode(tz, &tz_mode);
if ((tz->ops->is_wakeable &&
tz->ops->is_wakeable(tz)) ||
tz_mode == THERMAL_DEVICE_DISABLED)
continue;
thermal_zone_device_init(tz);
thermal_zone_device_update(tz,
THERMAL_EVENT_UNSPECIFIED);