1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM thermal
3
4#if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_THERMAL_H
6
7#include <linux/devfreq.h>
8#include <linux/thermal.h>
9#include <linux/tracepoint.h>
10
11TRACE_EVENT(thermal_temperature,
12
13	TP_PROTO(struct thermal_zone_device *tz),
14
15	TP_ARGS(tz),
16
17	TP_STRUCT__entry(
18		__string(thermal_zone, tz->type)
19		__field(int, id)
20		__field(int, temp_prev)
21		__field(int, temp)
22	),
23
24	TP_fast_assign(
25		__assign_str(thermal_zone, tz->type);
26		__entry->id = tz->id;
27		__entry->temp_prev = tz->last_temperature;
28		__entry->temp = tz->temperature;
29	),
30
31	TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
32		__get_str(thermal_zone), __entry->id, __entry->temp_prev,
33		__entry->temp)
34);
35
36TRACE_EVENT(cdev_update,
37
38	TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target),
39
40	TP_ARGS(cdev, target),
41
42	TP_STRUCT__entry(
43		__string(type, cdev->type)
44		__field(unsigned long, target)
45	),
46
47	TP_fast_assign(
48		__assign_str(type, cdev->type);
49		__entry->target = target;
50	),
51
52	TP_printk("type=%s target=%lu", __get_str(type), __entry->target)
53);
54
55TRACE_EVENT(thermal_zone_trip,
56
57	TP_PROTO(struct thermal_zone_device *tz, int trip,
58		enum thermal_trip_type trip_type),
59
60	TP_ARGS(tz, trip, trip_type),
61
62	TP_STRUCT__entry(
63		__string(thermal_zone, tz->type)
64		__field(int, id)
65		__field(int, trip)
66		__field(enum thermal_trip_type, trip_type)
67	),
68
69	TP_fast_assign(
70		__assign_str(thermal_zone, tz->type);
71		__entry->id = tz->id;
72		__entry->trip = trip;
73		__entry->trip_type = trip_type;
74	),
75
76	TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%d",
77		__get_str(thermal_zone), __entry->id, __entry->trip,
78		__entry->trip_type)
79);
80
81TRACE_EVENT(thermal_power_cpu_get_power,
82	TP_PROTO(const struct cpumask *cpus, unsigned long freq, u32 *load,
83		size_t load_len, u32 dynamic_power, u32 static_power),
84
85	TP_ARGS(cpus, freq, load, load_len, dynamic_power, static_power),
86
87	TP_STRUCT__entry(
88		__bitmask(cpumask, num_possible_cpus())
89		__field(unsigned long, freq          )
90		__dynamic_array(u32,   load, load_len)
91		__field(size_t,        load_len      )
92		__field(u32,           dynamic_power )
93		__field(u32,           static_power  )
94	),
95
96	TP_fast_assign(
97		__assign_bitmask(cpumask, cpumask_bits(cpus),
98				num_possible_cpus());
99		__entry->freq = freq;
100		memcpy(__get_dynamic_array(load), load,
101			load_len * sizeof(*load));
102		__entry->load_len = load_len;
103		__entry->dynamic_power = dynamic_power;
104		__entry->static_power = static_power;
105	),
106
107	TP_printk("cpus=%s freq=%lu load={%s} dynamic_power=%d static_power=%d",
108		__get_bitmask(cpumask), __entry->freq,
109		__print_array(__get_dynamic_array(load), __entry->load_len, 4),
110		__entry->dynamic_power, __entry->static_power)
111);
112
113TRACE_EVENT(thermal_power_cpu_limit,
114	TP_PROTO(const struct cpumask *cpus, unsigned int freq,
115		unsigned long cdev_state, u32 power),
116
117	TP_ARGS(cpus, freq, cdev_state, power),
118
119	TP_STRUCT__entry(
120		__bitmask(cpumask, num_possible_cpus())
121		__field(unsigned int,  freq      )
122		__field(unsigned long, cdev_state)
123		__field(u32,           power     )
124	),
125
126	TP_fast_assign(
127		__assign_bitmask(cpumask, cpumask_bits(cpus),
128				num_possible_cpus());
129		__entry->freq = freq;
130		__entry->cdev_state = cdev_state;
131		__entry->power = power;
132	),
133
134	TP_printk("cpus=%s freq=%u cdev_state=%lu power=%u",
135		__get_bitmask(cpumask), __entry->freq, __entry->cdev_state,
136		__entry->power)
137);
138
139TRACE_EVENT(thermal_power_devfreq_get_power,
140	TP_PROTO(struct thermal_cooling_device *cdev,
141		 struct devfreq_dev_status *status, unsigned long freq,
142		u32 dynamic_power, u32 static_power),
143
144	TP_ARGS(cdev, status,  freq, dynamic_power, static_power),
145
146	TP_STRUCT__entry(
147		__string(type,         cdev->type    )
148		__field(unsigned long, freq          )
149		__field(u32,           load          )
150		__field(u32,           dynamic_power )
151		__field(u32,           static_power  )
152	),
153
154	TP_fast_assign(
155		__assign_str(type, cdev->type);
156		__entry->freq = freq;
157		__entry->load = (100 * status->busy_time) / status->total_time;
158		__entry->dynamic_power = dynamic_power;
159		__entry->static_power = static_power;
160	),
161
162	TP_printk("type=%s freq=%lu load=%u dynamic_power=%u static_power=%u",
163		__get_str(type), __entry->freq,
164		__entry->load, __entry->dynamic_power, __entry->static_power)
165);
166
167TRACE_EVENT(thermal_power_devfreq_limit,
168	TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq,
169		unsigned long cdev_state, u32 power),
170
171	TP_ARGS(cdev, freq, cdev_state, power),
172
173	TP_STRUCT__entry(
174		__string(type,         cdev->type)
175		__field(unsigned int,  freq      )
176		__field(unsigned long, cdev_state)
177		__field(u32,           power     )
178	),
179
180	TP_fast_assign(
181		__assign_str(type, cdev->type);
182		__entry->freq = freq;
183		__entry->cdev_state = cdev_state;
184		__entry->power = power;
185	),
186
187	TP_printk("type=%s freq=%u cdev_state=%lu power=%u",
188		__get_str(type), __entry->freq, __entry->cdev_state,
189		__entry->power)
190);
191#endif /* _TRACE_THERMAL_H */
192
193/* This part must be outside protection */
194#include <trace/define_trace.h>
195