From a4af23d274bc9b86d7f630bd91c231b7f919bac3 Mon Sep 17 00:00:00 2001 From: David Chao Date: Wed, 7 Apr 2021 17:49:53 +0800 Subject: [PATCH] ANDROID: thermal: Add vendor thermal_pm_notify_suspend function Currently, most of the thermal_zones are IRQ capable and they do not need to be updated while resuming. To improve the system performance and reduce the resume time. Add a vendor function to check if the thermal_zone is not IRQ capable and needs to be updated. Bug: 170905417 Test: boot and vendor function worked properly. Change-Id: I9389985bba29b551a7a20b55e1ed26b6c4da9b3d Signed-off-by: David Chao --- drivers/android/vendor_hooks.c | 1 + drivers/thermal/thermal_core.c | 7 +++++++ include/trace/hooks/thermal.h | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index c391ad508f3e..e90d7b81aa3b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -182,6 +182,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pagecache_get_page); 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_ufs_fill_prdt); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_prepare_command); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sysfs); diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index a681265bb713..21db445599ec 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -23,6 +23,8 @@ #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include #include "thermal_core.h" #include "thermal_hwmon.h" @@ -1613,6 +1615,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: @@ -1628,6 +1631,10 @@ static int thermal_pm_notify(struct notifier_block *nb, if (!thermal_zone_device_is_enabled(tz)) continue; + trace_android_vh_thermal_pm_notify_suspend(tz, &irq_wakeable); + if (irq_wakeable) + continue; + thermal_zone_device_init(tz); thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); diff --git a/include/trace/hooks/thermal.h b/include/trace/hooks/thermal.h index ae9b7ee652fb..944454ca0e48 100644 --- a/include/trace/hooks/thermal.h +++ b/include/trace/hooks/thermal.h @@ -14,6 +14,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