From cc574f0d36985ab470d6021be0edf28eb422e37d Mon Sep 17 00:00:00 2001 From: davidchao Date: Wed, 10 Mar 2021 13:56:15 +0800 Subject: [PATCH] ANDROID: thermal: Add logic for filter on-die tz genl event. Add logic in enable_thermal_genl_check to avoid thermal-hal being woken up all the time by on-die sensor. When the temperature of the on-die sensor thermal_zone updates, the thermal_zone_device_update() will be called to handle thermal and then the netlink events will be sent through thermal_notify_tz_trip_(). But there is currently no way to filter thermal_zone in the thermal_netlink, so many netlink events will be sent in a short amount of time. Because the on-die sensors are very sensitive. Their temperature may jump up and down quickly in a few ms. Bug: 170682696 Test: boot and thermal-hal can receive thermal genl events from kernel Change-Id: Idb3f4b07a2a2740c01d8785910878bfe6edc832d Signed-off-by: davidchao --- drivers/thermal/thermal_netlink.c | 2 +- include/trace/hooks/thermal.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c index 0bfe30233afe..c82dba5ee231 100644 --- a/drivers/thermal/thermal_netlink.c +++ b/drivers/thermal/thermal_netlink.c @@ -232,7 +232,7 @@ static int thermal_genl_send_event(enum thermal_genl_event event, void *hdr; int enable_thermal_genl = 1; - trace_android_vh_enable_thermal_genl_check(event, &enable_thermal_genl); + trace_android_vh_enable_thermal_genl_check(event, p->tz_id, &enable_thermal_genl); if (!enable_thermal_genl) return 0; diff --git a/include/trace/hooks/thermal.h b/include/trace/hooks/thermal.h index 0e47e0af9284..ae9b7ee652fb 100644 --- a/include/trace/hooks/thermal.h +++ b/include/trace/hooks/thermal.h @@ -11,8 +11,8 @@ #include DECLARE_HOOK(android_vh_enable_thermal_genl_check, - TP_PROTO(int event, int *enable_thermal_genl), - TP_ARGS(event, enable_thermal_genl)); + TP_PROTO(int event, int tz_id, int *enable_thermal_genl), + TP_ARGS(event, tz_id, enable_thermal_genl)); #endif /* _TRACE_HOOK_THERMAL_H */ /* This part must be outside protection */