1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM regmap 4 5 #if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_REGMAP_H 7 8 #include <linux/ktime.h> 9 #include <linux/tracepoint.h> 10 11 #include "internal.h" 12 13 /* 14 * Log register events 15 */ 16 DECLARE_EVENT_CLASS(regmap_reg, 17 18 TP_PROTO(struct regmap *map, unsigned int reg, 19 unsigned int val), 20 21 TP_ARGS(map, reg, val), 22 23 TP_STRUCT__entry( 24 __string( name, regmap_name(map) ) 25 __field( unsigned int, reg ) 26 __field( unsigned int, val ) 27 ), 28 29 TP_fast_assign( 30 __assign_str(name, regmap_name(map)); 31 __entry->reg = reg; 32 __entry->val = val; 33 ), 34 35 TP_printk("%s reg=%x val=%x", __get_str(name), __entry->reg, __entry->val) 36 ); 37 38 DEFINE_EVENT(regmap_reg, regmap_reg_write, 39 40 TP_PROTO(struct regmap *map, unsigned int reg, 41 unsigned int val), 42 43 TP_ARGS(map, reg, val) 44 ); 45 46 DEFINE_EVENT(regmap_reg, regmap_reg_read, 47 48 TP_PROTO(struct regmap *map, unsigned int reg, 49 unsigned int val), 50 51 TP_ARGS(map, reg, val) 52 ); 53 54 DEFINE_EVENT(regmap_reg, regmap_reg_read_cache, 55 56 TP_PROTO(struct regmap *map, unsigned int reg, 57 unsigned int val), 58 59 TP_ARGS(map, reg, val) 60 ); 61 62 DECLARE_EVENT_CLASS(regmap_bulk, 63 64 TP_PROTO(struct regmap *map, unsigned int reg, 65 const void *val, int val_len), 66 67 TP_ARGS(map, reg, val, val_len), 68 69 TP_STRUCT__entry( 70 __string(name, regmap_name(map)) 71 __field(unsigned int, reg) 72 __dynamic_array(char, buf, val_len) 73 __field(int, val_len) 74 ), 75 76 TP_fast_assign( 77 __assign_str(name, regmap_name(map)); 78 __entry->reg = reg; 79 __entry->val_len = val_len; 80 memcpy(__get_dynamic_array(buf), val, val_len); 81 ), 82 83 TP_printk("%s reg=%x val=%s", __get_str(name), __entry->reg, 84 __print_hex(__get_dynamic_array(buf), __entry->val_len)) 85 ); 86 87 DEFINE_EVENT(regmap_bulk, regmap_bulk_write, 88 89 TP_PROTO(struct regmap *map, unsigned int reg, 90 const void *val, int val_len), 91 92 TP_ARGS(map, reg, val, val_len) 93 ); 94 95 DEFINE_EVENT(regmap_bulk, regmap_bulk_read, 96 97 TP_PROTO(struct regmap *map, unsigned int reg, 98 const void *val, int val_len), 99 100 TP_ARGS(map, reg, val, val_len) 101 ); 102 103 DECLARE_EVENT_CLASS(regmap_block, 104 105 TP_PROTO(struct regmap *map, unsigned int reg, int count), 106 107 TP_ARGS(map, reg, count), 108 109 TP_STRUCT__entry( 110 __string( name, regmap_name(map) ) 111 __field( unsigned int, reg ) 112 __field( int, count ) 113 ), 114 115 TP_fast_assign( 116 __assign_str(name, regmap_name(map)); 117 __entry->reg = reg; 118 __entry->count = count; 119 ), 120 121 TP_printk("%s reg=%x count=%d", __get_str(name), __entry->reg, __entry->count) 122 ); 123 124 DEFINE_EVENT(regmap_block, regmap_hw_read_start, 125 126 TP_PROTO(struct regmap *map, unsigned int reg, int count), 127 128 TP_ARGS(map, reg, count) 129 ); 130 131 DEFINE_EVENT(regmap_block, regmap_hw_read_done, 132 133 TP_PROTO(struct regmap *map, unsigned int reg, int count), 134 135 TP_ARGS(map, reg, count) 136 ); 137 138 DEFINE_EVENT(regmap_block, regmap_hw_write_start, 139 140 TP_PROTO(struct regmap *map, unsigned int reg, int count), 141 142 TP_ARGS(map, reg, count) 143 ); 144 145 DEFINE_EVENT(regmap_block, regmap_hw_write_done, 146 147 TP_PROTO(struct regmap *map, unsigned int reg, int count), 148 149 TP_ARGS(map, reg, count) 150 ); 151 152 TRACE_EVENT(regcache_sync, 153 154 TP_PROTO(struct regmap *map, const char *type, 155 const char *status), 156 157 TP_ARGS(map, type, status), 158 159 TP_STRUCT__entry( 160 __string( name, regmap_name(map) ) 161 __string( status, status ) 162 __string( type, type ) 163 ), 164 165 TP_fast_assign( 166 __assign_str(name, regmap_name(map)); 167 __assign_str(status, status); 168 __assign_str(type, type); 169 ), 170 171 TP_printk("%s type=%s status=%s", __get_str(name), 172 __get_str(type), __get_str(status)) 173 ); 174 175 DECLARE_EVENT_CLASS(regmap_bool, 176 177 TP_PROTO(struct regmap *map, bool flag), 178 179 TP_ARGS(map, flag), 180 181 TP_STRUCT__entry( 182 __string( name, regmap_name(map) ) 183 __field( int, flag ) 184 ), 185 186 TP_fast_assign( 187 __assign_str(name, regmap_name(map)); 188 __entry->flag = flag; 189 ), 190 191 TP_printk("%s flag=%d", __get_str(name), __entry->flag) 192 ); 193 194 DEFINE_EVENT(regmap_bool, regmap_cache_only, 195 196 TP_PROTO(struct regmap *map, bool flag), 197 198 TP_ARGS(map, flag) 199 ); 200 201 DEFINE_EVENT(regmap_bool, regmap_cache_bypass, 202 203 TP_PROTO(struct regmap *map, bool flag), 204 205 TP_ARGS(map, flag) 206 ); 207 208 DECLARE_EVENT_CLASS(regmap_async, 209 210 TP_PROTO(struct regmap *map), 211 212 TP_ARGS(map), 213 214 TP_STRUCT__entry( 215 __string( name, regmap_name(map) ) 216 ), 217 218 TP_fast_assign( 219 __assign_str(name, regmap_name(map)); 220 ), 221 222 TP_printk("%s", __get_str(name)) 223 ); 224 225 DEFINE_EVENT(regmap_block, regmap_async_write_start, 226 227 TP_PROTO(struct regmap *map, unsigned int reg, int count), 228 229 TP_ARGS(map, reg, count) 230 ); 231 232 DEFINE_EVENT(regmap_async, regmap_async_io_complete, 233 234 TP_PROTO(struct regmap *map), 235 236 TP_ARGS(map) 237 ); 238 239 DEFINE_EVENT(regmap_async, regmap_async_complete_start, 240 241 TP_PROTO(struct regmap *map), 242 243 TP_ARGS(map) 244 ); 245 246 DEFINE_EVENT(regmap_async, regmap_async_complete_done, 247 248 TP_PROTO(struct regmap *map), 249 250 TP_ARGS(map) 251 ); 252 253 TRACE_EVENT(regcache_drop_region, 254 255 TP_PROTO(struct regmap *map, unsigned int from, 256 unsigned int to), 257 258 TP_ARGS(map, from, to), 259 260 TP_STRUCT__entry( 261 __string( name, regmap_name(map) ) 262 __field( unsigned int, from ) 263 __field( unsigned int, to ) 264 ), 265 266 TP_fast_assign( 267 __assign_str(name, regmap_name(map)); 268 __entry->from = from; 269 __entry->to = to; 270 ), 271 272 TP_printk("%s %u-%u", __get_str(name), __entry->from, __entry->to) 273 ); 274 275 #endif /* _TRACE_REGMAP_H */ 276 277 #undef TRACE_INCLUDE_PATH 278 #define TRACE_INCLUDE_PATH . 279 280 #undef TRACE_INCLUDE_FILE 281 #define TRACE_INCLUDE_FILE trace 282 283 /* This part must be outside protection */ 284 #include <trace/define_trace.h> 285