xref: /linux/drivers/thermal/thermal_trace_ipa.h (revision 621cde16e49b3ecf7d59a8106a20aaebfb4a59a9)
132a7a021SDaniel Lezcano /* SPDX-License-Identifier: GPL-2.0 */
232a7a021SDaniel Lezcano #undef TRACE_SYSTEM
332a7a021SDaniel Lezcano #define TRACE_SYSTEM thermal_power_allocator
432a7a021SDaniel Lezcano 
532a7a021SDaniel Lezcano #if !defined(_TRACE_THERMAL_POWER_ALLOCATOR_H) || defined(TRACE_HEADER_MULTI_READ)
632a7a021SDaniel Lezcano #define _TRACE_THERMAL_POWER_ALLOCATOR_H
732a7a021SDaniel Lezcano 
832a7a021SDaniel Lezcano #include <linux/tracepoint.h>
932a7a021SDaniel Lezcano 
10*b1ae92dcSRafael J. Wysocki #include "thermal_core.h"
11*b1ae92dcSRafael J. Wysocki 
1232a7a021SDaniel Lezcano TRACE_EVENT(thermal_power_allocator,
13792c3dc0SLukasz Luba 	TP_PROTO(struct thermal_zone_device *tz, u32 total_req_power,
14792c3dc0SLukasz Luba 		 u32 total_granted_power, int num_actors, u32 power_range,
15792c3dc0SLukasz Luba 		 u32 max_allocatable_power, int current_temp, s32 delta_temp),
16792c3dc0SLukasz Luba 	TP_ARGS(tz, total_req_power, total_granted_power, num_actors,
17792c3dc0SLukasz Luba 		power_range, max_allocatable_power, current_temp, delta_temp),
1832a7a021SDaniel Lezcano 	TP_STRUCT__entry(
1932a7a021SDaniel Lezcano 		__field(int,           tz_id          )
2032a7a021SDaniel Lezcano 		__field(u32,           total_req_power          )
2132a7a021SDaniel Lezcano 		__field(u32,           total_granted_power      )
2232a7a021SDaniel Lezcano 		__field(size_t,        num_actors               )
2332a7a021SDaniel Lezcano 		__field(u32,           power_range              )
2432a7a021SDaniel Lezcano 		__field(u32,           max_allocatable_power    )
2532a7a021SDaniel Lezcano 		__field(int,           current_temp             )
2632a7a021SDaniel Lezcano 		__field(s32,           delta_temp               )
2732a7a021SDaniel Lezcano 	),
2832a7a021SDaniel Lezcano 	TP_fast_assign(
2932a7a021SDaniel Lezcano 		__entry->tz_id = tz->id;
3032a7a021SDaniel Lezcano 		__entry->total_req_power = total_req_power;
3132a7a021SDaniel Lezcano 		__entry->total_granted_power = total_granted_power;
3232a7a021SDaniel Lezcano 		__entry->num_actors = num_actors;
3332a7a021SDaniel Lezcano 		__entry->power_range = power_range;
3432a7a021SDaniel Lezcano 		__entry->max_allocatable_power = max_allocatable_power;
3532a7a021SDaniel Lezcano 		__entry->current_temp = current_temp;
3632a7a021SDaniel Lezcano 		__entry->delta_temp = delta_temp;
3732a7a021SDaniel Lezcano 	),
3832a7a021SDaniel Lezcano 
39792c3dc0SLukasz Luba 	TP_printk("thermal_zone_id=%d total_req_power=%u total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%d delta_temperature=%d",
40792c3dc0SLukasz Luba 		__entry->tz_id,	__entry->total_req_power,
4132a7a021SDaniel Lezcano 		__entry->total_granted_power, __entry->power_range,
4232a7a021SDaniel Lezcano 		__entry->max_allocatable_power, __entry->current_temp,
4332a7a021SDaniel Lezcano 		__entry->delta_temp)
4432a7a021SDaniel Lezcano );
4532a7a021SDaniel Lezcano 
46792c3dc0SLukasz Luba TRACE_EVENT(thermal_power_actor,
47792c3dc0SLukasz Luba 	TP_PROTO(struct thermal_zone_device *tz, int actor_id, u32 req_power,
48792c3dc0SLukasz Luba 		 u32 granted_power),
49792c3dc0SLukasz Luba 	TP_ARGS(tz, actor_id, req_power, granted_power),
50792c3dc0SLukasz Luba 	TP_STRUCT__entry(
51792c3dc0SLukasz Luba 		__field(int, tz_id)
52792c3dc0SLukasz Luba 		__field(int, actor_id)
53792c3dc0SLukasz Luba 		__field(u32, req_power)
54792c3dc0SLukasz Luba 		__field(u32, granted_power)
55792c3dc0SLukasz Luba 	),
56792c3dc0SLukasz Luba 	TP_fast_assign(
57792c3dc0SLukasz Luba 		__entry->tz_id = tz->id;
58792c3dc0SLukasz Luba 		__entry->actor_id = actor_id;
59792c3dc0SLukasz Luba 		__entry->req_power = req_power;
60792c3dc0SLukasz Luba 		__entry->granted_power = granted_power;
61792c3dc0SLukasz Luba 	),
62792c3dc0SLukasz Luba 
63792c3dc0SLukasz Luba 	TP_printk("thermal_zone_id=%d actor_id=%d req_power=%u granted_power=%u",
64792c3dc0SLukasz Luba 		__entry->tz_id,	__entry->actor_id, __entry->req_power,
65792c3dc0SLukasz Luba 		__entry->granted_power)
66792c3dc0SLukasz Luba );
67792c3dc0SLukasz Luba 
6832a7a021SDaniel Lezcano TRACE_EVENT(thermal_power_allocator_pid,
6932a7a021SDaniel Lezcano 	TP_PROTO(struct thermal_zone_device *tz, s32 err, s32 err_integral,
7032a7a021SDaniel Lezcano 		 s64 p, s64 i, s64 d, s32 output),
7132a7a021SDaniel Lezcano 	TP_ARGS(tz, err, err_integral, p, i, d, output),
7232a7a021SDaniel Lezcano 	TP_STRUCT__entry(
7332a7a021SDaniel Lezcano 		__field(int, tz_id       )
7432a7a021SDaniel Lezcano 		__field(s32, err         )
7532a7a021SDaniel Lezcano 		__field(s32, err_integral)
7632a7a021SDaniel Lezcano 		__field(s64, p           )
7732a7a021SDaniel Lezcano 		__field(s64, i           )
7832a7a021SDaniel Lezcano 		__field(s64, d           )
7932a7a021SDaniel Lezcano 		__field(s32, output      )
8032a7a021SDaniel Lezcano 	),
8132a7a021SDaniel Lezcano 	TP_fast_assign(
8232a7a021SDaniel Lezcano 		__entry->tz_id = tz->id;
8332a7a021SDaniel Lezcano 		__entry->err = err;
8432a7a021SDaniel Lezcano 		__entry->err_integral = err_integral;
8532a7a021SDaniel Lezcano 		__entry->p = p;
8632a7a021SDaniel Lezcano 		__entry->i = i;
8732a7a021SDaniel Lezcano 		__entry->d = d;
8832a7a021SDaniel Lezcano 		__entry->output = output;
8932a7a021SDaniel Lezcano 	),
9032a7a021SDaniel Lezcano 
9132a7a021SDaniel Lezcano 	TP_printk("thermal_zone_id=%d err=%d err_integral=%d p=%lld i=%lld d=%lld output=%d",
9232a7a021SDaniel Lezcano 		  __entry->tz_id, __entry->err, __entry->err_integral,
9332a7a021SDaniel Lezcano 		  __entry->p, __entry->i, __entry->d, __entry->output)
9432a7a021SDaniel Lezcano );
9532a7a021SDaniel Lezcano #endif /* _TRACE_THERMAL_POWER_ALLOCATOR_H */
9632a7a021SDaniel Lezcano 
9732a7a021SDaniel Lezcano #undef TRACE_INCLUDE_PATH
9832a7a021SDaniel Lezcano #define TRACE_INCLUDE_PATH .
9932a7a021SDaniel Lezcano 
10032a7a021SDaniel Lezcano #undef TRACE_INCLUDE_FILE
10132a7a021SDaniel Lezcano #define TRACE_INCLUDE_FILE thermal_trace_ipa
10232a7a021SDaniel Lezcano 
10332a7a021SDaniel Lezcano /* This part must be outside protection */
10432a7a021SDaniel Lezcano #include <trace/define_trace.h>
105