1/* SPDX-License-Identifier: GPL-2.0 */
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM coda
4
5#if !defined(__CODA_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
6#define __CODA_TRACE_H__
7
8#include <linux/tracepoint.h>
9#include <media/videobuf2-v4l2.h>
10
11#include "coda.h"
12
13TRACE_EVENT(coda_bit_run,
14	TP_PROTO(struct coda_ctx *ctx, int cmd),
15
16	TP_ARGS(ctx, cmd),
17
18	TP_STRUCT__entry(
19		__field(int, minor)
20		__field(int, ctx)
21		__field(int, cmd)
22	),
23
24	TP_fast_assign(
25		__entry->minor = ctx->fh.vdev->minor;
26		__entry->ctx = ctx->idx;
27		__entry->cmd = cmd;
28	),
29
30	TP_printk("minor = %d, ctx = %d, cmd = %d",
31		  __entry->minor, __entry->ctx, __entry->cmd)
32);
33
34TRACE_EVENT(coda_bit_done,
35	TP_PROTO(struct coda_ctx *ctx),
36
37	TP_ARGS(ctx),
38
39	TP_STRUCT__entry(
40		__field(int, minor)
41		__field(int, ctx)
42	),
43
44	TP_fast_assign(
45		__entry->minor = ctx->fh.vdev->minor;
46		__entry->ctx = ctx->idx;
47	),
48
49	TP_printk("minor = %d, ctx = %d", __entry->minor, __entry->ctx)
50);
51
52DECLARE_EVENT_CLASS(coda_buf_class,
53	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
54
55	TP_ARGS(ctx, buf),
56
57	TP_STRUCT__entry(
58		__field(int, minor)
59		__field(int, index)
60		__field(int, ctx)
61	),
62
63	TP_fast_assign(
64		__entry->minor = ctx->fh.vdev->minor;
65		__entry->index = buf->vb2_buf.index;
66		__entry->ctx = ctx->idx;
67	),
68
69	TP_printk("minor = %d, index = %d, ctx = %d",
70		  __entry->minor, __entry->index, __entry->ctx)
71);
72
73DEFINE_EVENT(coda_buf_class, coda_enc_pic_run,
74	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
75	TP_ARGS(ctx, buf)
76);
77
78DEFINE_EVENT(coda_buf_class, coda_enc_pic_done,
79	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
80	TP_ARGS(ctx, buf)
81);
82
83DECLARE_EVENT_CLASS(coda_buf_meta_class,
84	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
85		 struct coda_buffer_meta *meta),
86
87	TP_ARGS(ctx, buf, meta),
88
89	TP_STRUCT__entry(
90		__field(int, minor)
91		__field(int, index)
92		__field(int, start)
93		__field(int, end)
94		__field(int, ctx)
95	),
96
97	TP_fast_assign(
98		__entry->minor = ctx->fh.vdev->minor;
99		__entry->index = buf->vb2_buf.index;
100		__entry->start = meta->start & ctx->bitstream_fifo.kfifo.mask;
101		__entry->end = meta->end & ctx->bitstream_fifo.kfifo.mask;
102		__entry->ctx = ctx->idx;
103	),
104
105	TP_printk("minor = %d, index = %d, start = 0x%x, end = 0x%x, ctx = %d",
106		  __entry->minor, __entry->index, __entry->start, __entry->end,
107		  __entry->ctx)
108);
109
110DEFINE_EVENT(coda_buf_meta_class, coda_bit_queue,
111	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
112		 struct coda_buffer_meta *meta),
113	TP_ARGS(ctx, buf, meta)
114);
115
116DECLARE_EVENT_CLASS(coda_meta_class,
117	TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta),
118
119	TP_ARGS(ctx, meta),
120
121	TP_STRUCT__entry(
122		__field(int, minor)
123		__field(int, start)
124		__field(int, end)
125		__field(int, ctx)
126	),
127
128	TP_fast_assign(
129		__entry->minor = ctx->fh.vdev->minor;
130		__entry->start = meta ? (meta->start &
131					 ctx->bitstream_fifo.kfifo.mask) : 0;
132		__entry->end = meta ? (meta->end &
133				       ctx->bitstream_fifo.kfifo.mask) : 0;
134		__entry->ctx = ctx->idx;
135	),
136
137	TP_printk("minor = %d, start = 0x%x, end = 0x%x, ctx = %d",
138		  __entry->minor, __entry->start, __entry->end, __entry->ctx)
139);
140
141DEFINE_EVENT(coda_meta_class, coda_dec_pic_run,
142	TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta),
143	TP_ARGS(ctx, meta)
144);
145
146DEFINE_EVENT(coda_meta_class, coda_dec_pic_done,
147	TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta),
148	TP_ARGS(ctx, meta)
149);
150
151DEFINE_EVENT(coda_buf_meta_class, coda_dec_rot_done,
152	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
153		 struct coda_buffer_meta *meta),
154	TP_ARGS(ctx, buf, meta)
155);
156
157DEFINE_EVENT(coda_buf_class, coda_jpeg_run,
158	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
159	TP_ARGS(ctx, buf)
160);
161
162DEFINE_EVENT(coda_buf_class, coda_jpeg_done,
163	TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
164	TP_ARGS(ctx, buf)
165);
166
167#endif /* __CODA_TRACE_H__ */
168
169#undef TRACE_INCLUDE_PATH
170#define TRACE_INCLUDE_PATH ../../drivers/media/platform/chips-media/coda
171#undef TRACE_INCLUDE_FILE
172#define TRACE_INCLUDE_FILE trace
173
174/* This part must be outside protection */
175#include <trace/define_trace.h>
176