cam_trace.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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_icp_fw_dbg,
  83. TP_PROTO(char *dbg_message, uint64_t timestamp),
  84. TP_ARGS(dbg_message, timestamp),
  85. TP_STRUCT__entry(
  86. __string(dbg_message, dbg_message)
  87. __field(uint64_t, timestamp)
  88. ),
  89. TP_fast_assign(
  90. __assign_str(dbg_message, dbg_message);
  91. __entry->timestamp = timestamp;
  92. ),
  93. TP_printk(
  94. "%llu %s: ",
  95. __entry->timestamp, __get_str(dbg_message)
  96. )
  97. );
  98. TRACE_EVENT(cam_buf_done,
  99. TP_PROTO(const char *ctx_type, struct cam_context *ctx,
  100. struct cam_ctx_request *req),
  101. TP_ARGS(ctx_type, ctx, req),
  102. TP_STRUCT__entry(
  103. __string(ctx_type, ctx_type)
  104. __field(void*, ctx)
  105. __field(uint64_t, request)
  106. ),
  107. TP_fast_assign(
  108. __assign_str(ctx_type, ctx_type);
  109. __entry->ctx = ctx;
  110. __entry->request = req->request_id;
  111. ),
  112. TP_printk(
  113. "%5s: BufDone ctx=%p request=%llu",
  114. __get_str(ctx_type), __entry->ctx, __entry->request
  115. )
  116. );
  117. TRACE_EVENT(cam_apply_req,
  118. TP_PROTO(const char *entity, uint64_t req_id),
  119. TP_ARGS(entity, req_id),
  120. TP_STRUCT__entry(
  121. __string(entity, entity)
  122. __field(uint64_t, req_id)
  123. ),
  124. TP_fast_assign(
  125. __assign_str(entity, entity);
  126. __entry->req_id = req_id;
  127. ),
  128. TP_printk(
  129. "%8s: ApplyRequest request=%llu",
  130. __get_str(entity), __entry->req_id
  131. )
  132. );
  133. TRACE_EVENT(cam_notify_frame_skip,
  134. TP_PROTO(const char *entity, uint64_t req_id),
  135. TP_ARGS(entity, req_id),
  136. TP_STRUCT__entry(
  137. __string(entity, entity)
  138. __field(uint64_t, req_id)
  139. ),
  140. TP_fast_assign(
  141. __assign_str(entity, entity);
  142. __entry->req_id = req_id;
  143. ),
  144. TP_printk(
  145. "%8s: NotifyFrameSkip request=%llu",
  146. __get_str(entity), __entry->req_id
  147. )
  148. );
  149. TRACE_EVENT(cam_flush_req,
  150. TP_PROTO(struct cam_req_mgr_core_link *link,
  151. struct cam_req_mgr_flush_info *info),
  152. TP_ARGS(link, info),
  153. TP_STRUCT__entry(
  154. __field(uint32_t, type)
  155. __field(int64_t, req_id)
  156. __field(void*, link)
  157. __field(void*, session)
  158. ),
  159. TP_fast_assign(
  160. __entry->type = info->flush_type;
  161. __entry->req_id = info->req_id;
  162. __entry->link = link;
  163. __entry->session = link->parent;
  164. ),
  165. TP_printk(
  166. "FlushRequest type=%u request=%llu link=%pK session=%pK",
  167. __entry->type, __entry->req_id, __entry->link,
  168. __entry->session
  169. )
  170. );
  171. TRACE_EVENT(cam_req_mgr_connect_device,
  172. TP_PROTO(struct cam_req_mgr_core_link *link,
  173. struct cam_req_mgr_device_info *info),
  174. TP_ARGS(link, info),
  175. TP_STRUCT__entry(
  176. __string(name, info->name)
  177. __field(uint32_t, id)
  178. __field(uint32_t, delay)
  179. __field(void*, link)
  180. __field(void*, session)
  181. ),
  182. TP_fast_assign(
  183. __assign_str(name, info->name);
  184. __entry->id = info->dev_id;
  185. __entry->delay = info->p_delay;
  186. __entry->link = link;
  187. __entry->session = link->parent;
  188. ),
  189. TP_printk(
  190. "ReqMgr Connect name=%s id=%u pd=%d link=%pK session=%pK",
  191. __get_str(name), __entry->id, __entry->delay,
  192. __entry->link, __entry->session
  193. )
  194. );
  195. TRACE_EVENT(cam_req_mgr_apply_request,
  196. TP_PROTO(struct cam_req_mgr_core_link *link,
  197. struct cam_req_mgr_apply_request *req,
  198. struct cam_req_mgr_connected_device *dev),
  199. TP_ARGS(link, req, dev),
  200. TP_STRUCT__entry(
  201. __string(name, dev->dev_info.name)
  202. __field(uint32_t, dev_id)
  203. __field(uint64_t, req_id)
  204. __field(void*, link)
  205. __field(void*, session)
  206. ),
  207. TP_fast_assign(
  208. __assign_str(name, dev->dev_info.name);
  209. __entry->dev_id = dev->dev_info.dev_id;
  210. __entry->req_id = req->request_id;
  211. __entry->link = link;
  212. __entry->session = link->parent;
  213. ),
  214. TP_printk(
  215. "ReqMgr ApplyRequest devname=%s devid=%u request=%lld link=%pK session=%pK",
  216. __get_str(name), __entry->dev_id, __entry->req_id,
  217. __entry->link, __entry->session
  218. )
  219. );
  220. TRACE_EVENT(cam_req_mgr_add_req,
  221. TP_PROTO(struct cam_req_mgr_core_link *link,
  222. int idx, struct cam_req_mgr_add_request *add_req,
  223. struct cam_req_mgr_req_tbl *tbl,
  224. struct cam_req_mgr_connected_device *dev),
  225. TP_ARGS(link, idx, add_req, tbl, dev),
  226. TP_STRUCT__entry(
  227. __string(name, dev->dev_info.name)
  228. __field(uint32_t, dev_id)
  229. __field(uint64_t, req_id)
  230. __field(uint32_t, slot_id)
  231. __field(uint32_t, delay)
  232. __field(uint32_t, readymap)
  233. __field(uint32_t, devicemap)
  234. __field(void*, link)
  235. __field(void*, session)
  236. ),
  237. TP_fast_assign(
  238. __assign_str(name, dev->dev_info.name);
  239. __entry->dev_id = dev->dev_info.dev_id;
  240. __entry->req_id = add_req->req_id;
  241. __entry->slot_id = idx;
  242. __entry->delay = tbl->pd;
  243. __entry->readymap = tbl->slot[idx].req_ready_map;
  244. __entry->devicemap = tbl->dev_mask;
  245. __entry->link = link;
  246. __entry->session = link->parent;
  247. ),
  248. TP_printk(
  249. "ReqMgr AddRequest devname=%s devid=%d request=%lld slot=%d pd=%d readymap=%x devicemap=%d link=%pK session=%pK",
  250. __get_str(name), __entry->dev_id, __entry->req_id,
  251. __entry->slot_id, __entry->delay, __entry->readymap,
  252. __entry->devicemap, __entry->link, __entry->session
  253. )
  254. );
  255. TRACE_EVENT(cam_submit_to_hw,
  256. TP_PROTO(const char *entity, uint64_t req_id),
  257. TP_ARGS(entity, req_id),
  258. TP_STRUCT__entry(
  259. __string(entity, entity)
  260. __field(uint64_t, req_id)
  261. ),
  262. TP_fast_assign(
  263. __assign_str(entity, entity);
  264. __entry->req_id = req_id;
  265. ),
  266. TP_printk(
  267. "%8s: submit request=%llu",
  268. __get_str(entity), __entry->req_id
  269. )
  270. );
  271. TRACE_EVENT(cam_irq_activated,
  272. TP_PROTO(const char *entity, uint32_t irq_type),
  273. TP_ARGS(entity, irq_type),
  274. TP_STRUCT__entry(
  275. __string(entity, entity)
  276. __field(uint32_t, irq_type)
  277. ),
  278. TP_fast_assign(
  279. __assign_str(entity, entity);
  280. __entry->irq_type = irq_type;
  281. ),
  282. TP_printk(
  283. "%8s: got irq type=%d",
  284. __get_str(entity), __entry->irq_type
  285. )
  286. );
  287. TRACE_EVENT(cam_irq_handled,
  288. TP_PROTO(const char *entity, uint32_t irq_type),
  289. TP_ARGS(entity, irq_type),
  290. TP_STRUCT__entry(
  291. __string(entity, entity)
  292. __field(uint32_t, irq_type)
  293. ),
  294. TP_fast_assign(
  295. __assign_str(entity, entity);
  296. __entry->irq_type = irq_type;
  297. ),
  298. TP_printk(
  299. "%8s: handled irq type=%d",
  300. __get_str(entity), __entry->irq_type
  301. )
  302. );
  303. TRACE_EVENT(cam_cdm_cb,
  304. TP_PROTO(const char *entity, uint32_t status),
  305. TP_ARGS(entity, status),
  306. TP_STRUCT__entry(
  307. __string(entity, entity)
  308. __field(uint32_t, status)
  309. ),
  310. TP_fast_assign(
  311. __assign_str(entity, entity);
  312. __entry->status = status;
  313. ),
  314. TP_printk(
  315. "%8s: cdm cb status=%d",
  316. __get_str(entity), __entry->status
  317. )
  318. );
  319. #endif /* _CAM_TRACE_H */
  320. /* This part must be outside protection */
  321. #include <trace/define_trace.h>