sde_rotator_debug.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __SDE_ROTATOR_DEBUG_H__
  6. #define __SDE_ROTATOR_DEBUG_H__
  7. #include <linux/types.h>
  8. #include <linux/dcache.h>
  9. #define SDE_ROT_DATA_LIMITER (-1)
  10. #define SDE_ROT_EVTLOG_TOUT_DATA_LIMITER (NULL)
  11. #define SDE_ROT_EVTLOG_PANIC 0xdead
  12. #define SDE_ROT_EVTLOG_FATAL 0xbad
  13. #define SDE_ROT_EVTLOG_ERROR 0xebad
  14. enum sde_rot_dbg_reg_dump_flag {
  15. SDE_ROT_DBG_DUMP_IN_LOG = BIT(0),
  16. SDE_ROT_DBG_DUMP_IN_MEM = BIT(1),
  17. };
  18. enum sde_rot_dbg_evtlog_flag {
  19. SDE_ROT_EVTLOG_DEFAULT = BIT(0),
  20. SDE_ROT_EVTLOG_IOMMU = BIT(1),
  21. SDE_ROT_EVTLOG_DBG = BIT(6),
  22. SDE_ROT_EVTLOG_ALL = BIT(7)
  23. };
  24. #define SDEROT_EVTLOG(...) sde_rot_evtlog(__func__, __LINE__, \
  25. SDE_ROT_EVTLOG_DEFAULT, ##__VA_ARGS__, SDE_ROT_DATA_LIMITER)
  26. #define SDEROT_EVTLOG_TOUT_HANDLER(...) \
  27. sde_rot_evtlog_tout_handler(false, __func__, ##__VA_ARGS__, \
  28. SDE_ROT_EVTLOG_TOUT_DATA_LIMITER)
  29. #if defined(CONFIG_MSM_SDE_ROTATOR_EVTLOG_DEBUG) && \
  30. defined(CONFIG_DEBUG_FS)
  31. void sde_rot_evtlog(const char *name, int line, int flag, ...);
  32. void sde_rot_evtlog_tout_handler(bool queue, const char *name, ...);
  33. #else
  34. static inline
  35. void sde_rot_evtlog(const char *name, int line, int flag, ...)
  36. {
  37. }
  38. static inline
  39. void sde_rot_evtlog_tout_handler(bool queue, const char *name, ...)
  40. {
  41. }
  42. #endif
  43. struct sde_rotator_device;
  44. struct sde_rotator_debug_base {
  45. char name[80];
  46. void __iomem *base;
  47. size_t off;
  48. size_t cnt;
  49. size_t max_offset;
  50. char *buf;
  51. size_t buf_len;
  52. struct sde_rot_mgr *mgr;
  53. struct mutex buflock;
  54. };
  55. #if defined(CONFIG_DEBUG_FS)
  56. struct dentry *sde_rotator_create_debugfs(
  57. struct sde_rotator_device *rot_dev);
  58. void sde_rotator_destroy_debugfs(struct dentry *debugfs);
  59. #else
  60. static inline
  61. struct dentry *sde_rotator_create_debugfs(
  62. struct sde_rotator_device *rot_dev)
  63. {
  64. return NULL;
  65. }
  66. static inline
  67. void sde_rotator_destroy_debugfs(struct dentry *debugfs)
  68. {
  69. }
  70. #endif
  71. #endif /* __SDE_ROTATOR_DEBUG_H__ */