cam_trace.h 8.5 KB

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