cam_trace.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2019, 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_flush_req,
  134. TP_PROTO(struct cam_req_mgr_core_link *link,
  135. struct cam_req_mgr_flush_info *info),
  136. TP_ARGS(link, info),
  137. TP_STRUCT__entry(
  138. __field(uint32_t, type)
  139. __field(int64_t, req_id)
  140. __field(void*, link)
  141. __field(void*, session)
  142. ),
  143. TP_fast_assign(
  144. __entry->type = info->flush_type;
  145. __entry->req_id = info->req_id;
  146. __entry->link = link;
  147. __entry->session = link->parent;
  148. ),
  149. TP_printk(
  150. "FlushRequest type=%u request=%llu link=%pK session=%pK",
  151. __entry->type, __entry->req_id, __entry->link,
  152. __entry->session
  153. )
  154. );
  155. TRACE_EVENT(cam_req_mgr_connect_device,
  156. TP_PROTO(struct cam_req_mgr_core_link *link,
  157. struct cam_req_mgr_device_info *info),
  158. TP_ARGS(link, info),
  159. TP_STRUCT__entry(
  160. __string(name, info->name)
  161. __field(uint32_t, id)
  162. __field(uint32_t, delay)
  163. __field(void*, link)
  164. __field(void*, session)
  165. ),
  166. TP_fast_assign(
  167. __assign_str(name, info->name);
  168. __entry->id = info->dev_id;
  169. __entry->delay = info->p_delay;
  170. __entry->link = link;
  171. __entry->session = link->parent;
  172. ),
  173. TP_printk(
  174. "ReqMgr Connect name=%s id=%u pd=%d link=%pK session=%pK",
  175. __get_str(name), __entry->id, __entry->delay,
  176. __entry->link, __entry->session
  177. )
  178. );
  179. TRACE_EVENT(cam_req_mgr_apply_request,
  180. TP_PROTO(struct cam_req_mgr_core_link *link,
  181. struct cam_req_mgr_apply_request *req,
  182. struct cam_req_mgr_connected_device *dev),
  183. TP_ARGS(link, req, dev),
  184. TP_STRUCT__entry(
  185. __string(name, dev->dev_info.name)
  186. __field(uint32_t, dev_id)
  187. __field(uint64_t, req_id)
  188. __field(void*, link)
  189. __field(void*, session)
  190. ),
  191. TP_fast_assign(
  192. __assign_str(name, dev->dev_info.name);
  193. __entry->dev_id = dev->dev_info.dev_id;
  194. __entry->req_id = req->request_id;
  195. __entry->link = link;
  196. __entry->session = link->parent;
  197. ),
  198. TP_printk(
  199. "ReqMgr ApplyRequest devname=%s devid=%u request=%lld link=%pK session=%pK",
  200. __get_str(name), __entry->dev_id, __entry->req_id,
  201. __entry->link, __entry->session
  202. )
  203. );
  204. TRACE_EVENT(cam_req_mgr_add_req,
  205. TP_PROTO(struct cam_req_mgr_core_link *link,
  206. int idx, struct cam_req_mgr_add_request *add_req,
  207. struct cam_req_mgr_req_tbl *tbl,
  208. struct cam_req_mgr_connected_device *dev),
  209. TP_ARGS(link, idx, add_req, tbl, dev),
  210. TP_STRUCT__entry(
  211. __string(name, dev->dev_info.name)
  212. __field(uint32_t, dev_id)
  213. __field(uint64_t, req_id)
  214. __field(uint32_t, slot_id)
  215. __field(uint32_t, delay)
  216. __field(uint32_t, readymap)
  217. __field(uint32_t, devicemap)
  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 = add_req->req_id;
  225. __entry->slot_id = idx;
  226. __entry->delay = tbl->pd;
  227. __entry->readymap = tbl->slot[idx].req_ready_map;
  228. __entry->devicemap = tbl->dev_mask;
  229. __entry->link = link;
  230. __entry->session = link->parent;
  231. ),
  232. TP_printk(
  233. "ReqMgr AddRequest devname=%s devid=%d request=%lld slot=%d pd=%d readymap=%x devicemap=%d link=%pK session=%pK",
  234. __get_str(name), __entry->dev_id, __entry->req_id,
  235. __entry->slot_id, __entry->delay, __entry->readymap,
  236. __entry->devicemap, __entry->link, __entry->session
  237. )
  238. );
  239. TRACE_EVENT(cam_submit_to_hw,
  240. TP_PROTO(const char *entity, uint64_t req_id),
  241. TP_ARGS(entity, req_id),
  242. TP_STRUCT__entry(
  243. __string(entity, entity)
  244. __field(uint64_t, req_id)
  245. ),
  246. TP_fast_assign(
  247. __assign_str(entity, entity);
  248. __entry->req_id = req_id;
  249. ),
  250. TP_printk(
  251. "%8s: submit request=%llu",
  252. __get_str(entity), __entry->req_id
  253. )
  254. );
  255. TRACE_EVENT(cam_irq_activated,
  256. TP_PROTO(const char *entity, uint32_t irq_type),
  257. TP_ARGS(entity, irq_type),
  258. TP_STRUCT__entry(
  259. __string(entity, entity)
  260. __field(uint32_t, irq_type)
  261. ),
  262. TP_fast_assign(
  263. __assign_str(entity, entity);
  264. __entry->irq_type = irq_type;
  265. ),
  266. TP_printk(
  267. "%8s: got irq type=%d",
  268. __get_str(entity), __entry->irq_type
  269. )
  270. );
  271. TRACE_EVENT(cam_irq_handled,
  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: handled irq type=%d",
  284. __get_str(entity), __entry->irq_type
  285. )
  286. );
  287. TRACE_EVENT(cam_cdm_cb,
  288. TP_PROTO(const char *entity, uint32_t status),
  289. TP_ARGS(entity, status),
  290. TP_STRUCT__entry(
  291. __string(entity, entity)
  292. __field(uint32_t, status)
  293. ),
  294. TP_fast_assign(
  295. __assign_str(entity, entity);
  296. __entry->status = status;
  297. ),
  298. TP_printk(
  299. "%8s: cdm cb status=%d",
  300. __get_str(entity), __entry->status
  301. )
  302. );
  303. #endif /* _CAM_TRACE_H */
  304. /* This part must be outside protection */
  305. #include <trace/define_trace.h>