Merge tag 'iio-fixes-for-6.6a' of https://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-starfive.git] / drivers / thermal / thermal_trace_ipa.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM thermal_power_allocator
4
5 #if !defined(_TRACE_THERMAL_POWER_ALLOCATOR_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_THERMAL_POWER_ALLOCATOR_H
7
8 #include <linux/tracepoint.h>
9
10 TRACE_EVENT(thermal_power_allocator,
11         TP_PROTO(struct thermal_zone_device *tz, u32 *req_power,
12                  u32 total_req_power, u32 *granted_power,
13                  u32 total_granted_power, size_t num_actors,
14                  u32 power_range, u32 max_allocatable_power,
15                  int current_temp, s32 delta_temp),
16         TP_ARGS(tz, req_power, total_req_power, granted_power,
17                 total_granted_power, num_actors, power_range,
18                 max_allocatable_power, current_temp, delta_temp),
19         TP_STRUCT__entry(
20                 __field(int,           tz_id          )
21                 __dynamic_array(u32,   req_power, num_actors    )
22                 __field(u32,           total_req_power          )
23                 __dynamic_array(u32,   granted_power, num_actors)
24                 __field(u32,           total_granted_power      )
25                 __field(size_t,        num_actors               )
26                 __field(u32,           power_range              )
27                 __field(u32,           max_allocatable_power    )
28                 __field(int,           current_temp             )
29                 __field(s32,           delta_temp               )
30         ),
31         TP_fast_assign(
32                 __entry->tz_id = tz->id;
33                 memcpy(__get_dynamic_array(req_power), req_power,
34                         num_actors * sizeof(*req_power));
35                 __entry->total_req_power = total_req_power;
36                 memcpy(__get_dynamic_array(granted_power), granted_power,
37                         num_actors * sizeof(*granted_power));
38                 __entry->total_granted_power = total_granted_power;
39                 __entry->num_actors = num_actors;
40                 __entry->power_range = power_range;
41                 __entry->max_allocatable_power = max_allocatable_power;
42                 __entry->current_temp = current_temp;
43                 __entry->delta_temp = delta_temp;
44         ),
45
46         TP_printk("thermal_zone_id=%d req_power={%s} total_req_power=%u granted_power={%s} total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%d delta_temperature=%d",
47                 __entry->tz_id,
48                 __print_array(__get_dynamic_array(req_power),
49                               __entry->num_actors, 4),
50                 __entry->total_req_power,
51                 __print_array(__get_dynamic_array(granted_power),
52                               __entry->num_actors, 4),
53                 __entry->total_granted_power, __entry->power_range,
54                 __entry->max_allocatable_power, __entry->current_temp,
55                 __entry->delta_temp)
56 );
57
58 TRACE_EVENT(thermal_power_allocator_pid,
59         TP_PROTO(struct thermal_zone_device *tz, s32 err, s32 err_integral,
60                  s64 p, s64 i, s64 d, s32 output),
61         TP_ARGS(tz, err, err_integral, p, i, d, output),
62         TP_STRUCT__entry(
63                 __field(int, tz_id       )
64                 __field(s32, err         )
65                 __field(s32, err_integral)
66                 __field(s64, p           )
67                 __field(s64, i           )
68                 __field(s64, d           )
69                 __field(s32, output      )
70         ),
71         TP_fast_assign(
72                 __entry->tz_id = tz->id;
73                 __entry->err = err;
74                 __entry->err_integral = err_integral;
75                 __entry->p = p;
76                 __entry->i = i;
77                 __entry->d = d;
78                 __entry->output = output;
79         ),
80
81         TP_printk("thermal_zone_id=%d err=%d err_integral=%d p=%lld i=%lld d=%lld output=%d",
82                   __entry->tz_id, __entry->err, __entry->err_integral,
83                   __entry->p, __entry->i, __entry->d, __entry->output)
84 );
85 #endif /* _TRACE_THERMAL_POWER_ALLOCATOR_H */
86
87 #undef TRACE_INCLUDE_PATH
88 #define TRACE_INCLUDE_PATH .
89
90 #undef TRACE_INCLUDE_FILE
91 #define TRACE_INCLUDE_FILE thermal_trace_ipa
92
93 /* This part must be outside protection */
94 #include <trace/define_trace.h>