diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index c6614d410b4e..d8608099e62e 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -350,6 +350,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tcp_update_rtt); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_alloc); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sk_free); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_pm_notify_suspend); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watermark_fast_ok); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_workingset_refault); diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index b1a72646dd58..3930019d0087 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -22,6 +22,8 @@ #include #include +#include + #define CREATE_TRACE_POINTS #include "thermal_trace.h" @@ -1343,6 +1345,8 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_crit_temp); static void thermal_zone_init_complete(struct thermal_zone_device *tz) { + int irq_wakeable = 0; + mutex_lock(&tz->lock); tz->state &= ~TZ_STATE_FLAG_INIT; @@ -1351,8 +1355,11 @@ static void thermal_zone_init_complete(struct thermal_zone_device *tz) * new thermal zone needs to be marked as suspended because * thermal_pm_notify() has run already. */ - if (thermal_pm_suspended) - tz->state |= TZ_STATE_FLAG_SUSPENDED; + if (thermal_pm_suspended) { + trace_android_vh_thermal_pm_notify_suspend(tz, &irq_wakeable); + if (!irq_wakeable) + tz->state |= TZ_STATE_FLAG_SUSPENDED; + } __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); @@ -1754,6 +1761,7 @@ static int thermal_pm_notify(struct notifier_block *nb, unsigned long mode, void *_unused) { struct thermal_zone_device *tz; + int irq_wakeable = 0; switch (mode) { case PM_HIBERNATION_PREPARE: @@ -1763,8 +1771,14 @@ static int thermal_pm_notify(struct notifier_block *nb, thermal_pm_suspended = true; - list_for_each_entry(tz, &thermal_tz_list, node) + list_for_each_entry(tz, &thermal_tz_list, node) { + + trace_android_vh_thermal_pm_notify_suspend(tz, &irq_wakeable); + if (irq_wakeable) + continue; + thermal_zone_pm_prepare(tz); + } mutex_unlock(&thermal_list_lock); break; @@ -1775,8 +1789,14 @@ static int thermal_pm_notify(struct notifier_block *nb, thermal_pm_suspended = false; - list_for_each_entry(tz, &thermal_tz_list, node) + list_for_each_entry(tz, &thermal_tz_list, node) { + + trace_android_vh_thermal_pm_notify_suspend(tz, &irq_wakeable); + if (irq_wakeable) + continue; + thermal_zone_pm_complete(tz); + } mutex_unlock(&thermal_list_lock); break; diff --git a/include/trace/hooks/thermal.h b/include/trace/hooks/thermal.h index 2f86eab8dac9..9b87f957cb1e 100644 --- a/include/trace/hooks/thermal.h +++ b/include/trace/hooks/thermal.h @@ -13,6 +13,11 @@ DECLARE_HOOK(android_vh_enable_thermal_genl_check, TP_PROTO(int event, int tz_id, int *enable_thermal_genl), TP_ARGS(event, tz_id, enable_thermal_genl)); +struct thermal_zone_device; +DECLARE_HOOK(android_vh_thermal_pm_notify_suspend, + TP_PROTO(struct thermal_zone_device *tz, int *irq_wakeable), + TP_ARGS(tz, irq_wakeable)); + #endif /* _TRACE_HOOK_THERMAL_H */ /* This part must be outside protection */ #include