cam_trace.h 9.9 KB

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