dp_debug.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
  4. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  5. */
  6. #ifndef _DP_DEBUG_H_
  7. #define _DP_DEBUG_H_
  8. #include "dp_panel.h"
  9. #include "dp_ctrl.h"
  10. #include "dp_link.h"
  11. #include "dp_aux.h"
  12. #include "dp_display.h"
  13. #include "dp_pll.h"
  14. #include <linux/ipc_logging.h>
  15. #define DP_IPC_LOG(fmt, ...) \
  16. do { \
  17. void *ipc_logging_context = get_ipc_log_context(); \
  18. ipc_log_string(ipc_logging_context, fmt, ##__VA_ARGS__); \
  19. } while (0)
  20. #define DP_DEBUG(fmt, ...) \
  21. do { \
  22. DP_IPC_LOG("[d][%-4d]"fmt, current->pid, ##__VA_ARGS__); \
  23. DP_DEBUG_V(fmt, ##__VA_ARGS__); \
  24. } while (0)
  25. #define DP_INFO(fmt, ...) \
  26. do { \
  27. DP_IPC_LOG("[i][%-4d]"fmt, current->pid, ##__VA_ARGS__); \
  28. DP_INFO_V(fmt, ##__VA_ARGS__); \
  29. } while (0)
  30. #define DP_WARN(fmt, ...) \
  31. do { \
  32. DP_IPC_LOG("[w][%-4d]"fmt, current->pid, ##__VA_ARGS__); \
  33. DP_WARN_V(fmt, ##__VA_ARGS__); \
  34. } while (0)
  35. #define DP_ERR(fmt, ...) \
  36. do { \
  37. DP_IPC_LOG("[e][%-4d]"fmt, current->pid, ##__VA_ARGS__); \
  38. DP_ERR_V(fmt, ##__VA_ARGS__); \
  39. } while (0)
  40. #define DP_DEBUG_V(fmt, ...) \
  41. do { \
  42. if (drm_debug_enabled(DRM_UT_KMS)) \
  43. DRM_DEBUG("[msm-dp-debug][%-4d]"fmt, current->pid, \
  44. ##__VA_ARGS__); \
  45. else \
  46. pr_debug("[drm:%s][msm-dp-debug][%-4d]"fmt, __func__,\
  47. current->pid, ##__VA_ARGS__); \
  48. } while (0)
  49. #define DP_INFO_V(fmt, ...) \
  50. do { \
  51. if (drm_debug_enabled(DRM_UT_KMS)) \
  52. DRM_INFO("[msm-dp-info][%-4d]"fmt, current->pid, \
  53. ##__VA_ARGS__); \
  54. else \
  55. pr_info("[drm:%s][msm-dp-info][%-4d]"fmt, __func__, \
  56. current->pid, ##__VA_ARGS__); \
  57. } while (0)
  58. #define DP_WARN_V(fmt, ...) \
  59. pr_warn("[drm:%s][msm-dp-warn][%-4d]"fmt, __func__, \
  60. current->pid, ##__VA_ARGS__)
  61. #define DP_WARN_RATELIMITED_V(fmt, ...) \
  62. pr_warn_ratelimited("[drm:%s][msm-dp-warn][%-4d]"fmt, __func__, \
  63. current->pid, ##__VA_ARGS__)
  64. #define DP_ERR_V(fmt, ...) \
  65. pr_err("[drm:%s][msm-dp-err][%-4d]"fmt, __func__, \
  66. current->pid, ##__VA_ARGS__)
  67. #define DP_ERR_RATELIMITED_V(fmt, ...) \
  68. pr_err_ratelimited("[drm:%s][msm-dp-err][%-4d]"fmt, __func__, \
  69. current->pid, ##__VA_ARGS__)
  70. #define DEFAULT_DISCONNECT_DELAY_MS 0
  71. #define MAX_DISCONNECT_DELAY_MS 10000
  72. #define DEFAULT_CONNECT_NOTIFICATION_DELAY_MS 150
  73. #define MAX_CONNECT_NOTIFICATION_DELAY_MS 5000
  74. /**
  75. * struct dp_debug
  76. * @sim_mode: specifies whether sim mode enabled
  77. * @psm_enabled: specifies whether psm enabled
  78. * @hdcp_disabled: specifies if hdcp is disabled
  79. * @hdcp_wait_sink_sync: used to wait for sink synchronization before HDCP auth
  80. * @tpg_pattern: selects tpg pattern on the controller
  81. * @max_pclk_khz: max pclk supported
  82. * @force_encryption: enable/disable forced encryption for HDCP 2.2
  83. * @skip_uevent: skip hotplug uevent to the user space
  84. * @hdcp_status: string holding hdcp status information
  85. * @mst_sim_add_con: specifies whether new sim connector is to be added
  86. * @mst_sim_remove_con: specifies whether sim connector is to be removed
  87. * @mst_sim_remove_con_id: specifies id of sim connector to be removed
  88. * @connect_notification_delay_ms: time (in ms) to wait for any attention
  89. * messages before sending the connect notification uevent
  90. * @disconnect_delay_ms: time (in ms) to wait before turning off the mainlink
  91. * in response to HPD low of cable disconnect event
  92. */
  93. struct dp_debug {
  94. bool sim_mode;
  95. bool psm_enabled;
  96. bool hdcp_disabled;
  97. bool hdcp_wait_sink_sync;
  98. u32 tpg_pattern;
  99. u32 max_pclk_khz;
  100. bool force_encryption;
  101. bool skip_uevent;
  102. char hdcp_status[SZ_128];
  103. bool mst_sim_add_con;
  104. bool mst_sim_remove_con;
  105. int mst_sim_remove_con_id;
  106. unsigned long connect_notification_delay_ms;
  107. u32 disconnect_delay_ms;
  108. void (*abort)(struct dp_debug *dp_debug);
  109. void (*set_mst_con)(struct dp_debug *dp_debug, int con_id);
  110. };
  111. /**
  112. * struct dp_debug_in
  113. * @dev: device instance of the caller
  114. * @panel: instance of panel module
  115. * @hpd: instance of hpd module
  116. * @link: instance of link module
  117. * @aux: instance of aux module
  118. * @connector: double pointer to display connector
  119. * @catalog: instance of catalog module
  120. * @parser: instance of parser module
  121. * @ctrl: instance of controller module
  122. * @pll: instance of pll module
  123. * @display: instance of display module
  124. */
  125. struct dp_debug_in {
  126. struct device *dev;
  127. struct dp_panel *panel;
  128. struct dp_hpd *hpd;
  129. struct dp_link *link;
  130. struct dp_aux *aux;
  131. struct drm_connector **connector;
  132. struct dp_catalog *catalog;
  133. struct dp_parser *parser;
  134. struct dp_ctrl *ctrl;
  135. struct dp_pll *pll;
  136. struct dp_display *display;
  137. };
  138. /**
  139. * dp_debug_get() - configure and get the DisplayPlot debug module data
  140. *
  141. * @in: input structure containing data to initialize the debug module
  142. * return: pointer to allocated debug module data
  143. *
  144. * This function sets up the debug module and provides a way
  145. * for debugfs input to be communicated with existing modules
  146. */
  147. struct dp_debug *dp_debug_get(struct dp_debug_in *in);
  148. /**
  149. * dp_debug_put()
  150. *
  151. * Cleans up dp_debug instance
  152. *
  153. * @dp_debug: instance of dp_debug
  154. */
  155. void dp_debug_put(struct dp_debug *dp_debug);
  156. #endif /* _DP_DEBUG_H_ */