cam_trace.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #if !defined(_CAM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  6. #define _CAM_TRACE_H
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM camera
  9. #undef TRACE_INCLUDE_PATH
  10. #define TRACE_INCLUDE_PATH .
  11. #undef TRACE_INCLUDE_FILE
  12. #define TRACE_INCLUDE_FILE ./cam_trace
  13. #include <linux/tracepoint.h>
  14. #include <media/cam_req_mgr.h>
  15. #include "cam_req_mgr_core.h"
  16. #include "cam_req_mgr_interface.h"
  17. #include "cam_context.h"
  18. #define CAM_DEFAULT_VALUE 0xFF
  19. TRACE_EVENT(cam_context_state,
  20. TP_PROTO(const char *name, struct cam_context *ctx),
  21. TP_ARGS(name, ctx),
  22. TP_STRUCT__entry(
  23. __field(void*, ctx)
  24. __field(uint32_t, state)
  25. __string(name, name)
  26. ),
  27. TP_fast_assign(
  28. __entry->ctx = ctx;
  29. __entry->state = ctx->state;
  30. __assign_str(name, name);
  31. ),
  32. TP_printk(
  33. "%s: State ctx=%p ctx_state=%u",
  34. __get_str(name), __entry->ctx, __entry->state
  35. )
  36. );
  37. TRACE_EVENT(cam_isp_activated_irq,
  38. TP_PROTO(struct cam_context *ctx, unsigned int substate,
  39. unsigned int event, uint64_t timestamp),
  40. TP_ARGS(ctx, substate, event, timestamp),
  41. TP_STRUCT__entry(
  42. __field(void*, ctx)
  43. __field(uint32_t, state)
  44. __field(uint32_t, substate)
  45. __field(uint32_t, event)
  46. __field(uint64_t, ts)
  47. ),
  48. TP_fast_assign(
  49. __entry->ctx = ctx;
  50. __entry->state = ctx->state;
  51. __entry->substate = substate;
  52. __entry->event = event;
  53. __entry->ts = timestamp;
  54. ),
  55. TP_printk(
  56. "ISP: IRQ ctx=%p ctx_state=%u substate=%u event=%u ts=%llu",
  57. __entry->ctx, __entry->state, __entry->substate,
  58. __entry->event, __entry->ts
  59. )
  60. );
  61. TRACE_EVENT(cam_log_event,
  62. TP_PROTO(const char *string1, const char *string2,
  63. uint64_t val1, uint64_t val2),
  64. TP_ARGS(string1, string2, val1, val2),
  65. TP_STRUCT__entry(
  66. __string(string1, string1)
  67. __string(string2, string2)
  68. __field(uint64_t, val1)
  69. __field(uint64_t, val2)
  70. ),
  71. TP_fast_assign(
  72. __assign_str(string1, string1);
  73. __assign_str(string2, string2);
  74. __entry->val1 = val1;
  75. __entry->val2 = val2;
  76. ),
  77. TP_printk(
  78. "%s: %s val1=%llu val2=%llu",
  79. __get_str(string1), __get_str(string2),
  80. __entry->val1, __entry->val2
  81. )
  82. );
  83. TRACE_EVENT(cam_log_debug,
  84. TP_PROTO(const char *string1),
  85. TP_ARGS(string1),
  86. TP_STRUCT__entry(
  87. __string(string1, string1)
  88. ),
  89. TP_fast_assign(
  90. __assign_str(string1, string1);
  91. ),
  92. TP_printk(
  93. "%s",
  94. __get_str(string1)
  95. )
  96. );
  97. TRACE_EVENT(cam_icp_fw_dbg,
  98. TP_PROTO(char *dbg_message, uint64_t timestamp),
  99. TP_ARGS(dbg_message, timestamp),
  100. TP_STRUCT__entry(
  101. __string(dbg_message, dbg_message)
  102. __field(uint64_t, timestamp)
  103. ),
  104. TP_fast_assign(
  105. __assign_str(dbg_message, dbg_message);
  106. __entry->timestamp = timestamp;
  107. ),
  108. TP_printk(
  109. "%llu %s: ",
  110. __entry->timestamp, __get_str(dbg_message)
  111. )
  112. );
  113. TRACE_EVENT(cam_buf_done,
  114. TP_PROTO(const char *ctx_type, struct cam_context *ctx,
  115. struct cam_ctx_request *req),
  116. TP_ARGS(ctx_type, ctx, req),
  117. TP_STRUCT__entry(
  118. __string(ctx_type, ctx_type)
  119. __field(void*, ctx)
  120. __field(uint64_t, request)
  121. ),
  122. TP_fast_assign(
  123. __assign_str(ctx_type, ctx_type);
  124. __entry->ctx = ctx;
  125. __entry->request = req->request_id;
  126. ),
  127. TP_printk(
  128. "%5s: BufDone ctx=%p request=%llu",
  129. __get_str(ctx_type), __entry->ctx, __entry->request
  130. )
  131. );
  132. TRACE_EVENT(cam_apply_req,
  133. TP_PROTO(const char *entity, uint64_t req_id),
  134. TP_ARGS(entity, req_id),
  135. TP_STRUCT__entry(
  136. __string(entity, entity)
  137. __field(uint64_t, req_id)
  138. ),
  139. TP_fast_assign(
  140. __assign_str(entity, entity);
  141. __entry->req_id = req_id;
  142. ),
  143. TP_printk(
  144. "%8s: ApplyRequest request=%llu",
  145. __get_str(entity), __entry->req_id
  146. )
  147. );
  148. TRACE_EVENT(cam_notify_frame_skip,
  149. TP_PROTO(const char *entity, uint64_t req_id),
  150. TP_ARGS(entity, req_id),
  151. TP_STRUCT__entry(
  152. __string(entity, entity)
  153. __field(uint64_t, req_id)
  154. ),
  155. TP_fast_assign(
  156. __assign_str(entity, entity);
  157. __entry->req_id = req_id;
  158. ),
  159. TP_printk(
  160. "%8s: NotifyFrameSkip request=%llu",
  161. __get_str(entity), __entry->req_id
  162. )
  163. );
  164. TRACE_EVENT(cam_flush_req,
  165. TP_PROTO(struct cam_req_mgr_core_link *link,
  166. struct cam_req_mgr_flush_info *info),
  167. TP_ARGS(link, info),
  168. TP_STRUCT__entry(
  169. __field(uint32_t, type)
  170. __field(int64_t, req_id)
  171. __field(void*, link)
  172. __field(void*, session)
  173. ),
  174. TP_fast_assign(
  175. __entry->type = info->flush_type;
  176. __entry->req_id = info->req_id;
  177. __entry->link = link;
  178. __entry->session = link->parent;
  179. ),
  180. TP_printk(
  181. "FlushRequest type=%u request=%llu link=%pK session=%pK",
  182. __entry->type, __entry->req_id, __entry->link,
  183. __entry->session
  184. )
  185. );
  186. TRACE_EVENT(cam_req_mgr_connect_device,
  187. TP_PROTO(struct cam_req_mgr_core_link *link,
  188. struct cam_req_mgr_device_info *info),
  189. TP_ARGS(link, info),
  190. TP_STRUCT__entry(
  191. __string(name, info->name)
  192. __field(uint32_t, id)
  193. __field(uint32_t, delay)
  194. __field(void*, link)
  195. __field(void*, session)
  196. ),
  197. TP_fast_assign(
  198. __assign_str(name, info->name);
  199. __entry->id = info->dev_id;
  200. __entry->delay = info->p_delay;
  201. __entry->link = link;
  202. __entry->session = link->parent;
  203. ),
  204. TP_printk(
  205. "ReqMgr Connect name=%s id=%u pd=%d link=%pK session=%pK",
  206. __get_str(name), __entry->id, __entry->delay,
  207. __entry->link, __entry->session
  208. )
  209. );
  210. TRACE_EVENT(cam_req_mgr_apply_request,
  211. TP_PROTO(struct cam_req_mgr_core_link *link,
  212. struct cam_req_mgr_apply_request *req,
  213. struct cam_req_mgr_connected_device *dev),
  214. TP_ARGS(link, req, dev),
  215. TP_STRUCT__entry(
  216. __string(name, dev->dev_info.name)
  217. __field(uint32_t, dev_id)
  218. __field(uint64_t, req_id)
  219. __field(void*, link)
  220. __field(void*, session)
  221. ),
  222. TP_fast_assign(
  223. __assign_str(name, dev->dev_info.name);
  224. __entry->dev_id = dev->dev_info.dev_id;
  225. __entry->req_id = req->request_id;
  226. __entry->link = link;
  227. __entry->session = link->parent;
  228. ),
  229. TP_printk(
  230. "ReqMgr ApplyRequest devname=%s devid=%u request=%lld link=%pK session=%pK",
  231. __get_str(name), __entry->dev_id, __entry->req_id,
  232. __entry->link, __entry->session
  233. )
  234. );
  235. TRACE_EVENT(cam_req_mgr_add_req,
  236. TP_PROTO(struct cam_req_mgr_core_link *link,
  237. int idx, struct cam_req_mgr_add_request *add_req,
  238. struct cam_req_mgr_req_tbl *tbl,
  239. struct cam_req_mgr_connected_device *dev),
  240. TP_ARGS(link, idx, add_req, tbl, dev),
  241. TP_STRUCT__entry(
  242. __string(name, dev->dev_info.name)
  243. __field(uint32_t, dev_id)
  244. __field(uint64_t, req_id)
  245. __field(uint32_t, slot_id)
  246. __field(uint32_t, delay)
  247. __field(uint32_t, readymap)
  248. __field(uint32_t, devicemap)
  249. __field(void*, link)
  250. __field(void*, session)
  251. ),
  252. TP_fast_assign(
  253. __assign_str(name, dev->dev_info.name);
  254. __entry->dev_id = dev->dev_info.dev_id;
  255. __entry->req_id = add_req->req_id;
  256. __entry->slot_id = idx;
  257. __entry->delay = tbl->pd;
  258. __entry->readymap = tbl->slot[idx].req_ready_map;
  259. __entry->devicemap = tbl->dev_mask;
  260. __entry->link = link;
  261. __entry->session = link->parent;
  262. ),
  263. TP_printk(
  264. "ReqMgr AddRequest devname=%s devid=%d request=%lld slot=%d pd=%d readymap=%x devicemap=%d link=%pK session=%pK",
  265. __get_str(name), __entry->dev_id, __entry->req_id,
  266. __entry->slot_id, __entry->delay, __entry->readymap,
  267. __entry->devicemap, __entry->link, __entry->session
  268. )
  269. );
  270. TRACE_EVENT(cam_delay_detect,
  271. TP_PROTO(const char *entity,
  272. const char *text, uint64_t req_id,
  273. uint32_t ctx_id, int32_t link_hdl,
  274. int32_t session_hdl, int rc),
  275. TP_ARGS(entity, text, req_id, ctx_id,
  276. link_hdl, session_hdl, rc),
  277. TP_STRUCT__entry(
  278. __string(entity, entity)
  279. __string(text, text)
  280. __field(uint64_t, req_id)
  281. __field(uint64_t, ctx_id)
  282. __field(int32_t, link_hdl)
  283. __field(int32_t, session_hdl)
  284. __field(int32_t, rc)
  285. ),
  286. TP_fast_assign(
  287. __assign_str(entity, entity);
  288. __assign_str(text, text);
  289. __entry->req_id = req_id;
  290. __entry->ctx_id = ctx_id;
  291. __entry->link_hdl = link_hdl;
  292. __entry->session_hdl = session_hdl;
  293. __entry->rc = rc;
  294. ),
  295. TP_printk(
  296. "%s: %s request=%lld ctx_id=%d link_hdl=0x%x session_hdl=0x%x rc=%d",
  297. __get_str(entity), __get_str(text), __entry->req_id,
  298. __entry->ctx_id, __entry->link_hdl,
  299. __entry->session_hdl, __entry->rc
  300. )
  301. );
  302. TRACE_EVENT(cam_submit_to_hw,
  303. TP_PROTO(const char *entity, uint64_t req_id),
  304. TP_ARGS(entity, req_id),
  305. TP_STRUCT__entry(
  306. __string(entity, entity)
  307. __field(uint64_t, req_id)
  308. ),
  309. TP_fast_assign(
  310. __assign_str(entity, entity);
  311. __entry->req_id = req_id;
  312. ),
  313. TP_printk(
  314. "%8s: submit request=%llu",
  315. __get_str(entity), __entry->req_id
  316. )
  317. );
  318. TRACE_EVENT(cam_irq_activated,
  319. TP_PROTO(const char *entity, uint32_t irq_type),
  320. TP_ARGS(entity, irq_type),
  321. TP_STRUCT__entry(
  322. __string(entity, entity)
  323. __field(uint32_t, irq_type)
  324. ),
  325. TP_fast_assign(
  326. __assign_str(entity, entity);
  327. __entry->irq_type = irq_type;
  328. ),
  329. TP_printk(
  330. "%8s: got irq type=%d",
  331. __get_str(entity), __entry->irq_type
  332. )
  333. );
  334. TRACE_EVENT(cam_irq_handled,
  335. TP_PROTO(const char *entity, uint32_t irq_type),
  336. TP_ARGS(entity, irq_type),
  337. TP_STRUCT__entry(
  338. __string(entity, entity)
  339. __field(uint32_t, irq_type)
  340. ),
  341. TP_fast_assign(
  342. __assign_str(entity, entity);
  343. __entry->irq_type = irq_type;
  344. ),
  345. TP_printk(
  346. "%8s: handled irq type=%d",
  347. __get_str(entity), __entry->irq_type
  348. )
  349. );
  350. TRACE_EVENT(cam_cdm_cb,
  351. TP_PROTO(const char *entity, uint32_t status),
  352. TP_ARGS(entity, status),
  353. TP_STRUCT__entry(
  354. __string(entity, entity)
  355. __field(uint32_t, status)
  356. ),
  357. TP_fast_assign(
  358. __assign_str(entity, entity);
  359. __entry->status = status;
  360. ),
  361. TP_printk(
  362. "%8s: cdm cb status=%d",
  363. __get_str(entity), __entry->status
  364. )
  365. );
  366. #endif /* _CAM_TRACE_H */
  367. /* This part must be outside protection */
  368. #include <trace/define_trace.h>