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>
(cherry picked from commit f6e47fd00f24d5e814d316b03974e970dd87879e)
This commit is contained in:
Manaf Meethalavalappu Pallikunhi
2022-06-06 02:10:38 +05:30
committed by Matthias Männich
parent a47cec9c43
commit a3e8b04796
3 changed files with 27 additions and 1 deletions

View File

@@ -401,6 +401,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_udp_recvmsg);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_tcp_recvmsg_stat);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pci_d3_sleep);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_slab);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_disable_thermal_cooling_stats);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_page_mapcount);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_add_page_to_lrulist);

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"
@@ -886,9 +887,22 @@ static struct attribute *cooling_device_stats_attrs[] = {
NULL
};
static umode_t cooling_device_stats_is_visible(struct kobject *kobj,
struct attribute *attr, int attrno)
{
struct thermal_cooling_device *cdev = to_cooling_device(
kobj_to_dev(kobj));
if (!cdev->stats)
return 0;
return attr->mode;
}
static const struct attribute_group cooling_device_stats_attr_group = {
.attrs = cooling_device_stats_attrs,
.name = "stats"
.name = "stats",
.is_visible = cooling_device_stats_is_visible,
};
static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
@@ -896,6 +910,12 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
struct cooling_dev_stats *stats;
unsigned long states;
int var;
bool disable_cdev_stats = false;
trace_android_vh_disable_thermal_cooling_stats(cdev,
&disable_cdev_stats);
if (disable_cdev_stats)
return;
if (cdev->ops->get_max_state(cdev, &states))
return;

View File

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