Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / thermal / thermal_trace.h
blobdf8f4edd6068aa572ac7c9cdfcf70fb75406f3ea
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM thermal
5 #if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_THERMAL_H
8 #include <linux/devfreq.h>
9 #include <linux/thermal.h>
10 #include <linux/tracepoint.h>
12 #include "thermal_core.h"
14 TRACE_DEFINE_ENUM(THERMAL_TRIP_CRITICAL);
15 TRACE_DEFINE_ENUM(THERMAL_TRIP_HOT);
16 TRACE_DEFINE_ENUM(THERMAL_TRIP_PASSIVE);
17 TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE);
19 #define show_tzt_type(type) \
20 __print_symbolic(type, \
21 { THERMAL_TRIP_CRITICAL, "CRITICAL"}, \
22 { THERMAL_TRIP_HOT, "HOT"}, \
23 { THERMAL_TRIP_PASSIVE, "PASSIVE"}, \
24 { THERMAL_TRIP_ACTIVE, "ACTIVE"})
26 TRACE_EVENT(thermal_temperature,
28 TP_PROTO(struct thermal_zone_device *tz),
30 TP_ARGS(tz),
32 TP_STRUCT__entry(
33 __string(thermal_zone, tz->type)
34 __field(int, id)
35 __field(int, temp_prev)
36 __field(int, temp)
39 TP_fast_assign(
40 __assign_str(thermal_zone);
41 __entry->id = tz->id;
42 __entry->temp_prev = tz->last_temperature;
43 __entry->temp = tz->temperature;
46 TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
47 __get_str(thermal_zone), __entry->id, __entry->temp_prev,
48 __entry->temp)
51 TRACE_EVENT(cdev_update,
53 TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target),
55 TP_ARGS(cdev, target),
57 TP_STRUCT__entry(
58 __string(type, cdev->type)
59 __field(unsigned long, target)
62 TP_fast_assign(
63 __assign_str(type);
64 __entry->target = target;
67 TP_printk("type=%s target=%lu", __get_str(type), __entry->target)
70 TRACE_EVENT(thermal_zone_trip,
72 TP_PROTO(struct thermal_zone_device *tz, int trip,
73 enum thermal_trip_type trip_type),
75 TP_ARGS(tz, trip, trip_type),
77 TP_STRUCT__entry(
78 __string(thermal_zone, tz->type)
79 __field(int, id)
80 __field(int, trip)
81 __field(enum thermal_trip_type, trip_type)
84 TP_fast_assign(
85 __assign_str(thermal_zone);
86 __entry->id = tz->id;
87 __entry->trip = trip;
88 __entry->trip_type = trip_type;
91 TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%s",
92 __get_str(thermal_zone), __entry->id, __entry->trip,
93 show_tzt_type(__entry->trip_type))
96 #ifdef CONFIG_CPU_THERMAL
97 TRACE_EVENT(thermal_power_cpu_get_power_simple,
98 TP_PROTO(int cpu, u32 power),
100 TP_ARGS(cpu, power),
102 TP_STRUCT__entry(
103 __field(int, cpu)
104 __field(u32, power)
107 TP_fast_assign(
108 __entry->cpu = cpu;
109 __entry->power = power;
112 TP_printk("cpu=%d power=%u", __entry->cpu, __entry->power)
115 TRACE_EVENT(thermal_power_cpu_limit,
116 TP_PROTO(const struct cpumask *cpus, unsigned int freq,
117 unsigned long cdev_state, u32 power),
119 TP_ARGS(cpus, freq, cdev_state, power),
121 TP_STRUCT__entry(
122 __bitmask(cpumask, num_possible_cpus())
123 __field(unsigned int, freq )
124 __field(unsigned long, cdev_state)
125 __field(u32, power )
128 TP_fast_assign(
129 __assign_bitmask(cpumask, cpumask_bits(cpus),
130 num_possible_cpus());
131 __entry->freq = freq;
132 __entry->cdev_state = cdev_state;
133 __entry->power = power;
136 TP_printk("cpus=%s freq=%u cdev_state=%lu power=%u",
137 __get_bitmask(cpumask), __entry->freq, __entry->cdev_state,
138 __entry->power)
140 #endif /* CONFIG_CPU_THERMAL */
142 #ifdef CONFIG_DEVFREQ_THERMAL
143 TRACE_EVENT(thermal_power_devfreq_get_power,
144 TP_PROTO(struct thermal_cooling_device *cdev,
145 struct devfreq_dev_status *status, unsigned long freq,
146 u32 power),
148 TP_ARGS(cdev, status, freq, power),
150 TP_STRUCT__entry(
151 __string(type, cdev->type )
152 __field(unsigned long, freq )
153 __field(u32, busy_time)
154 __field(u32, total_time)
155 __field(u32, power)
158 TP_fast_assign(
159 __assign_str(type);
160 __entry->freq = freq;
161 __entry->busy_time = status->busy_time;
162 __entry->total_time = status->total_time;
163 __entry->power = power;
166 TP_printk("type=%s freq=%lu load=%u power=%u",
167 __get_str(type), __entry->freq,
168 __entry->total_time == 0 ? 0 :
169 (100 * __entry->busy_time) / __entry->total_time,
170 __entry->power)
173 TRACE_EVENT(thermal_power_devfreq_limit,
174 TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq,
175 unsigned long cdev_state, u32 power),
177 TP_ARGS(cdev, freq, cdev_state, power),
179 TP_STRUCT__entry(
180 __string(type, cdev->type)
181 __field(unsigned int, freq )
182 __field(unsigned long, cdev_state)
183 __field(u32, power )
186 TP_fast_assign(
187 __assign_str(type);
188 __entry->freq = freq;
189 __entry->cdev_state = cdev_state;
190 __entry->power = power;
193 TP_printk("type=%s freq=%u cdev_state=%lu power=%u",
194 __get_str(type), __entry->freq, __entry->cdev_state,
195 __entry->power)
197 #endif /* CONFIG_DEVFREQ_THERMAL */
198 #endif /* _TRACE_THERMAL_H */
200 #undef TRACE_INCLUDE_PATH
201 #define TRACE_INCLUDE_PATH .
203 #undef TRACE_INCLUDE_FILE
204 #define TRACE_INCLUDE_FILE thermal_trace
206 /* This part must be outside protection */
207 #include <trace/define_trace.h>