1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Trace events for the ChromeOS Sensorhub kernel module
5 * Copyright 2021 Google LLC.
9 #define TRACE_SYSTEM cros_ec
11 #if !defined(_CROS_EC_SENSORHUB_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
12 #define _CROS_EC_SENSORHUB_TRACE_H_
14 #include <linux/types.h>
15 #include <linux/platform_data/cros_ec_sensorhub.h>
17 #include <linux/tracepoint.h>
19 TRACE_EVENT(cros_ec_sensorhub_timestamp,
20 TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp,
21 s64 current_timestamp, s64 current_time),
22 TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp,
25 __field(u32, ec_sample_timestamp)
26 __field(u32, ec_fifo_timestamp)
27 __field(s64, fifo_timestamp)
28 __field(s64, current_timestamp)
29 __field(s64, current_time)
33 __entry->ec_sample_timestamp = ec_sample_timestamp;
34 __entry->ec_fifo_timestamp = ec_fifo_timestamp;
35 __entry->fifo_timestamp = fifo_timestamp;
36 __entry->current_timestamp = current_timestamp;
37 __entry->current_time = current_time;
38 __entry->delta = current_timestamp - current_time;
40 TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
41 __entry->ec_sample_timestamp,
42 __entry->ec_fifo_timestamp,
43 __entry->fifo_timestamp,
44 __entry->current_timestamp,
45 __entry->current_time,
50 TRACE_EVENT(cros_ec_sensorhub_data,
51 TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp,
52 s64 current_timestamp, s64 current_time),
53 TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time),
55 __field(u32, ec_sensor_num)
56 __field(u32, ec_fifo_timestamp)
57 __field(s64, fifo_timestamp)
58 __field(s64, current_timestamp)
59 __field(s64, current_time)
63 __entry->ec_sensor_num = ec_sensor_num;
64 __entry->ec_fifo_timestamp = ec_fifo_timestamp;
65 __entry->fifo_timestamp = fifo_timestamp;
66 __entry->current_timestamp = current_timestamp;
67 __entry->current_time = current_time;
68 __entry->delta = current_timestamp - current_time;
70 TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
71 __entry->ec_sensor_num,
72 __entry->ec_fifo_timestamp,
73 __entry->fifo_timestamp,
74 __entry->current_timestamp,
75 __entry->current_time,
80 TRACE_EVENT(cros_ec_sensorhub_filter,
81 TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy),
82 TP_ARGS(state, dx, dy),
86 __field(s64, median_m)
87 __field(s64, median_error)
88 __field(s64, history_len)
95 __entry->median_m = state->median_m;
96 __entry->median_error = state->median_error;
97 __entry->history_len = state->history_len;
98 __entry->x = state->x_offset;
99 __entry->y = state->y_offset;
101 TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld",
105 __entry->median_error,
106 __entry->history_len,
113 #endif /* _CROS_EC_SENSORHUB_TRACE_H_ */
115 /* this part must be outside header guard */
117 #undef TRACE_INCLUDE_PATH
118 #define TRACE_INCLUDE_PATH .
120 #undef TRACE_INCLUDE_FILE
121 #define TRACE_INCLUDE_FILE cros_ec_sensorhub_trace
123 #include <trace/define_trace.h>