usb: dwc_otg_310: Fixed that otg-host cannot transport LS device data.
[firefly-linux-kernel-4.4.55.git] / include / trace / events / power.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM power
3
4 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_POWER_H
6
7 #include <linux/ktime.h>
8 #include <linux/pm_qos.h>
9 #include <linux/tracepoint.h>
10 #include <linux/trace_events.h>
11
12 #define TPS(x)  tracepoint_string(x)
13
14 DECLARE_EVENT_CLASS(cpu,
15
16         TP_PROTO(unsigned int state, unsigned int cpu_id),
17
18         TP_ARGS(state, cpu_id),
19
20         TP_STRUCT__entry(
21                 __field(        u32,            state           )
22                 __field(        u32,            cpu_id          )
23         ),
24
25         TP_fast_assign(
26                 __entry->state = state;
27                 __entry->cpu_id = cpu_id;
28         ),
29
30         TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
31                   (unsigned long)__entry->cpu_id)
32 );
33
34 DEFINE_EVENT(cpu, cpu_idle,
35
36         TP_PROTO(unsigned int state, unsigned int cpu_id),
37
38         TP_ARGS(state, cpu_id)
39 );
40
41 TRACE_EVENT(pstate_sample,
42
43         TP_PROTO(u32 core_busy,
44                 u32 scaled_busy,
45                 u32 from,
46                 u32 to,
47                 u64 mperf,
48                 u64 aperf,
49                 u64 tsc,
50                 u32 freq
51                 ),
52
53         TP_ARGS(core_busy,
54                 scaled_busy,
55                 from,
56                 to,
57                 mperf,
58                 aperf,
59                 tsc,
60                 freq
61                 ),
62
63         TP_STRUCT__entry(
64                 __field(u32, core_busy)
65                 __field(u32, scaled_busy)
66                 __field(u32, from)
67                 __field(u32, to)
68                 __field(u64, mperf)
69                 __field(u64, aperf)
70                 __field(u64, tsc)
71                 __field(u32, freq)
72                 ),
73
74         TP_fast_assign(
75                 __entry->core_busy = core_busy;
76                 __entry->scaled_busy = scaled_busy;
77                 __entry->from = from;
78                 __entry->to = to;
79                 __entry->mperf = mperf;
80                 __entry->aperf = aperf;
81                 __entry->tsc = tsc;
82                 __entry->freq = freq;
83                 ),
84
85         TP_printk("core_busy=%lu scaled=%lu from=%lu to=%lu mperf=%llu aperf=%llu tsc=%llu freq=%lu ",
86                 (unsigned long)__entry->core_busy,
87                 (unsigned long)__entry->scaled_busy,
88                 (unsigned long)__entry->from,
89                 (unsigned long)__entry->to,
90                 (unsigned long long)__entry->mperf,
91                 (unsigned long long)__entry->aperf,
92                 (unsigned long long)__entry->tsc,
93                 (unsigned long)__entry->freq
94                 )
95
96 );
97
98 /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
99 #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
100 #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
101
102 #define PWR_EVENT_EXIT -1
103 #endif
104
105 #define pm_verb_symbolic(event) \
106         __print_symbolic(event, \
107                 { PM_EVENT_SUSPEND, "suspend" }, \
108                 { PM_EVENT_RESUME, "resume" }, \
109                 { PM_EVENT_FREEZE, "freeze" }, \
110                 { PM_EVENT_QUIESCE, "quiesce" }, \
111                 { PM_EVENT_HIBERNATE, "hibernate" }, \
112                 { PM_EVENT_THAW, "thaw" }, \
113                 { PM_EVENT_RESTORE, "restore" }, \
114                 { PM_EVENT_RECOVER, "recover" })
115
116 DEFINE_EVENT(cpu, cpu_frequency,
117
118         TP_PROTO(unsigned int frequency, unsigned int cpu_id),
119
120         TP_ARGS(frequency, cpu_id)
121 );
122
123 TRACE_EVENT(cpu_frequency_limits,
124
125         TP_PROTO(unsigned int max_freq, unsigned int min_freq,
126                 unsigned int cpu_id),
127
128         TP_ARGS(max_freq, min_freq, cpu_id),
129
130         TP_STRUCT__entry(
131                 __field(        u32,            min_freq        )
132                 __field(        u32,            max_freq        )
133                 __field(        u32,            cpu_id          )
134         ),
135
136         TP_fast_assign(
137                 __entry->min_freq = min_freq;
138                 __entry->max_freq = max_freq;
139                 __entry->cpu_id = cpu_id;
140         ),
141
142         TP_printk("min=%lu max=%lu cpu_id=%lu",
143                   (unsigned long)__entry->min_freq,
144                   (unsigned long)__entry->max_freq,
145                   (unsigned long)__entry->cpu_id)
146 );
147
148 TRACE_EVENT(device_pm_callback_start,
149
150         TP_PROTO(struct device *dev, const char *pm_ops, int event),
151
152         TP_ARGS(dev, pm_ops, event),
153
154         TP_STRUCT__entry(
155                 __string(device, dev_name(dev))
156                 __string(driver, dev_driver_string(dev))
157                 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
158                 __string(pm_ops, pm_ops ? pm_ops : "none ")
159                 __field(int, event)
160         ),
161
162         TP_fast_assign(
163                 __assign_str(device, dev_name(dev));
164                 __assign_str(driver, dev_driver_string(dev));
165                 __assign_str(parent,
166                         dev->parent ? dev_name(dev->parent) : "none");
167                 __assign_str(pm_ops, pm_ops ? pm_ops : "none ");
168                 __entry->event = event;
169         ),
170
171         TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver),
172                 __get_str(device), __get_str(parent), __get_str(pm_ops),
173                 pm_verb_symbolic(__entry->event))
174 );
175
176 TRACE_EVENT(device_pm_callback_end,
177
178         TP_PROTO(struct device *dev, int error),
179
180         TP_ARGS(dev, error),
181
182         TP_STRUCT__entry(
183                 __string(device, dev_name(dev))
184                 __string(driver, dev_driver_string(dev))
185                 __field(int, error)
186         ),
187
188         TP_fast_assign(
189                 __assign_str(device, dev_name(dev));
190                 __assign_str(driver, dev_driver_string(dev));
191                 __entry->error = error;
192         ),
193
194         TP_printk("%s %s, err=%d",
195                 __get_str(driver), __get_str(device), __entry->error)
196 );
197
198 TRACE_EVENT(suspend_resume,
199
200         TP_PROTO(const char *action, int val, bool start),
201
202         TP_ARGS(action, val, start),
203
204         TP_STRUCT__entry(
205                 __field(const char *, action)
206                 __field(int, val)
207                 __field(bool, start)
208         ),
209
210         TP_fast_assign(
211                 __entry->action = action;
212                 __entry->val = val;
213                 __entry->start = start;
214         ),
215
216         TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
217                 (__entry->start)?"begin":"end")
218 );
219
220 DECLARE_EVENT_CLASS(wakeup_source,
221
222         TP_PROTO(const char *name, unsigned int state),
223
224         TP_ARGS(name, state),
225
226         TP_STRUCT__entry(
227                 __string(       name,           name            )
228                 __field(        u64,            state           )
229         ),
230
231         TP_fast_assign(
232                 __assign_str(name, name);
233                 __entry->state = state;
234         ),
235
236         TP_printk("%s state=0x%lx", __get_str(name),
237                 (unsigned long)__entry->state)
238 );
239
240 DEFINE_EVENT(wakeup_source, wakeup_source_activate,
241
242         TP_PROTO(const char *name, unsigned int state),
243
244         TP_ARGS(name, state)
245 );
246
247 DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
248
249         TP_PROTO(const char *name, unsigned int state),
250
251         TP_ARGS(name, state)
252 );
253
254 /*
255  * The clock events are used for clock enable/disable and for
256  *  clock rate change
257  */
258 DECLARE_EVENT_CLASS(clock,
259
260         TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
261
262         TP_ARGS(name, state, cpu_id),
263
264         TP_STRUCT__entry(
265                 __string(       name,           name            )
266                 __field(        u64,            state           )
267                 __field(        u64,            cpu_id          )
268         ),
269
270         TP_fast_assign(
271                 __assign_str(name, name);
272                 __entry->state = state;
273                 __entry->cpu_id = cpu_id;
274         ),
275
276         TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
277                 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
278 );
279
280 DEFINE_EVENT(clock, clock_enable,
281
282         TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
283
284         TP_ARGS(name, state, cpu_id)
285 );
286
287 DEFINE_EVENT(clock, clock_disable,
288
289         TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
290
291         TP_ARGS(name, state, cpu_id)
292 );
293
294 DEFINE_EVENT(clock, clock_set_rate,
295
296         TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
297
298         TP_ARGS(name, state, cpu_id)
299 );
300
301 TRACE_EVENT(clock_set_parent,
302
303         TP_PROTO(const char *name, const char *parent_name),
304
305         TP_ARGS(name, parent_name),
306
307         TP_STRUCT__entry(
308                 __string(       name,           name            )
309                 __string(       parent_name,    parent_name     )
310         ),
311
312         TP_fast_assign(
313                 __assign_str(name, name);
314                 __assign_str(parent_name, parent_name);
315         ),
316
317         TP_printk("%s parent=%s", __get_str(name), __get_str(parent_name))
318 );
319
320 /*
321  * The power domain events are used for power domains transitions
322  */
323 DECLARE_EVENT_CLASS(power_domain,
324
325         TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
326
327         TP_ARGS(name, state, cpu_id),
328
329         TP_STRUCT__entry(
330                 __string(       name,           name            )
331                 __field(        u64,            state           )
332                 __field(        u64,            cpu_id          )
333         ),
334
335         TP_fast_assign(
336                 __assign_str(name, name);
337                 __entry->state = state;
338                 __entry->cpu_id = cpu_id;
339 ),
340
341         TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
342                 (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
343 );
344
345 DEFINE_EVENT(power_domain, power_domain_target,
346
347         TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
348
349         TP_ARGS(name, state, cpu_id)
350 );
351
352 /*
353  * The pm qos events are used for pm qos update
354  */
355 DECLARE_EVENT_CLASS(pm_qos_request,
356
357         TP_PROTO(int pm_qos_class, s32 value),
358
359         TP_ARGS(pm_qos_class, value),
360
361         TP_STRUCT__entry(
362                 __field( int,                    pm_qos_class   )
363                 __field( s32,                    value          )
364         ),
365
366         TP_fast_assign(
367                 __entry->pm_qos_class = pm_qos_class;
368                 __entry->value = value;
369         ),
370
371         TP_printk("pm_qos_class=%s value=%d",
372                   __print_symbolic(__entry->pm_qos_class,
373                         { PM_QOS_CPU_DMA_LATENCY,       "CPU_DMA_LATENCY" },
374                         { PM_QOS_NETWORK_LATENCY,       "NETWORK_LATENCY" },
375                         { PM_QOS_NETWORK_THROUGHPUT,    "NETWORK_THROUGHPUT" }),
376                   __entry->value)
377 );
378
379 DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
380
381         TP_PROTO(int pm_qos_class, s32 value),
382
383         TP_ARGS(pm_qos_class, value)
384 );
385
386 DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
387
388         TP_PROTO(int pm_qos_class, s32 value),
389
390         TP_ARGS(pm_qos_class, value)
391 );
392
393 DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
394
395         TP_PROTO(int pm_qos_class, s32 value),
396
397         TP_ARGS(pm_qos_class, value)
398 );
399
400 TRACE_EVENT(pm_qos_update_request_timeout,
401
402         TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
403
404         TP_ARGS(pm_qos_class, value, timeout_us),
405
406         TP_STRUCT__entry(
407                 __field( int,                    pm_qos_class   )
408                 __field( s32,                    value          )
409                 __field( unsigned long,          timeout_us     )
410         ),
411
412         TP_fast_assign(
413                 __entry->pm_qos_class = pm_qos_class;
414                 __entry->value = value;
415                 __entry->timeout_us = timeout_us;
416         ),
417
418         TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
419                   __print_symbolic(__entry->pm_qos_class,
420                         { PM_QOS_CPU_DMA_LATENCY,       "CPU_DMA_LATENCY" },
421                         { PM_QOS_NETWORK_LATENCY,       "NETWORK_LATENCY" },
422                         { PM_QOS_NETWORK_THROUGHPUT,    "NETWORK_THROUGHPUT" }),
423                   __entry->value, __entry->timeout_us)
424 );
425
426 DECLARE_EVENT_CLASS(pm_qos_update,
427
428         TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
429
430         TP_ARGS(action, prev_value, curr_value),
431
432         TP_STRUCT__entry(
433                 __field( enum pm_qos_req_action, action         )
434                 __field( int,                    prev_value     )
435                 __field( int,                    curr_value     )
436         ),
437
438         TP_fast_assign(
439                 __entry->action = action;
440                 __entry->prev_value = prev_value;
441                 __entry->curr_value = curr_value;
442         ),
443
444         TP_printk("action=%s prev_value=%d curr_value=%d",
445                   __print_symbolic(__entry->action,
446                         { PM_QOS_ADD_REQ,       "ADD_REQ" },
447                         { PM_QOS_UPDATE_REQ,    "UPDATE_REQ" },
448                         { PM_QOS_REMOVE_REQ,    "REMOVE_REQ" }),
449                   __entry->prev_value, __entry->curr_value)
450 );
451
452 DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
453
454         TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
455
456         TP_ARGS(action, prev_value, curr_value)
457 );
458
459 DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
460
461         TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
462
463         TP_ARGS(action, prev_value, curr_value),
464
465         TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
466                   __print_symbolic(__entry->action,
467                         { PM_QOS_ADD_REQ,       "ADD_REQ" },
468                         { PM_QOS_UPDATE_REQ,    "UPDATE_REQ" },
469                         { PM_QOS_REMOVE_REQ,    "REMOVE_REQ" }),
470                   __entry->prev_value, __entry->curr_value)
471 );
472
473 DECLARE_EVENT_CLASS(dev_pm_qos_request,
474
475         TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
476                  s32 new_value),
477
478         TP_ARGS(name, type, new_value),
479
480         TP_STRUCT__entry(
481                 __string( name,                    name         )
482                 __field( enum dev_pm_qos_req_type, type         )
483                 __field( s32,                      new_value    )
484         ),
485
486         TP_fast_assign(
487                 __assign_str(name, name);
488                 __entry->type = type;
489                 __entry->new_value = new_value;
490         ),
491
492         TP_printk("device=%s type=%s new_value=%d",
493                   __get_str(name),
494                   __print_symbolic(__entry->type,
495                         { DEV_PM_QOS_RESUME_LATENCY, "DEV_PM_QOS_RESUME_LATENCY" },
496                         { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }),
497                   __entry->new_value)
498 );
499
500 DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
501
502         TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
503                  s32 new_value),
504
505         TP_ARGS(name, type, new_value)
506 );
507
508 DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
509
510         TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
511                  s32 new_value),
512
513         TP_ARGS(name, type, new_value)
514 );
515
516 DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
517
518         TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
519                  s32 new_value),
520
521         TP_ARGS(name, type, new_value)
522 );
523 #endif /* _TRACE_POWER_H */
524
525 /* This part must be outside protection */
526 #include <trace/define_trace.h>