mdss_debug.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef MDSS_DEBUG_H
  14. #define MDSS_DEBUG_H
  15. #include <stdarg.h>
  16. #include "mdss.h"
  17. #include "mdss_mdp_trace.h"
  18. #define MISR_POLL_SLEEP 2000
  19. #define MISR_POLL_TIMEOUT 32000
  20. #define MISR_CRC_BATCH_CFG 0x101
  21. #define DATA_LIMITER (-1)
  22. #define XLOG_TOUT_DATA_LIMITER (NULL)
  23. #define XLOG_FUNC_ENTRY 0x1111
  24. #define XLOG_FUNC_EXIT 0x2222
  25. #define MDSS_REG_BLOCK_NAME_LEN (5)
  26. #define MDSS_XLOG(...) mdss_xlog(__func__, ##__VA_ARGS__, DATA_LIMITER)
  27. #define MDSS_XLOG_TOUT_HANDLER(...) \
  28. mdss_xlog_tout_handler(__func__, ##__VA_ARGS__, XLOG_TOUT_DATA_LIMITER)
  29. #define ATRACE_END(name) trace_tracing_mark_write(current->tgid, name, 0)
  30. #define ATRACE_BEGIN(name) trace_tracing_mark_write(current->tgid, name, 1)
  31. #define ATRACE_FUNC() ATRACE_BEGIN(__func__)
  32. #define ATRACE_INT(name, value) \
  33. trace_mdp_trace_counter(current->tgid, name, value)
  34. #ifdef CONFIG_DEBUG_FS
  35. struct mdss_debug_base {
  36. struct mdss_debug_data *mdd;
  37. char name[80];
  38. void __iomem *base;
  39. size_t off;
  40. size_t cnt;
  41. size_t max_offset;
  42. char *buf;
  43. size_t buf_len;
  44. struct list_head head;
  45. };
  46. struct debug_log {
  47. struct dentry *xlog;
  48. u32 xlog_enable;
  49. u32 panic_on_err;
  50. u32 enable_reg_dump;
  51. };
  52. struct mdss_debug_data {
  53. struct dentry *root;
  54. struct dentry *perf;
  55. struct list_head base_list;
  56. struct debug_log logd;
  57. };
  58. int mdss_debugfs_init(struct mdss_data_type *mdata);
  59. int mdss_debugfs_remove(struct mdss_data_type *mdata);
  60. int mdss_debug_register_base(const char *name, void __iomem *base,
  61. size_t max_offset);
  62. int mdss_misr_set(struct mdss_data_type *mdata, struct mdp_misr *req,
  63. struct mdss_mdp_ctl *ctl);
  64. int mdss_misr_get(struct mdss_data_type *mdata, struct mdp_misr *resp,
  65. struct mdss_mdp_ctl *ctl);
  66. void mdss_misr_crc_collect(struct mdss_data_type *mdata, int block_id);
  67. int mdss_create_xlog_debug(struct mdss_debug_data *mdd);
  68. void mdss_xlog(const char *name, ...);
  69. void mdss_xlog_dump(void);
  70. void mdss_dump_reg(char __iomem *base, int len);
  71. void mdss_dsi_debug_check_te(struct mdss_panel_data *pdata);
  72. void mdss_xlog_tout_handler(const char *name, ...);
  73. #else
  74. static inline int mdss_debugfs_init(struct mdss_data_type *mdata) { return 0; }
  75. static inline int mdss_debugfs_remove(struct mdss_data_type *mdata)
  76. { return 0; }
  77. static inline int mdss_debug_register_base(const char *name, void __iomem *base,
  78. size_t max_offset) { return 0; }
  79. static inline int mdss_misr_set(struct mdss_data_type *mdata,
  80. struct mdp_misr *req,
  81. struct mdss_mdp_ctl *ctl)
  82. { return 0; }
  83. static inline int mdss_misr_get(struct mdss_data_type *mdata,
  84. struct mdp_misr *resp,
  85. struct mdss_mdp_ctl *ctl)
  86. { return 0; }
  87. static inline void mdss_misr_crc_collect(struct mdss_data_type *mdata,
  88. int block_id) { }
  89. static inline int create_xlog_debug(struct mdss_data_type *mdata) { }
  90. static inline void mdss_xlog(const char *name, ...) { }
  91. static inline void mdss_xlog_dump(void) { }
  92. static inline void mdss_dump_reg(char __iomem *base, int len) { }
  93. static inline void mdss_dsi_debug_check_te(struct mdss_panel_data *pdata) { }
  94. static inline void mdss_xlog_tout_handler(const char *name, ...) { }
  95. #endif
  96. #endif /* MDSS_DEBUG_H */