Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / trace / events / pwm.h
blob8ba898fd335c465cad83b394d9b60f92899a0222
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM pwm
5 #if !defined(_TRACE_PWM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_PWM_H
8 #include <linux/pwm.h>
9 #include <linux/tracepoint.h>
11 #define TP_PROTO_pwm(args...) \
12 TP_PROTO(struct pwm_device *pwm, args)
14 #define TP_ARGS_pwm(args...) \
15 TP_ARGS(pwm, args)
17 #define TP_STRUCT__entry_pwm(args...) \
18 TP_STRUCT__entry( \
19 __field(unsigned int, chipid) \
20 __field(unsigned int, hwpwm) \
21 args)
23 #define TP_fast_assign_pwm(args...) \
24 TP_fast_assign( \
25 __entry->chipid = pwm->chip->id; \
26 __entry->hwpwm = pwm->hwpwm; \
27 args)
29 #define TP_printk_pwm(fmt, args...) \
30 TP_printk("pwmchip%u.%u: " fmt, __entry->chipid, __entry->hwpwm, args)
32 #define __field_pwmwf(wf) \
33 __field(u64, wf ## _period_length_ns) \
34 __field(u64, wf ## _duty_length_ns) \
35 __field(u64, wf ## _duty_offset_ns) \
37 #define fast_assign_pwmwf(wf) \
38 __entry->wf ## _period_length_ns = wf->period_length_ns; \
39 __entry->wf ## _duty_length_ns = wf->duty_length_ns; \
40 __entry->wf ## _duty_offset_ns = wf->duty_offset_ns
42 #define printk_pwmwf_format(wf) \
43 "%lld/%lld [+%lld]"
45 #define printk_pwmwf_formatargs(wf) \
46 __entry->wf ## _duty_length_ns, __entry->wf ## _period_length_ns, __entry->wf ## _duty_offset_ns
48 TRACE_EVENT(pwm_round_waveform_tohw,
50 TP_PROTO_pwm(const struct pwm_waveform *wf, void *wfhw, int err),
52 TP_ARGS_pwm(wf, wfhw, err),
54 TP_STRUCT__entry_pwm(
55 __field_pwmwf(wf)
56 __field(void *, wfhw)
57 __field(int, err)
60 TP_fast_assign_pwm(
61 fast_assign_pwmwf(wf);
62 __entry->wfhw = wfhw;
63 __entry->err = err;
66 TP_printk_pwm(printk_pwmwf_format(wf) " > %p err=%d",
67 printk_pwmwf_formatargs(wf), __entry->wfhw, __entry->err)
70 TRACE_EVENT(pwm_round_waveform_fromhw,
72 TP_PROTO_pwm(const void *wfhw, struct pwm_waveform *wf, int err),
74 TP_ARGS_pwm(wfhw, wf, err),
76 TP_STRUCT__entry_pwm(
77 __field(const void *, wfhw)
78 __field_pwmwf(wf)
79 __field(int, err)
82 TP_fast_assign_pwm(
83 __entry->wfhw = wfhw;
84 fast_assign_pwmwf(wf);
85 __entry->err = err;
88 TP_printk_pwm("%p > " printk_pwmwf_format(wf) " err=%d",
89 __entry->wfhw, printk_pwmwf_formatargs(wf), __entry->err)
92 TRACE_EVENT(pwm_read_waveform,
94 TP_PROTO_pwm(void *wfhw, int err),
96 TP_ARGS_pwm(wfhw, err),
98 TP_STRUCT__entry_pwm(
99 __field(void *, wfhw)
100 __field(int, err)
103 TP_fast_assign_pwm(
104 __entry->wfhw = wfhw;
105 __entry->err = err;
108 TP_printk_pwm("%p err=%d",
109 __entry->wfhw, __entry->err)
112 TRACE_EVENT(pwm_write_waveform,
114 TP_PROTO_pwm(const void *wfhw, int err),
116 TP_ARGS_pwm(wfhw, err),
118 TP_STRUCT__entry_pwm(
119 __field(const void *, wfhw)
120 __field(int, err)
123 TP_fast_assign_pwm(
124 __entry->wfhw = wfhw;
125 __entry->err = err;
128 TP_printk_pwm("%p err=%d",
129 __entry->wfhw, __entry->err)
133 DECLARE_EVENT_CLASS(pwm,
135 TP_PROTO(struct pwm_device *pwm, const struct pwm_state *state, int err),
137 TP_ARGS(pwm, state, err),
139 TP_STRUCT__entry_pwm(
140 __field(u64, period)
141 __field(u64, duty_cycle)
142 __field(enum pwm_polarity, polarity)
143 __field(bool, enabled)
144 __field(int, err)
147 TP_fast_assign_pwm(
148 __entry->period = state->period;
149 __entry->duty_cycle = state->duty_cycle;
150 __entry->polarity = state->polarity;
151 __entry->enabled = state->enabled;
152 __entry->err = err;
155 TP_printk_pwm("period=%llu duty_cycle=%llu polarity=%d enabled=%d err=%d",
156 __entry->period, __entry->duty_cycle,
157 __entry->polarity, __entry->enabled, __entry->err)
161 DEFINE_EVENT(pwm, pwm_apply,
163 TP_PROTO(struct pwm_device *pwm, const struct pwm_state *state, int err),
165 TP_ARGS(pwm, state, err)
168 DEFINE_EVENT(pwm, pwm_get,
170 TP_PROTO(struct pwm_device *pwm, const struct pwm_state *state, int err),
172 TP_ARGS(pwm, state, err)
175 #endif /* _TRACE_PWM_H */
177 /* This part must be outside protection */
178 #include <trace/define_trace.h>