hw_fence_drv_debug.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __HW_FENCE_DRV_DEBUG
  6. #define __HW_FENCE_DRV_DEBUG
  7. enum hw_fence_drv_prio {
  8. HW_FENCE_HIGH = 0x000001, /* High density debug messages (noisy) */
  9. HW_FENCE_LOW = 0x000002, /* Low density debug messages */
  10. HW_FENCE_INFO = 0x000004, /* Informational prints */
  11. HW_FENCE_INIT = 0x00008, /* Initialization logs */
  12. HW_FENCE_QUEUE = 0x000010, /* Queue logs */
  13. HW_FENCE_LUT = 0x000020, /* Look-up and algorithm logs */
  14. HW_FENCE_IRQ = 0x000040, /* Interrupt-related messages */
  15. HW_FENCE_PRINTK = 0x010000,
  16. };
  17. extern u32 msm_hw_fence_debug_level;
  18. #define dprintk(__level, __fmt, ...) \
  19. do { \
  20. if (msm_hw_fence_debug_level & __level) \
  21. if (msm_hw_fence_debug_level & HW_FENCE_PRINTK) \
  22. pr_err(__fmt, ##__VA_ARGS__); \
  23. } while (0)
  24. #define HWFNC_ERR(fmt, ...) \
  25. pr_err("[hwfence:%s:%d][err][%pS] "fmt, __func__, __LINE__, \
  26. __builtin_return_address(0), ##__VA_ARGS__)
  27. #define HWFNC_DBG_H(fmt, ...) \
  28. dprintk(HW_FENCE_HIGH, "[hwfence:%s:%d][dbgh]"fmt, __func__, __LINE__, ##__VA_ARGS__)
  29. #define HWFNC_DBG_L(fmt, ...) \
  30. dprintk(HW_FENCE_LOW, "[hwfence:%s:%d][dbgl]"fmt, __func__, __LINE__, ##__VA_ARGS__)
  31. #define HWFNC_DBG_INFO(fmt, ...) \
  32. dprintk(HW_FENCE_INFO, "[hwfence:%s:%d][dbgi]"fmt, __func__, __LINE__, ##__VA_ARGS__)
  33. #define HWFNC_DBG_INIT(fmt, ...) \
  34. dprintk(HW_FENCE_INIT, "[hwfence:%s:%d][dbg]"fmt, __func__, __LINE__, ##__VA_ARGS__)
  35. #define HWFNC_DBG_Q(fmt, ...) \
  36. dprintk(HW_FENCE_QUEUE, "[hwfence:%s:%d][dbgq]"fmt, __func__, __LINE__, ##__VA_ARGS__)
  37. #define HWFNC_DBG_LUT(fmt, ...) \
  38. dprintk(HW_FENCE_LUT, "[hwfence:%s:%d][dbglut]"fmt, __func__, __LINE__, ##__VA_ARGS__)
  39. #define HWFNC_DBG_IRQ(fmt, ...) \
  40. dprintk(HW_FENCE_IRQ, "[hwfence:%s:%d][dbgirq]"fmt, __func__, __LINE__, ##__VA_ARGS__)
  41. #define HWFNC_WARN(fmt, ...) \
  42. pr_warn("[hwfence:%s:%d][warn][%pS] "fmt, __func__, __LINE__, \
  43. __builtin_return_address(0), ##__VA_ARGS__)
  44. int hw_fence_debug_debugfs_register(struct hw_fence_driver_data *drv_data);
  45. #endif /* __HW_FENCE_DRV_DEBUG */