tpd_debug.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #ifndef TPD_DEBUG_H
  2. #define TPD_DEBUG_H
  3. #ifdef TPD_DEBUG_CODE
  4. #include<linux/i2c.h>
  5. void tpd_debug_no_response(struct i2c_client *);
  6. extern int tpd_debug_nr;
  7. #define TPD_DEBUG_CHECK_NO_RESPONSE \
  8. do { \
  9. if (tpd_debug_nr) { \
  10. wait_event_interruptible_timeout(waiter, tpd_flag != 0, HZ/10); \
  11. if (tpd_flag == 0) { \
  12. tpd_debug_no_response(i2c_client); \
  13. continue; \
  14. } \
  15. } \
  16. } while (0)
  17. void tpd_debug_set_time(void);
  18. extern int tpd_debug_time;
  19. extern long tpd_last_2_int_time[2];
  20. extern long tpd_last_down_time;
  21. extern int tpd_start_profiling;
  22. extern int tpd_down_status;
  23. #define TPD_DEBUG_PRINT_INT \
  24. do { \
  25. if (tpd_debug_time) { \
  26. pr_warn("tp_int\n"); \
  27. } \
  28. } while (0)
  29. #define TPD_DEBUG_PRINT_UP \
  30. do { \
  31. if (pending == 0 && tpd_debug_time) { \
  32. tpd_down_status = 0; \
  33. pr_debug("up on %ld ms (+%ld ms)\n", \
  34. (tpd_last_2_int_time[1] - tpd_last_down_time) / 1000, \
  35. (tpd_last_2_int_time[1] - tpd_last_2_int_time[0]) / 1000); \
  36. } \
  37. } while (0)
  38. #define TPD_DEBUG_PRINT_DOWN \
  39. do { \
  40. if (tpd_debug_time) { \
  41. if (tpd_down_status == 0)\
  42. pr_debug("down on 0 ms\n"); \
  43. else \
  44. pr_debug("move on %ld ms (+%ld ms)\n", \
  45. (tpd_last_2_int_time[1] - tpd_last_down_time) / 1000, \
  46. (tpd_last_2_int_time[1] - tpd_last_2_int_time[0]) / 1000); \
  47. tpd_down_status = 1; \
  48. } \
  49. } while (0)
  50. #define TPD_DEBUG_SET_TIME do { tpd_debug_set_time(); } while (0)
  51. extern int tpd_em_log;
  52. extern int tpd_em_log_to_fs;
  53. extern int tpd_type_cap;
  54. void tpd_em_log_output(int raw_x, int raw_y, int cal_x, int cal_y, int p, int down);
  55. void tpd_em_log_store(int raw_x, int raw_y, int cal_x, int cal_y, int p, int down);
  56. void tpd_em_log_release(void);
  57. #ifndef CREATE_TRACE_POINTS
  58. #define CREATE_TRACE_POINTS
  59. #endif
  60. noinline void MET_touch(int raw_x, int raw_y, int cal_x, int cal_y, int p, int down);
  61. #define TPD_TYPE_RAW_DATA 2
  62. #define TPD_TYPE_INT_DOWN 3
  63. #define TPD_TYPE_INT_UP 4
  64. #define TPD_TYPE_TIMER 5
  65. #define TPD_TYPE_REJECT1 6
  66. #define TPD_TYPE_REJECT2 7
  67. #define TPD_TYPE_FIST_LATENCY 8
  68. #define TPD_EM_PRINT(raw_x, raw_y, cal_x, cal_y, p, down) \
  69. do { \
  70. MET_touch(raw_x, raw_y, cal_x, cal_y, p, down); \
  71. if (tpd_em_log) { \
  72. if (!tpd_em_log_to_fs) { \
  73. tpd_em_log_output(raw_x, raw_y, cal_x, cal_y, p, down); \
  74. } else { \
  75. tpd_em_log_store(raw_x, raw_y, cal_x, cal_y, p, down); \
  76. tpd_em_log_output(raw_x, raw_y, cal_x, cal_y, p, down); \
  77. } \
  78. if (down == 1) \
  79. tpd_down_status = 1; \
  80. else if (down == 0) \
  81. tpd_down_status = 0; \
  82. } \
  83. else { \
  84. if (tpd_em_log_to_fs) { \
  85. tpd_em_log_release(); \
  86. } \
  87. } \
  88. } while (0)
  89. #ifdef TPD_DEBUG_TRACK
  90. extern void *dal_fb_addr;
  91. extern int tpd_debug_track;
  92. void tpd_up_debug_track(int x, int y);
  93. void tpd_down_debug_track(int x, int y);
  94. #define TPD_UP_DEBUG_TRACK(x, y) do { if (tpd_debug_track) tpd_up_debug_track(x, y); } while (0)
  95. #define TPD_DOWN_DEBUG_TRACK(x, y) do { if (tpd_debug_track) tpd_down_debug_track(x, y); } while (0)
  96. #endif /* TPD_DEBUG_TRACK */
  97. #endif /* TPD_DEBUG_CODE */
  98. /* Macros that will be embedded in code */
  99. #ifndef TPD_DEBUG_CHECK_NO_RESPONSE
  100. #define TPD_DEBUG_CHECK_NO_RESPONSE
  101. #endif
  102. #ifndef TPD_DEBUG_SET_TIME
  103. #define TPD_DEBUG_SET_TIME
  104. #endif
  105. #ifndef TPD_DEBUG_PRINT_UP
  106. #define TPD_DEBUG_PRINT_UP
  107. #endif
  108. #ifndef TPD_DEBUG_PRINT_DOWN
  109. #define TPD_DEBUG_PRINT_DOWN
  110. #endif
  111. #ifndef TPD_UP_DEBUG_TRACK
  112. #define TPD_UP_DEBUG_TRACK(x, y)
  113. #endif
  114. #ifndef TPD_DOWN_DEBUG_TRACK
  115. #define TPD_DOWN_DEBUG_TRACK(x, y)
  116. #endif
  117. #endif /* TPD_DEBUG_H */