ANDROID: thermal: Add vendor thermal genl event function

Add vendor enable_thermal_genl_check logic.
To avoid thermal-hal being woken up all the time by thermal genl events,
only the selected thermal_zone and cooling_device can send events from
kernel.

Bug: 170682696
Test: boot and thermal-hal can receive thermal genl events from kernel
Change-Id: I8f49d67963bed9d6d1f11c74bd274dc8967407c1
Signed-off-by: davidchao <davidchao@google.com>
(cherry picked from commit 88133a5b0b63a55dfb138e2150a6fd22b81c65a2)
Signed-off-by: J. Avila <elavila@google.com>
This commit is contained in:
davidchao
2021-02-01 16:46:13 +08:00
committed by J. Avila
parent f5998fbf2d
commit ea8600cea8
3 changed files with 28 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
#include <trace/hooks/power.h>
#include <trace/hooks/fault.h>
#include <trace/hooks/iommu.h>
#include <trace/hooks/thermal.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -157,3 +158,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pick_next_entity);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_wakeup);
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);

View File

@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <net/genetlink.h>
#include <trace/hooks/thermal.h>
#include <uapi/linux/thermal.h>
#include "thermal_core.h"
@@ -229,6 +230,11 @@ static int thermal_genl_send_event(enum thermal_genl_event event,
struct sk_buff *msg;
int ret = -EMSGSIZE;
void *hdr;
int enable_thermal_genl = 1;
trace_android_vh_enable_thermal_genl_check(event, &enable_thermal_genl);
if (!enable_thermal_genl)
return 0;
msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (!msg)

View File

@@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM thermal
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_THERMAL_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
DECLARE_HOOK(android_vh_enable_thermal_genl_check,
TP_PROTO(int event, int *enable_thermal_genl),
TP_ARGS(event, enable_thermal_genl));
#endif /* _TRACE_HOOK_THERMAL_H */
/* This part must be outside protection */
#include <trace/define_trace.h>