ANDROID: thermal: vendor hook to disable thermal cooling stats

Add vendor hook to thermal to allow vendor to selectively disable
thermal cooling device stats feature based on requirement. It helps
vendor to optimize memory footprint due to this feature especially
for low memory devices.

Bug: 218825214
Change-Id: I2ec72505f03575e09229c54765584614b16a3904
Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
This commit is contained in:
Manaf Meethalavalappu Pallikunhi 2022-06-06 02:10:38 +05:30 committed by Todd Kjos
parent 2baf6bfef4
commit f6e47fd00f
3 changed files with 16 additions and 0 deletions

View File

@ -285,6 +285,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_thermal_target_freq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_register);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_unregister);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery_set);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_disable_thermal_cooling_stats);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_power_throttle);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake);

View File

@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/jiffies.h>
#include <trace/hooks/thermal.h>
#include "thermal_core.h"
@ -816,6 +817,15 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
struct cooling_dev_stats *stats;
unsigned long states;
int var;
int disable_cdev_stats = 0;
trace_android_vh_disable_thermal_cooling_stats(cdev,
&disable_cdev_stats);
if (disable_cdev_stats) {
var = ARRAY_SIZE(cooling_device_attr_groups) - 2;
cooling_device_attr_groups[var] = NULL;
return;
}
if (cdev->ops->get_max_state(cdev, &states))
return;

View File

@ -39,6 +39,11 @@ DECLARE_HOOK(android_vh_get_thermal_zone_device,
TP_PROTO(struct thermal_zone_device *tz),
TP_ARGS(tz));
struct thermal_cooling_device;
DECLARE_HOOK(android_vh_disable_thermal_cooling_stats,
TP_PROTO(struct thermal_cooling_device *cdev, int *disable_stats),
TP_ARGS(cdev, disable_stats));
#endif /* _TRACE_HOOK_THERMAL_H */
/* This part must be outside protection */
#include <trace/define_trace.h>