msm_vidc_debug.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __MSM_VIDC_DEBUG__
  6. #define __MSM_VIDC_DEBUG__
  7. #include <linux/debugfs.h>
  8. #include <linux/delay.h>
  9. #include <linux/types.h>
  10. #include <linux/time.h>
  11. #ifndef VIDC_DBG_LABEL
  12. #define VIDC_DBG_LABEL "msm_vidc"
  13. #endif
  14. #define VIDC_DBG_TAG VIDC_DBG_LABEL ": %6s: %08x: %5s: "
  15. #define FW_DBG_TAG VIDC_DBG_LABEL ": %6s: "
  16. #define DEFAULT_SID ((u32)-1)
  17. extern int msm_vidc_debug;
  18. extern bool msm_vidc_lossless_encode;
  19. extern bool msm_vidc_syscache_disable;
  20. extern int msm_vidc_clock_voting;
  21. /* To enable messages OR these values and
  22. * echo the result to debugfs file.
  23. *
  24. * To enable all messages set debug_level = 0x101F
  25. */
  26. enum vidc_msg_prio {
  27. VIDC_ERR = 0x00000001,
  28. VIDC_HIGH = 0x00000002,
  29. VIDC_LOW = 0x00000004,
  30. VIDC_PERF = 0x00000008,
  31. VIDC_PKT = 0x00000010,
  32. VIDC_BUS = 0x00000020,
  33. VIDC_ENCODER = 0x00000100,
  34. VIDC_DECODER = 0x00000200,
  35. VIDC_PRINTK = 0x00001000,
  36. VIDC_FTRACE = 0x00002000,
  37. FW_LOW = 0x00010000,
  38. FW_MED = 0x00020000,
  39. FW_HIGH = 0x00040000,
  40. FW_ERROR = 0x00080000,
  41. FW_FATAL = 0x00100000,
  42. FW_PERF = 0x00200000,
  43. FW_PRINTK = 0x10000000,
  44. FW_FTRACE = 0x20000000,
  45. };
  46. #define FW_LOGSHIFT 16
  47. #define FW_LOGMASK 0x0FFF0000
  48. #define dprintk(__level, sid, __fmt, ...) \
  49. do { \
  50. if (msm_vidc_debug & __level) { \
  51. pr_err(VIDC_DBG_TAG __fmt, \
  52. level_str(__level), \
  53. sid, \
  54. "codec", \
  55. ##__VA_ARGS__); \
  56. } \
  57. } while (0)
  58. #define s_vpr_e(sid, __fmt, ...) dprintk(VIDC_ERR, sid, __fmt, ##__VA_ARGS__)
  59. #define s_vpr_i(sid, __fmt, ...) dprintk(VIDC_INFO, sid, __fmt, ##__VA_ARGS__)
  60. #define s_vpr_h(sid, __fmt, ...) dprintk(VIDC_HIGH, sid, __fmt, ##__VA_ARGS__)
  61. #define s_vpr_l(sid, __fmt, ...) dprintk(VIDC_LOW, sid, __fmt, ##__VA_ARGS__)
  62. #define s_vpr_p(sid, __fmt, ...) dprintk(VIDC_PERF, sid, __fmt, ##__VA_ARGS__)
  63. #define s_vpr_t(sid, __fmt, ...) dprintk(VIDC_PKT, sid, __fmt, ##__VA_ARGS__)
  64. #define s_vpr_b(sid, __fmt, ...) dprintk(VIDC_BUS, sid, __fmt, ##__VA_ARGS__)
  65. #define s_vpr_hp(sid, __fmt, ...) \
  66. dprintk(VIDC_HIGH|VIDC_PERF, sid, __fmt, ##__VA_ARGS__)
  67. #define d_vpr_e(__fmt, ...) \
  68. dprintk(VIDC_ERR, DEFAULT_SID, __fmt, ##__VA_ARGS__)
  69. #define d_vpr_i(__fmt, ...) \
  70. dprintk(VIDC_INFO, DEFAULT_SID, __fmt, ##__VA_ARGS__)
  71. #define d_vpr_h(__fmt, ...) \
  72. dprintk(VIDC_HIGH, DEFAULT_SID, __fmt, ##__VA_ARGS__)
  73. #define d_vpr_l(__fmt, ...) \
  74. dprintk(VIDC_LOW, DEFAULT_SID, __fmt, ##__VA_ARGS__)
  75. #define d_vpr_p(__fmt, ...) \
  76. dprintk(VIDC_PERF, DEFAULT_SID, __fmt, ##__VA_ARGS__)
  77. #define d_vpr_t(__fmt, ...) \
  78. dprintk(VIDC_PKT, DEFAULT_SID, __fmt, ##__VA_ARGS__)
  79. #define d_vpr_b(__fmt, ...) \
  80. dprintk(VIDC_BUS, DEFAULT_SID, __fmt, ##__VA_ARGS__)
  81. #define dprintk_firmware(__level, __fmt, ...) \
  82. do { \
  83. pr_err(FW_DBG_TAG __fmt, \
  84. "fw", \
  85. ##__VA_ARGS__); \
  86. } while (0)
  87. #define MSM_VIDC_ERROR(value) \
  88. do { if (value) \
  89. d_vpr_e("BugOn"); \
  90. } while (0)
  91. const char *level_str(u32 level);
  92. #endif